From 9b28d122676347ab4edea3552556d4be2fff15ac Mon Sep 17 00:00:00 2001 From: Dimitris Aragiorgis Date: Wed, 9 Oct 2013 17:45:34 +0300 Subject: [PATCH] (2.10) Return link_name in blockdev_assemble rpc Until now this RPC returned only dev_path. Since we use it in hotplug we have to know the simlink of the device so that we pass it to the corresponding hypervisor command and include it in block_devices entry in runtime files. Fix unittest to be aware of changed rpc Signed-off-by: Dimitris Aragiorgis Signed-off-by: Thomas Thrainer Reviewed-by: Thomas Thrainer cmdlib unittest do not exist in stable-2.8 Conflicts: test/py/cmdlib/instance_migration_unittest.py test/py/cmdlib/instance_unittest.py Signed-off-by: Dimitris Aragiorgis --- lib/backend.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/backend.py b/lib/backend.py index 4c7fcad..575c048 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -1915,23 +1915,28 @@ def BlockdevAssemble(disk, owner, as_primary, idx): This is a wrapper over _RecursiveAssembleBD. @rtype: str or boolean - @return: a C{/dev/...} path for primary nodes, and - C{True} for secondary nodes + @return: a tuple with the C{/dev/...} path and the created symlink + for primary nodes, and (C{True}, C{True}) for secondary nodes """ try: result = _RecursiveAssembleBD(disk, owner, as_primary) if isinstance(result, bdev.BlockDev): # pylint: disable=E1103 - result = result.dev_path + dev_path = result.dev_path + link_name = None if as_primary: - _SymlinkBlockDev(owner, result, idx) + link_name = _SymlinkBlockDev(owner, dev_path, idx) + elif result: + return result, result + else: + _Fail("Unexpected result from _RecursiveAssembleBD") except errors.BlockDeviceError, err: _Fail("Error while assembling disk: %s", err, exc=True) except OSError, err: _Fail("Error while symlinking disk: %s", err, exc=True) - return result + return dev_path, link_name def BlockdevShutdown(disk): -- 1.7.10.4