Commit 8c58dc45 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Update metadata on create, import, reinstall, modify



Note that create and import are the same LU, therefore, there are a
total of 3 calls, not 4.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 0ef72034
......@@ -62,8 +62,7 @@ from ganeti.cmdlib.instance_utils import BuildInstanceHookEnvByObject, \
NICToTuple, CheckNodeNotDrained, RemoveInstance, CopyLockList, \
ReleaseLocks, CheckNodeVmCapable, CheckTargetNodeIPolicy, \
GetInstanceInfoText, RemoveDisks, CheckNodeFreeMemory, \
CheckInstanceBridgesExist, CheckNicsBridgesExist
CheckInstanceBridgesExist, CheckNicsBridgesExist, UpdateMetadata
import ganeti.masterd.instance
......@@ -1632,6 +1631,10 @@ class LUInstanceCreate(LogicalUnit):
False, self.op.reason)
result.Raise("Could not start instance")
UpdateMetadata(feedback_fn, self.rpc, iobj,
osparams_private=self.op.osparams_private,
osparams_secret=self.op.osparams_secret)
return self.cfg.GetNodeNames(list(iobj.all_nodes))
......@@ -3815,6 +3818,8 @@ class LUInstanceSetParams(LogicalUnit):
self.cfg.MarkInstanceDown(self.instance.uuid)
result.append(("admin_state", constants.ADMINST_DOWN))
UpdateMetadata(feedback_fn, self.rpc, self.instance)
assert not (self.owned_locks(locking.LEVEL_NODE_RES) or
self.owned_locks(locking.LEVEL_NODE)), \
"All node locks should have been released by now"
......
......@@ -41,7 +41,7 @@ from ganeti.cmdlib.common import INSTANCE_ONLINE, INSTANCE_DOWN, \
from ganeti.cmdlib.instance_storage import StartInstanceDisks, \
ShutdownInstanceDisks, ImageDisks
from ganeti.cmdlib.instance_utils import BuildInstanceHookEnvByObject, \
CheckInstanceBridgesExist, CheckNodeFreeMemory
CheckInstanceBridgesExist, CheckNodeFreeMemory, UpdateMetadata
from ganeti.hypervisor import hv_base
......@@ -329,6 +329,9 @@ class LUInstanceReinstall(LogicalUnit):
os_params_secret=params_secret
)
self.osparams_private = params_private
self.osparams_secret = params_secret
CheckOSParams(self, True, node_uuids, instance_os, self.osparams,
self.op.force_variant)
......@@ -391,6 +394,11 @@ class LUInstanceReinstall(LogicalUnit):
if os_type:
self._ReinstallOSScripts(self.instance, self.osparams,
self.op.debug_level)
UpdateMetadata(feedback_fn, self.rpc, self.instance,
osparams_public=self.osparams,
osparams_private=self.osparams_private,
osparams_secret=self.osparams_secret)
finally:
ShutdownInstanceDisks(self, self.instance)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment