Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated qemu-img convert option "-s" #70

Open
kedle opened this issue Sep 19, 2020 · 0 comments
Open

Deprecated qemu-img convert option "-s" #70

kedle opened this issue Sep 19, 2020 · 0 comments

Comments

@kedle
Copy link
Contributor

kedle commented Sep 19, 2020

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.qcow2

Don't know if this would work with older QEMU. My version information:
Python 3.8.5
QEMU 5.1.0
libvirt 6.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant