-
Notifications
You must be signed in to change notification settings - Fork 94
Description
I ran in to troubles with version 5.1.0 of qemu with disk.py. Converting from qemu internal snapshot to qcow2 fails with:
RuntimeError: qemu-img convert -f qcow2 -o backing_file=/var/lib/libvirt/images/win7.qcow2 -O qcow2 -s ip_address /home/kedle/see/instances/98ea3022-83de-4bd2-9fb9-90a806124903/98ea3022-83de-4bd2-9fb9-90a806124903 /home/kedle/see/disklogs/ip_address.qcow2
qemu-img: unrecognized option '-s'
Turns out the -s option for convert has been removed in version 3.0:
The qemu-img "convert -s snapshot_id_or_name" argument has been removed. Use "convert -l snapshot_param" instead.
I got disk snapshotting and analysis working by changing the command formulation in disk.py from this:
process = launch_process(QEMU_IMG, "convert", "-f", "qcow2", "-o",
"backing_file=%s" % volume_backing_path(volume),
"-O", "qcow2", "-s", name,
volume_path(volume), path)to this:
process = launch_process(QEMU_IMG, "convert", "-U", "-f", "qcow2", "-o",
"backing_file=%s" % volume_backing_path(volume),
"-O", "qcow2", "-l", name,
volume_path(volume), path)I had to include -U (or --force-share) to be able to read the snapshot
--force-share (-U)
If specified, qemu-img will open the image in shared mode, allowing other QEMU processes to open it in write mode. For example, this can be used to get the image information (with ‘info’ subcommand) when the image is used by a running guest. Note that this could produce inconsistent results because of concurrent metadata changes, etc. This option is only allowed when opening images in read-only mode.
Result:
qemu-img convert -U -f qcow2 -o backing_file=/var/lib/libvirt/images/win7.qcow2 -O qcow2 -l post_shutdown /home/kedle/see/instances/d1c9e7ea-0387-4ff8-870c-36510e9e0a3f/d1c9e7ea-0387-4ff8-870c-36510e9e0a3f /home/kedle/see/disklogs/post_shutdown.qcow2Don't know if this would work with older QEMU. My version information:
Python 3.8.5
QEMU 5.1.0
libvirt 6.5.0