The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/318
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === I have added the example on how to migrate a container using pylxd As agreed in #315 The migration fails due to an error but the example should be correct
From f01c61e4f778fc757b2322fc204c9439df46e7ff Mon Sep 17 00:00:00 2001 From: gabrik <[email protected]> Date: Mon, 9 Jul 2018 11:24:13 +0200 Subject: [PATCH] example on migration --- doc/source/containers.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/source/containers.rst b/doc/source/containers.rst index c355302..864855e 100644 --- a/doc/source/containers.rst +++ b/doc/source/containers.rst @@ -144,6 +144,25 @@ To get state information such as a network address. {'family': 'inet', 'address': '10.251.77.182', 'netmask': '24', 'scope': 'global'} +To migrate a container between two servers, first you need to create a client certificate in order to connect to the remote server + + openssl req -newkey rsa:2048 -nodes -keyout lxd.key -out lxd.csr + openssl x509 -signkey lxd.key -in lxd.csr -req -days 365 -out lxd.crt + +Then you need to connect to both the destination server and the source server, +the source server has to be reachable by the destination server otherwise the migration will fail due to a websocket error + +.. code-block:: python + + from pylxd import Client + + client_source=Client(endpoint='https://192.168.1.104:8443',cert=('lxd.crt','lxd.key'),verify=False) + client_destination=Client(endpoint='https://192.168.1.106:8443',cert=('lxd.crt','lxd.key'),verify=False) + cont = client_source.containers.get('testm') + cont.migrate(client_destination,wait=True) + +This will migrate the container from source server to destination server + Container Snapshots -------------------
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
