[libvirt] Some problem with the save function

Daniel Berteaud daniel at firewall-services.com
Wed Sep 16 15:05:36 UTC 2009


Hi everyone. This is my first post to this list, so excuse me if it's
not the right place to poste info like this.

I've found some problems in qemu_driver.c in the latest versions of
libvirt:

- the first problem was also present in 0.7.0. If we run qemu guests
unprivileged, we cannot use the save function (virsh save
guestname /path/to/file). The reason seems to be that libvirt first
create the destination file to write the header and the XML definition.
The file is owned by root with 600 permission. Then, we ask qemu to
append the dump of the memory (via the migrate exec: call) to this file.
This part doesn't work because the qemu user cannot write to this file.
So we endup with a file which only contains the header and the XML, and
the guest is stoped :/

- the second problem is present since libvirt 0.7.1. Now that the saved
file can be compressed, it seems we cannot save in a raw format any
more. This is due to this part in the code (qemu_driver.c):

if (STREQ (prog, "raw"))
        prog = "cat";
    internalret = virAsprintf(&command, "migrate \"exec:"
                              "%s -c >> '%s' 2>/dev/null\"", prog,
safe_path);

which result in "migrate \"exec cat -c >> safe_path 2>/dev/null\""

But cat doesn't support the -c argument, so once again, the save fails,
as we end up with a save file which only contains the header and the XML
definition.


Unfortunately, my C knowledge is near 0, so I cannot correct this
myself.


- the third problem, is that restore doesn't work any more. I haven't
dig it yet, but when I try to restore a guest using a saved file
(uncompressed produced under libvirt 0.7.0), I've this error:

virsh restore /tmp/guest.state
error: Failed to restore domain from /tmp/guest.state
error: internal error unable to start guest: 


Nothing interesting in /var/log/libvirt/qemu/guest.log:

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/root USER=root
LOGNAME=root /usr/bin/qemu-kvm -S -M pc -m 2048 -smp 4 -name guest -uuid
37b5937b-eacf-fda6-f4d0-33537d61b414 -monitor
unix:/var/lib/libvirt/qemu/guest.monitor,server,nowait -localtime
-no-reboot -boot c -drive file=/dev/data/guest,if=ide,index=0,boot=on
-drive file=/var/lib/libvirt/iso/boot.iso,if=ide,media=cdrom,index=2
-net nic,macaddr=52:54:00:48:c4:ca,vlan=0,name=nic.0 -net
tap,fd=25,vlan=0,name=tap.0 -serial pty -parallel none -usb -usbdevice
tablet -vnc 127.0.0.1:0 -k fr -vga cirrus -incoming exec:cat


The qemu process eats 100% of CPU during a few seconds, then stops (if I
strace it during this time, I see a lot of error like bad file
descriptor). Anyone have save/restore functions working with 0.7.1 ?



Cheers, Daniel

-- 
Daniel Berteaud
FIREWALL-SERVICES SARL.
Société de Services en Logiciels Libres
Technopôle Montesquieu
33650 MARTILLAC
Tel : 05 56 64 15 32
Fax : 05 56 64 15 32
Mail: daniel at firewall-services.com
Web : http://www.firewall-services.com




More information about the libvir-list mailing list