View previous topic :: View next topic |
Author |
Message |
sipingal n00b
Joined: 12 May 2008 Posts: 62 Location: China
|
Posted: Sun Mar 17, 2013 1:42 pm Post subject: [solved]virsh/virt-manager hangs with libvirt 1.0.2/1.0.3 |
|
|
Upgrading to libvirt 1.0.2/1.0.3, the virsh/virt-manager doesn't work anymore. I can see a zombie process after starting the libvirtd service. The old version 1.0.1 works great(I have a binary backup of the old version).
Code: | $ ps aux | grep -i qemu
qemu 32682 1.0 0.0 0 0 ? Z 21:20 0:00 [qemu-system-arm] <defunct>
qemu 32684 0.0 0.0 309008 4384 ? S 21:20 0:00 /usr/bin/qemu-system-arm -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize |
I roughly reviewed the source code of the new version libvirt(1.0.2 and 1.0.3), they add some new functions to do qemu capabilities check. Seems it doesn't work well.
Code: | $ ls /data/sources/libvirt-1.0.3/src/qemu/qemu_capabilities.*
/data/sources/libvirt-1.0.3/src/qemu/qemu_capabilities.c /data/sources/libvirt-1.0.3/src/qemu/qemu_capabilities.h |
The workaround is to kill the qemu-system-XXX processes one by one. Anyone faces the same issue here? Is there a graceful solution?
i.e
Code: | $ ps aux | grep -i qemu
qemu 32682 1.0 0.0 0 0 ? Z 21:20 0:00 [qemu-system-arm] <defunct>
qemu 32684 0.0 0.0 309008 4384 ? S 21:20 0:00 /usr/bin/qemu-system-arm -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize
# kill 32684
|
wait about 1 second
Code: | $ ps aux | grep -i qemu
qemu 32682 1.0 0.0 0 0 ? Z 21:20 0:00 [qemu-system-arm] <defunct>
qemu 32684 0.0 0.0 309008 4384 ? S 21:20 0:00 /usr/bin/qemu-system-arm -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize
# kill 32684 |
again, 1 second
Code: | $ ps aux | grep -i qemu
qemu 758 0.0 0.0 0 0 ? Z 21:22 0:00 [qemu-system-x86] <defunct>
qemu 760 0.0 0.0 311208 4268 ? S 21:22 0:00 /usr/bin/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -M none -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize
sipingal 2017 0.0 0.0 111016 1008 pts/0 S+ 21:27 0:00 grep --colour=auto -i qemu
# kill 760
|
My system configuration:
Code: | $ eix -I libvirt
[I] app-emulation/libvirt
Available versions: 0.10.2.1[1] (~)0.10.2.2[1] (~)1.0.0 (~)1.0.0[1] (~)1.0.1[1] 1.0.2-r2 1.0.2-r2[1] (~)1.0.3 (~)1.0.3[1] (~)1.0.3-r1 **9999 **9999[1] {audit avahi +caps debug firewalld fuse iscsi +libvirtd lvm +lxc +macvtap nfs nls numa openvz parted pcap phyp policykit python qemu rbd sasl selinux +udev uml +vepa virt-network virtualbox xen ELIBC="glibc"}
Installed versions: 1.0.3-r1(09:00:22 PM 03/17/2013)(audit avahi caps fuse iscsi libvirtd lvm lxc macvtap nfs nls parted pcap phyp python qemu rbd sasl udev uml vepa virt-network -firewalld -numa -openvz -policykit -selinux -virtualbox -xen ELIBC="glibc")
Homepage: http://www.libvirt.org/
Description: C toolkit to manipulate virtual machines
[1] "Sipingal" /data/overlays/sipingal
|
Code: |
$ cat /etc/portage/make.conf | grep -i qemu
QEMU_SOFTMMU_TARGETS="x86_64 arm"
QEMU_USER_TARGETS="x86_64 arm" |
My temporary workaround:
create a script named kill_qemu.sh and place under /root
Code: | #!/bin/sh
while ( ! pgrep qemu-system 1> /dev/null 2>&1) do {
sleep 1
} done
while ( pgrep qemu-system 1> /dev/null 2>&1 ) do {
pkill qemu-system
sleep 1
} done
|
After that, add below line to /etc/init.d/libvirtd.
/root/kill_qemu.sh > /dev/null 2>&1 &
ie.
Code: | start-stop-daemon --stop --quiet --exec \
/usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid
/root/kill_qemu.sh > /dev/null 2>&1 &
eend $?
|
I appreciate your comments.
Thanks,
Sipingal
Last edited by sipingal on Tue Apr 09, 2013 3:27 am; edited 1 time in total |
|
Back to top |
|
|
sipingal n00b
Joined: 12 May 2008 Posts: 62 Location: China
|
|
Back to top |
|
|
sipingal n00b
Joined: 12 May 2008 Posts: 62 Location: China
|
Posted: Mon Apr 01, 2013 1:37 pm Post subject: |
|
|
Seems the issue is solved in 1.0.4. The qemu qmp monitor runs as daemon on 1.0.2/1.0.3 and virCommandRun waits the parent processes of the qemu process(to be a daemon , the processes forks itself and exit itself, the parent), but the parent routing exited. That makes the zombies. The libvirt-1.0.4 doesn't run the qemu qmp as a daemon instead of setting a daemon flag on this routing. That should be able to get rid of the issue.
cut from libvirt-1.0.4/src/qemu/qemu_capabilities.c
------------------------------
Code: | 2357 cmd = virCommandNewArgList(qemuCaps->binary,
2358 "-S",
2359 "-no-user-config",
2360 "-nodefaults",
2361 "-nographic",
2362 "-M", "none",
2363 "-qmp", monarg,
2364 "-pidfile", pidfile,
2365 NULL);
2366 virCommandAddEnvPassCommon(cmd);
2367 virCommandClearCaps(cmd);
2368 virCommandSetGID(cmd, runGid);
2369 virCommandSetUID(cmd, runUid);
2370 virCommandDaemon(cmd); ------> set daemon flag |
cut from libvirt-1.0.3/src/qemu/qemu_capabilities.c
Code: | 2357 cmd = virCommandNewArgList(qemuCaps->binary,
2358 "-S",
2359 "-no-user-config",
2360 "-nodefaults",
2361 "-nographic",
2362 "-M", "none",
2363 "-qmp", monarg,
2364 "-pidfile", pidfile,
2365 "-daemonize", -------------> qemu qmp monitor run as daemon
2366 NULL);
2367 virCommandAddEnvPassCommon(cmd);
2368 virCommandClearCaps(cmd);
2369 virCommandSetGID(cmd, runGid);
2370 virCommandSetUID(cmd, runUid);
|
I will create an ebuild to verify it. |
|
Back to top |
|
|
sipingal n00b
Joined: 12 May 2008 Posts: 62 Location: China
|
Posted: Tue Apr 09, 2013 3:26 am Post subject: |
|
|
After upgrading to libvirt-1.4.0, set network administration capabilities on the qemu-system-$ARCHs programs, it solves the issue:
On my system, it has three.
Code: |
# setcap cap_net_admin+ep /usr/bin/qemu-system-arm
# setcap cap_net_admin+ep /usr/bin/qemu-system-i386
# setcap cap_net_admin+ep /usr/bin/qemu-system-x86_64
|
|
|
Back to top |
|
|
sipingal n00b
Joined: 12 May 2008 Posts: 62 Location: China
|
Posted: Fri Jul 19, 2013 1:46 am Post subject: patch for version greater than 1.0.5 |
|
|
Code: | $ cat /etc/portage/patches/app-emulation/libvirt/qemutesting-witout-daemonz.patch
|
Code: | --- libvirt-1.0.5.orig/src/qemu/qemu_capabilities.c 2013-04-26 14:17:40.000000000 +0800
+++ libvirt-1.0.5/src/qemu/qemu_capabilities.c 2013-05-19 17:52:23.712369142 +0800
@@ -2452,16 +2452,19 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCa
"-M", "none",
"-qmp", monarg,
"-pidfile", pidfile,
- "-daemonize",
NULL);
virCommandAddEnvPassCommon(cmd);
virCommandClearCaps(cmd);
virCommandSetGID(cmd, runGid);
virCommandSetUID(cmd, runUid);
+ virCommandSetPidFile(cmd, pidfile);
+ virCommandDaemonize(cmd);
+
if (virCommandRun(cmd, &status) < 0)
goto cleanup;
+
if (status != 0) {
ret = 0;
VIR_DEBUG("QEMU %s exited with status %d", qemuCaps->binary, status);
@@ -2564,6 +2567,7 @@ cleanup:
VIR_FREE(monarg);
VIR_FREE(monpath);
VIR_FREE(package);
+
if (pid != 0) {
char ebuf[1024];
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|