Commit 703f9a66 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Remove calls to 'CheckNodeHasOS'



... because 'CheckOSParams' already checks the OS variant.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent ff030c75
......@@ -62,7 +62,7 @@ from ganeti.cmdlib.instance_utils import BuildInstanceHookEnvByObject, \
NICToTuple, CheckNodeNotDrained, RemoveInstance, CopyLockList, \
ReleaseLocks, CheckNodeVmCapable, CheckTargetNodeIPolicy, \
GetInstanceInfoText, RemoveDisks, CheckNodeFreeMemory, \
CheckInstanceBridgesExist, CheckNicsBridgesExist, CheckNodeHasOS
CheckInstanceBridgesExist, CheckNicsBridgesExist
import ganeti.masterd.instance
......@@ -1309,10 +1309,6 @@ class LUInstanceCreate(LogicalUnit):
CheckHVParams(self, node_uuids, self.op.hypervisor, self.op.hvparams)
if self.op.os_type is not None:
CheckNodeHasOS(self, pnode.uuid, self.op.os_type, self.op.force_variant)
# check OS parameters (remotely)
CheckOSParams(self, True, node_uuids, self.op.os_type, self.os_full,
self.op.force_variant)
......@@ -3093,14 +3089,7 @@ class LUInstanceSetParams(LogicalUnit):
self.nicmod = _PrepareContainerMods(self.op.nics, _InstNicModPrivate)
# OS change
if self.op.os_name and not self.op.force:
CheckNodeHasOS(self, self.instance.primary_node, self.op.os_name,
self.op.force_variant)
instance_os = self.op.os_name
else:
instance_os = self.instance.os
# disks processing
assert not (self.op.disk_template and self.op.disks), \
"Can't modify disk template and apply disk changes at the same time"
......@@ -3173,6 +3162,11 @@ class LUInstanceSetParams(LogicalUnit):
hvspecs)
# osparams processing
if self.op.os_name and not self.op.force:
instance_os = self.op.os_name
else:
instance_os = self.instance.os
if self.op.osparams or self.op.osparams_private:
public_parms = self.op.osparams or {}
private_parms = self.op.osparams_private or {}
......
......@@ -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, CheckNodeHasOS
CheckInstanceBridgesExist, CheckNodeFreeMemory
from ganeti.hypervisor import hv_base
......@@ -302,15 +302,6 @@ class LUInstanceReinstall(LogicalUnit):
def _MergeValidateOsParams(self, instance):
"Handle the OS parameter merging and validation for the target instance."
if self.op.os_type is not None:
# OS verification
CheckNodeHasOS(self, instance.primary_node, self.op.os_type,
self.op.force_variant)
instance_os = self.op.os_type
else:
instance_os = instance.os
node_uuids = list(instance.all_nodes)
self.op.osparams = self.op.osparams or {}
......@@ -323,6 +314,12 @@ class LUInstanceReinstall(LogicalUnit):
self.op.osparams_private)
params_secret = self.op.osparams_secret
# Handle OS parameters
if self.op.os_type is not None:
instance_os = self.op.os_type
else:
instance_os = instance.os
cluster = self.cfg.GetClusterInfo()
self.osparams = cluster.SimpleFillOS(
instance_os,
......
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