Commit 1f334d96 authored by Iustin Pop's avatar Iustin Pop
Browse files

Update the RAPI client for the migration mode

See the discussion on the previous patch about this. Basically unless we
want to a add a new 'feature' marking for the live migration parameter,
there is no simple way to handle this nicely in the client.

Given that the client was/is marked as experimental, this patch simply
replaces live with mode. This means that this client won't work with 2.1
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarRené Nussbaumer <>
parent f907fcf2
......@@ -1068,13 +1068,14 @@ class GanetiRapiClient(object):
("/%s/nodes/%s/evacuate" %
(GANETI_RAPI_VERSION, node)), query, None)
def MigrateNode(self, node, live=True, dry_run=False):
def MigrateNode(self, node, mode=None, dry_run=False):
"""Migrates all primary instances from a node.
@type node: str
@param node: node to migrate
@type live: bool
@param live: whether to use live migration
@type mode: string
@param mode: if passed, it will overwrite the live migration type,
otherwise the hypervisor default will be used
@type dry_run: bool
@param dry_run: whether to perform a dry run
......@@ -1083,8 +1084,8 @@ class GanetiRapiClient(object):
query = []
if live:
query.append(("live", 1))
if mode is not None:
query.append(("mode", mode))
if dry_run:
query.append(("dry-run", 1))
......@@ -775,7 +775,15 @@ class GanetiRapiClientTests(testutils.GanetiTestCase):
self.assertEqual(1111, self.client.MigrateNode("node-a", dry_run=True))
self.assertQuery("live", ["1"])
self.assert_("mode" not in self.rapi.GetLastHandler().queryargs)
self.assertEqual(1112, self.client.MigrateNode("node-a", dry_run=True,
self.assertQuery("mode", ["live"])
def testGetNodeRole(self):
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