Microstack libvirt how to enable TCP listening mode

591 views Asked by At

Microstack was setup as cluster with 2 computing nodes.

Version: microstack ussuri 222 latest/beta canonical✓ devmode

But libvirtd is default shipped only with sockets.

Change the configuration file:

/var/snap/microstack/common/libvirt/libvirtd.conf

to

listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
LIBVIRTD_ARGS="--listen"
unix_sock_rw_perms = "0770"
unix_sock_dir = "/var/snap/microstack/common/run/libvirt"
auth_unix_ro = "none"
auth_unix_rw = "none"
auth_tcp = "none"

and restart the service did not help. How TCP listening can be enabled that remote connections are possible in this specific snapd environment ?

Error Message:

virsh -c qemu+tcp://node1/system list
error: failed to connect to the hypervisor
error: unable to connect to server at 'node1:16509': Connection refused
1

There are 1 answers

1
Michael Bales On

I ran into this same issue and finally tracked it down. Firstly there was a recent change in libvirt that results in it ignoring the port / listen arguments in libvirtd.conf reference. After some digging I noticed the requisite .socket files were not present in /etc/systemd/system/. To resolve the issue copy the following files:

/snap/microstack/222/usr/lib/systemd/system/libvirtd-tcp.socket
/snap/microstack/222/usr/lib/systemd/system/libvirtd.socket

to /etc/systemd/system/. Next you'll need to make a few minor edits. In both libvirtd.socket and libvirtd-tcp.socket you'll change two lines:

#Before=libvirtd.service
Before=snap.microstack.libvirtd.service

#Service=libvirtd.service
Service=snap.microstack.libvirtd.service

and in libvirtd-tcp

remove or comment the line SocketGroup=libvirt from libvirtd.socket next you'll run systemctl daemon-reload, systemctl enable libvirtd-tcp.socket and lastly systemctl enable libvirtd.socket. Once that is done on any and all microstack compute / controller nodes reboot them and you should be able to live migrate instances between hosts.