Commit d15a9ad3 authored by Guido Trotter's avatar Guido Trotter
Browse files

Cleanup os_add/rename rpc for OS API 10

- remove now unused osdev and swapdev arguments from backend, noded,
  rpc, cmdlib
- convert docstrings to epydoc

Reviewed-by: iustinp
parent d324e3fc
......@@ -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):
......
......@@ -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)
......
......@@ -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))
......
......@@ -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()
......
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