Lxd move between remotes

Hi,
I’m having this issue with 2 brand new ubuntu servers 18.04, latest lxc/lxd from repositories.
I created a couple of containers in 2 hosts, but when I try to move from host 1 to host 2 it only works if I also rename.
Below the commands I’m executing,
host 1, lxd0, 172.20.1.134
host 2, lxd1, 172.20.1.131

root@lxd0:~# ifconfig enp0s3
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.20.1.134  netmask 255.255.255.0  broadcast 172.20.1.255
        inet6 fe80::a00:27ff:fee7:e238  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:e7:e2:38  txqueuelen 1000  (Ethernet)
        RX packets 1022430  bytes 214592516 (214.5 MB)
        RX errors 0  dropped 2178  overruns 0  frame 0
        TX packets 1302884  bytes 285327871 (285.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@lxd0:~# lxc remote list
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
|      NAME       |                   URL                    |   PROTOCOL    | AUTH TYPE | PUBLIC | STATIC |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| images          | https://images.linuxcontainers.org       | simplestreams |           | YES    | NO     |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| local (default) | unix://                                  | lxd           | tls       | NO     | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| lxd1            | https://172.20.1.131:8443                | lxd           | tls       | NO     | NO     |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu          | https://cloud-images.ubuntu.com/releases | simplestreams |           | YES    | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
| ubuntu-daily    | https://cloud-images.ubuntu.com/daily    | simplestreams |           | YES    | YES    |
+-----------------+------------------------------------------+---------------+-----------+--------+--------+
root@lxd0:~# lxc list
+--------+---------+------+------+------------+-----------+----------+
|  NAME  |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS | LOCATION |
+--------+---------+------+------+------------+-----------+----------+
| c7-001 | STOPPED |      |      | PERSISTENT | 0         | lxd0     |
+--------+---------+------+------+------------+-----------+----------+
| c7-002 | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+--------+---------+------+------+------------+-----------+----------+
root@lxd0:~# lxc move c7-001 lxd1:
Error: Failed container creation: Container 'c7-001' already exists
root@lxd0:~# lxc move c7-001 lxd1:c7-001
Error: Failed container creation: Container 'c7-001' already exists
root@lxd0:~# lxc move c7-001 lxd1:c7-001-new
root@lxd0:~# lxc list                                    
+------------+---------+------+------+------------+-----------+----------+
|    NAME    |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS | LOCATION |
+------------+---------+------+------+------------+-----------+----------+
| c7-001-new | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+------------+---------+------+------+------------+-----------+----------+
| c7-002     | STOPPED |      |      | PERSISTENT | 0         | lxd1     |
+------------+---------+------+------+------------+-----------+----------+
root@lxd0:~# 

Thanks all…

Similar to the other thread, you’re using a cluster so there’s no point in having multiple different remotes point to the same cluster as all nodes will behave exactly the same (that’s the point of clustering).

Instead you should have a single remote for your cluster and use --target to specify what node you want something to be moved to.

Note that there is currently an issue preventing moving a container within the cluster without renaming it (unless you’re using CEPH as storage backend).

So something like this should work fine:

lxc move c7-001 c7-001.tmp --target lxd1
lxc move c7-001.tmp c7-001

It’s two steps due to the need to rename the container when moving it between nodes, this part will hopefully be resolved soon, at which point you’ll be able to just do lxc move c7-001 --target lxd1 and have the container be moved.

1 Like

Thanks, I was clearly missing some fundamentals on clusters.

1 Like