canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

Validate cluster.https_address at configuration and allow change if node is not part of a cluster yet. #6167

Closed lepokle closed 5 years ago

lepokle commented 5 years ago

Required information

Issue description

I had run a single LXD node over the past three years. However I wanted to extend this setup and build a cluster now. By accident, I've set the cluster.https_address to 192.168.167.1:8443s (note the s at the end) by executing lxc config set cluster.https_address=192.168.167.1:8443s. LXD reports the following error:

Error: cannot listen on https socket: listen tcp: lookup tcp/8443s: Servname not supported for ai_socktype

Unfortunately I was not able to fix the misspelled address because changing this property is not yet supported. Running the command again shows:

Error: Changing cluster.https_address is currently not supported

Note that the node was not part of a cluster yet:

$ lxc cluster list
Error: LXD server isn't part of a cluster

I think validation of the address and/or allowing to change the address while node is not part of a cluster would be helpful.

I've changed the value using raw SQL with lxd sql. I hope this does not cause any issues now when starting to build the cluster.

Steps to reproduce

  1. A single node LXD instance (no cluster) is needed
  2. Set cluster.https_address to an invalid address like 192.168.167.1:8443s
  3. Try to fix it
GuanglinDu commented 2 years ago

I ran across the similar problem when creating a cluster with several old laptops. There must be something wrong when the first node was initialized. I re-created this node several times with "lxd init" before fixing the problem. I tweaked the options carefully according to my former operations and the prompts, such as the following one should be yes, then I fed it with the local cabled host network interface name:

Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: enp0s25