Re: [libvirt] Fail to start 2nd guest

On Mon, Feb 27, 2017 at 08:50:03PM +0800, Xiong Zhou wrote:
On Mon, Feb 27, 2017 at 10:11:04AM +0000, Stefan Hajnoczi wrote:
On Mon, Feb 27, 2017 at 05:40:50PM +0800, Xiong Zhou wrote:
It worked fine on Linus tree commit: 7bb0338 Merge tag 'rodata-v4.11-rc1' of git://git.kernel.org/pub/scm/..
failed to start 2nd domain on this commit: 37c8596 Merge tag 'tty-4.11-rc1' of git://git.kernel.org/pub/scm/.. (this commit probably is not the first bad, i didn't do the bisecting)
sh-4.2# uname -r 4.10.0-master-37c8596+ sh-4.2# rpm -qv qemu qemu-2.0.0-1.el7.6.x86_64 sh-4.2# ps ajxf | grep qemu ... sh-4.2# virsh list Id Name State ---------------------------------------------------- 1 73h running
sh-4.2# virsh start 73us error: Failed to start domain 73us error: internal error: qemu unexpectedly closed the monitor: ((null):11497): Spice-Warning **: reds.c:2499:reds_init_socket: listen: Address already in use 2017-02-27T09:33:42.335708Z qemu-kvm: failed to initialize spice server
The error message says that the spice remote desktop cannot listen on -spice port=5900,addr=127.0.0.1.
Did you hardcode port 5900 in the domain XML? That could explain why No. the second guest fails to launch - you need to use unique port numbers or let libvirt automatically assign them. Check the domain XML:
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
It looks like:
<graphics type='spice' autoport='yes'> <listen type='address'/> <image compression='off'/> </graphics>
Another possibility is that a process running on the host is already using port 5900. Perhaps a guest or VNC server that was launched outside of libvirt? You can check this with:
netstat -alpn | grep 5900
# netstat -alpn | grep 5900 tcp 0 0 127.0.0.1:5900 0.0.0.0:* LISTEN 11065/qemu-kvm
Please check that 11065/qemu-kvm was launched by the same libvirtd and its domain XML also uses autoport='yes'. I have CCed the libvirt mailing list because they may be able to explain why there is a collision on TCP port 5900. Stefan

On Mon, Feb 27, 2017 at 13:31:30 +0000, Stefan Hajnoczi wrote:
On Mon, Feb 27, 2017 at 08:50:03PM +0800, Xiong Zhou wrote:
On Mon, Feb 27, 2017 at 10:11:04AM +0000, Stefan Hajnoczi wrote:
On Mon, Feb 27, 2017 at 05:40:50PM +0800, Xiong Zhou wrote:
[...]
sh-4.2# virsh start 73us error: Failed to start domain 73us error: internal error: qemu unexpectedly closed the monitor: ((null):11497): Spice-Warning **: reds.c:2499:reds_init_socket: listen: Address already in use 2017-02-27T09:33:42.335708Z qemu-kvm: failed to initialize spice server
The error message says that the spice remote desktop cannot listen on -spice port=5900,addr=127.0.0.1.
Did you hardcode port 5900 in the domain XML? That could explain why No. the second guest fails to launch - you need to use unique port numbers or let libvirt automatically assign them. Check the domain XML:
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
It looks like:
<graphics type='spice' autoport='yes'> <listen type='address'/> <image compression='off'/> </graphics>
Another possibility is that a process running on the host is already using port 5900. Perhaps a guest or VNC server that was launched outside of libvirt? You can check this with:
netstat -alpn | grep 5900
# netstat -alpn | grep 5900 tcp 0 0 127.0.0.1:5900 0.0.0.0:* LISTEN 11065/qemu-kvm
Please check that 11065/qemu-kvm was launched by the same libvirtd and its domain XML also uses autoport='yes'.
I have CCed the libvirt mailing list because they may be able to explain why there is a collision on TCP port 5900.
There was a bug in the code. There could be a race between startup of two VMs: https://bugzilla.redhat.com/show_bug.cgi?id=1397440
participants (2)
-
Peter Krempa
-
Stefan Hajnoczi