diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 8116b9b1de25fac1f58938293533fadb4fbe7f14..6b73fc5b969173883808cc645be8ef8a22a8b9ce 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -321,18 +321,18 @@ class NodeHttpServer(http.HttpServer): """Install an OS on a given instance. """ - inst_s, os_disk, swap_disk = params + inst_s = params[0] inst = objects.Instance.FromDict(inst_s) - return backend.AddOSToInstance(inst, os_disk, swap_disk) + return backend.AddOSToInstance(inst) @staticmethod def perspective_instance_run_rename(params): """Runs the OS rename script for an instance. """ - inst_s, old_name, os_disk, swap_disk = params + inst_s, old_name = params inst = objects.Instance.FromDict(inst_s) - return backend.RunRenameInstance(inst, old_name, os_disk, swap_disk) + return backend.RunRenameInstance(inst, old_name) @staticmethod def perspective_instance_os_import(params): diff --git a/lib/backend.py b/lib/backend.py index d52b3552be724fbd3ef2481f81cce861b35ef924..7e25c682edfafdd87cd4bf7b5d34b44f72f781d8 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -516,13 +516,11 @@ def GetAllInstancesInfo(hypervisor_list): return output -def AddOSToInstance(instance, os_disk, swap_disk): +def AddOSToInstance(instance): """Add an OS to an instance. - Args: - instance: the instance object - os_disk: the instance-visible name of the os device - swap_disk: the instance-visible name of the swap device + @type instance: L{objects.Instance} + @param instance: Instance whose OS is to be installed """ inst_os = OSFromDisk(instance.os) @@ -548,14 +546,13 @@ def AddOSToInstance(instance, os_disk, swap_disk): return True -def RunRenameInstance(instance, old_name, os_disk, swap_disk): +def RunRenameInstance(instance, old_name): """Run the OS rename script for an instance. - Args: - instance: the instance object - old_name: the old name of the instance - os_disk: the instance-visible name of the os device - swap_disk: the instance-visible name of the swap device + @type instance: objects.Instance + @param instance: Instance whose OS is to be installed + @type old_name: string + @param old_name: previous instance name """ inst_os = OSFromDisk(instance.os) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 940dd8a91ee3aae41a3081c8e17afa070e1c198d..458e5b79b052f52acc8ed562dd05386d97f5aa4e 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2583,8 +2583,7 @@ class LURenameInstance(LogicalUnit): _StartInstanceDisks(self, inst, None) try: if not self.rpc.call_instance_run_rename(inst.primary_node, inst, - old_name, - "sda", "sdb"): + old_name): msg = ("Could not run OS rename script for instance %s on node %s" " (but the instance has been renamed in Ganeti)" % (inst.name, inst.primary_node)) @@ -3682,7 +3681,7 @@ class LUCreateInstance(LogicalUnit): if iobj.disk_template != constants.DT_DISKLESS: if self.op.mode == constants.INSTANCE_CREATE: feedback_fn("* running the instance OS create scripts...") - if not self.rpc.call_instance_os_add(pnode_name, iobj, "sda", "sdb"): + if not self.rpc.call_instance_os_add(pnode_name, iobj): raise errors.OpExecError("could not add os for instance %s" " on node %s" % (instance, pnode_name)) diff --git a/lib/rpc.py b/lib/rpc.py index 18c07cd8c1cf29f275d0163dc7cf2f5ddace7288..b2dbdbee27db942c943a92157021e390edfaecb9 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -269,25 +269,25 @@ class RpcRunner(object): c.run() return c.getresult().get(node, False) - def call_instance_os_add(self, node, inst, osdev, swapdev): + def call_instance_os_add(self, node, inst): """Installs an OS on the given instance. This is a single-node call. """ - params = [self._InstDict(inst), osdev, swapdev] + params = [self._InstDict(inst)] c = Client("instance_os_add", params) c.connect(node) c.run() return c.getresult().get(node, False) - def call_instance_run_rename(self, node, inst, old_name, osdev, swapdev): + def call_instance_run_rename(self, node, inst, old_name): """Run the OS rename script for an instance. This is a single-node call. """ - params = [self._InstDict(inst), old_name, osdev, swapdev] + params = [self._InstDict(inst), old_name] c = Client("instance_run_rename", params) c.connect(node) c.run()