[lxc-devel] [pylxd/master] Add support for container migration
zulcss on Github
lxc-bot at linuxcontainers.org
Mon Jun 6 17:31:16 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 395 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160606/835c20c4/attachment.bin>
-------------- next part --------------
From 2117aa6500d6c4cc8dff27db429982169455380f Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Mon, 6 Jun 2016 13:30:10 -0400
Subject: [PATCH] Add support for container migration
Add support for container migration
Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
pylxd/container.py | 6 ++++++
pylxd/tests/test_container.py | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/pylxd/container.py b/pylxd/container.py
index 5e2e153..6ba5d32 100644
--- a/pylxd/container.py
+++ b/pylxd/container.py
@@ -171,6 +171,12 @@ def state(self):
state = ContainerState(**response.json()['metadata'])
return state
+ def migrate(self):
+ response = self._client.api.containers[self.name].post(json={
+ 'migration': True})
+ migrate = ContainerState(**response.json()['metadata'])
+ return migrate
+
def start(self, timeout=30, force=True, wait=False):
"""Start the container."""
return self._set_state('start',
diff --git a/pylxd/tests/test_container.py b/pylxd/tests/test_container.py
index 932a38e..a2d9d6b 100644
--- a/pylxd/tests/test_container.py
+++ b/pylxd/tests/test_container.py
@@ -141,6 +141,13 @@ def test_delete(self):
an_container.delete(wait=True)
+ def test_migrate(self):
+ """A container is migrate."""
+ name = 'an-container'
+
+ an_container = container.Container.get(self.client, name)
+ an_container.migrate()
+
class TestContainerState(testing.PyLXDTestCase):
"""Tests for pylxd.container.ContainerState."""
More information about the lxc-devel
mailing list