diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 0b176c97ee..0bec555982 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -1206,13 +1206,16 @@ public: int updateconf(VirtualMachineTemplate* tmpl, std::string &err); /** - * Get the configuration attributes used in an updateconf API call. - * @param err description if any - * @return template with the attributes + * Check if the template includes any restricted attribute, different from + * this VM template. + * @param template to look for for restricted. The resulting tgt template + * will have the same restricted Attributes as this VM. + * @param ra the restricted attribute found to be different + * @return true if a different restricted is found */ - std::unique_ptr get_updateconf_template() const + bool check_restricted(std::string& ra, VirtualMachineTemplate * tgt) const { - return static_cast(obj_template.get())->get_updateconf_template(); + return tgt->check_restricted(ra, obj_template.get()); } // ------------------------------------------------------------------------- diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 368a557a38..c798c39689 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -3076,11 +3076,7 @@ void VirtualMachineUpdateConf::request_execute( { string aname; - auto conf_tmpl = vm->get_updateconf_template(); - - bool has_restricted = uc_tmpl->check_restricted(aname, conf_tmpl.get()); - - if (has_restricted) + if ( vm->check_restricted(aname, uc_tmpl.get()) ) { att.resp_msg = "Template includes a restricted attribute " + aname; failure_response(AUTHORIZATION, att);