Commit b2e7666a authored by Iustin Pop's avatar Iustin Pop
Browse files

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
parent 03dfa658
......@@ -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 --------------------------
......
......@@ -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")
......
......@@ -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):
......
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