pylxd: Debugging pylxd.exceptions.ClientConnectionFailed?

I’m trying to connect to an LXD cluster using the steps from this guide but I get a pylxd.exceptions.ClientConnectionFailed error:

>>> from pylxd import Client
>>> client = Client(endpoint='http://192.168.123.121:8443', cert=('lxd.crt', 'lxd.key'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pylxd/client.py", line 290, in __init__
    raise exceptions.ClientConnectionFailed()
pylxd.exceptions.ClientConnectionFailed

The hosts are on the same subnet (.120 is my host, .121 is the LXD cluster member), ping works, port 8443 is open, the cert files are in place, I can get an answer back with wget:

host_120:~$ ping -q -c 5 192.168.123.121
PING 192.168.123.121 (192.168.123.121) 56(84) bytes of data.

--- 192.168.123.121 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4081ms
rtt min/avg/max/mdev = 0.435/0.691/0.881/0.179 ms
host_121:~$ netstat -an | egrep "8443.*LISTEN"
tcp        0      0 192.168.123.121:8443    0.0.0.0:*               LISTEN     
host_120:~$ ls lxd.*
lxd.crt  lxd.csr  lxd.key
host_120:~$ wget http://192.168.123.121:8443/1.0
--2018-07-08 06:10:27--  http://192.168.123.121:8443/
Connecting to 192.168.123.121:8443... connected.
HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9
Length: unspecified
Saving to: '1.0'

1.0                                 [ <=>                                                                        ]       7  --.-KB/s    in 0s      

2018-07-08 06:10:27 (339 KB/s) - '1.0' saved [7]

The saved file contains “1503 0100 0202 0a” in hex. I did a capture too: pylxd.pcap.zip

Versions:

  • OS: Ubuntu 18.04 (Bionic) server
  • Python: 2.7.15rc1,
  • pylxd: 2.2.7
  • LXD: 3.0.1

Is it something with pylxd or the LXD cluster? Is there a way I could get a detailed error message, not just the exception?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 26 (12 by maintainers)

Most upvoted comments

@vanushwashere could you re-try with master branch please? There’s been a few commits in that area and it might have been fixed.

Ah, re: the remote error issue. Sorry, if you add , verify=False to the connection command, it will not verify the certificate and the connection should be made. You’ll get an Insecure warning though.

It could probably do with a better error message, but I’m pretty sure you have to use https://... rather than http://.. as your connection address, as LXD only supports SSL rather than unsecured transports. Ping back if that’s not your issue, though! If so, we might add some parsing/checking to ensure that pyxld is passed an https://....