mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
M #-: Reduce attribute copies on updateconf
(cherry picked from commit 99d165856d3132f5d5a495a75c8c80bb0865bfca)
This commit is contained in:
parent
29ef52b896
commit
0ebda56330
@ -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<VirtualMachineTemplate> get_updateconf_template() const
|
||||
bool check_restricted(std::string& ra, VirtualMachineTemplate * tgt) const
|
||||
{
|
||||
return static_cast<VirtualMachineTemplate*>(obj_template.get())->get_updateconf_template();
|
||||
return tgt->check_restricted(ra, obj_template.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user