From b2e7666a285e031d0116e219c4b3bae00202956e Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 7 Jan 2009 17:02:26 +0000 Subject: [PATCH] Pass instance name to rpc call blockdev_close This is an extract of commit 1166 on the 1.2 branch (Add a rpc call for drbd network reconfiguration), but only the blockdev_close part. The patch changes the blockdev_close call to take the instance so that it can remove the symlinks of the instance. Originally-Reviewed-by: imsnah --- daemons/ganeti-noded | 4 ++-- lib/backend.py | 6 +++++- lib/rpc.py | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 86952c6b5..c58df3025 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -229,8 +229,8 @@ class NodeHttpServer(http.server.HttpServer): """Closes the given block devices. """ - disks = [objects.Disk.FromDict(cf) for cf in params] - return backend.CloseBlockDevices(disks) + disks = [objects.Disk.FromDict(cf) for cf in params[1]] + return backend.CloseBlockDevices(params[0], disks) # export/import -------------------------- diff --git a/lib/backend.py b/lib/backend.py index 45434dcaf..fb030f583 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -2073,12 +2073,14 @@ def JobQueueSetDrainFlag(drain_flag): return True -def CloseBlockDevices(disks): +def CloseBlockDevices(instance_name, disks): """Closes the given block devices. This means they will be switched to secondary mode (in case of DRBD). + @param instance_name: if the argument is not empty, the symlinks + of this instance will be removed @type disks: list of L{objects.Disk} @param disks: the list of disks to be closed @rtype: tuple (success, message) @@ -2104,6 +2106,8 @@ def CloseBlockDevices(disks): if msg: return (False, "Can't make devices secondary: %s" % ",".join(msg)) else: + if instance_name: + _RemoveBlockDevLinks(instance_name) return (True, "All devices secondary") diff --git a/lib/rpc.py b/lib/rpc.py index a9619f9ad..bf16b5234 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -683,14 +683,14 @@ class RpcRunner(object): """ return self._SingleNodeCall(node, "blockdev_find", [disk.ToDict()]) - def call_blockdev_close(self, node, disks): + def call_blockdev_close(self, node, instance_name, disks): """Closes the given block devices. This is a single-node call. """ - return self._SingleNodeCall(node, "blockdev_close", - [cf.ToDict() for cf in disks]) + params = [instance_name, [cf.ToDict() for cf in disks]] + return self._SingleNodeCall(node, "blockdev_close", params) @classmethod def call_upload_file(cls, node_list, file_name, address_list=None): -- GitLab