Running "lxc network attach" on remote server returns "error: not found"

Greetings all,

Trying to perform an “lxc network attach <remote_server>:” from a central management server to a remote worker node and keep getting “error not found”. The command works fine if I login to the remote server and run the “lxc network attach” locally,. Not sure if this is expected behavior or a bug. Do I have the right syntax?

Examples:

root@QA_Manager# lxc network attach QA-Server-01:eth1 QA-Server-01:centos6-baseline
error: not found

root@QA_Manager# lxc network attach QA-Server-01:eth1 QA-Server-01:centos6-baseline eth0 eth0
error: not found

However, the command works properly if I login to the remote server and run the command locally:

root@QA_Server-01# lxc network attach eth1 centos6-baseline eth0 eth0
root@QA_Server-01#

Bug, expected behavior, command syntax problem?

LXD 2.12 on Ubuntu 17.04

Sorry I’ve been confusing you with this issue yesterday :slight_smile:

So looking at the help message, we’ve got:

lxc network attach [<remote>:]<network> <container> [device name] [interface name] 

Which hints that the network name must have the remote prefix but the container doesn’t, so that’d be:

lxc network attach QA-Server-01:eth1 centos6-baseline eth0 eth0

I tried attaching an interface to a remote container (the one running this forum):

stgraber@castiana:~/data/code/lxc/lxd (lxc/master)$ lxc network attach s-vorash:br1025 lxc-discourse01 eth1 eth1
stgraber@castiana:~/data/code/lxc/lxd (lxc/master)$

Hi Stephane,

Thanks for the feedback. For me, it seems the CLI is a little confusing - especially when doing remote management activities. Your example command worked on my system, but it seems to violate the perceived rules of local vs remote objects. I would expect any local object (network interface, etc) to be defined w/out a preceding host identifier. Conversely, I would expect any remote object to require a host identifier. Hope this makes sense.

I would expect this to work:

lxc network attach QA-Server-01:vxlan.1101 QA-Server-01:container01 eth0 eth0


But, I would not expect this to work (as it implies container01 is local):

lxc network attach QA-Server-01:vxlan.1101 container01 eth0 eth0


Finally, I would suggest adding some example commands inside the help details. For example, the “network attach” help message could read:

lxc network attach [:] [device name] [interface name]

examples:
lxc network attach bridge01 my_container eth0 eth0
lxc network attach remote_host:bridge01 remote_host:my_container eth0 eth0

BTW - many thanks to you and the Canonical team for the LXC/LXD product. This tool has greatly helped us move from monolithic VMs to more streamlined containers.