qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question: How do I discard any changes for the device which is set b


From: Kevin Wolf
Subject: Re: Question: How do I discard any changes for the device which is set by blockdev option?
Date: Wed, 20 May 2020 10:24:55 +0200

Am 19.05.2020 um 19:56 hat Masayoshi Mizuma geschrieben:
> Hello,
> 
> I would like to discard any changes while the qemu guest OS is done.
> I can do that with snapshot and drive option.
> However, snapshot option doesn't work for the device which set by
> blockdev option like as:
> 
> $QEMU --enable-kvm \
>       -m 1024 \
>       -nographic \
>       -serial mon:stdio \
>       -blockdev driver=file,node-name=mydisk,filename=/mnt/fedora.qcow2 \
>       -blockdev driver=qcow2,node-name=vda,file=mydisk \
>       -device virtio-blk-pci,drive=vda,bootindex=1 \
>       -snapshot
> 
> I would like to use blockdev option to set the device because
> libvirt uses blockdev option for disk element.
> 
> If there's no way to do so, does that make sense to get available
> snapshot option to blockdev as well? If that makes sense, I'll try to
> implement that.

The idea with -blockdev is that you have control over every single layer
in the block device tree and manage everything explicitly. This is
mainly useful for management applications, but of course also provides
more control to human users where necessary, at the cost of being less
convenient than -drive.

-snapshot is pretty much the opposite: It's a high-level convenience
option where you basically tell QEMU that you don't care about the
details, but you just want to get some temporary overlay.

So the expected way to achieve the same functionality with -blockdev is
that you create a temporary qcow2 overlay file that has your real image
as its backing file (this is what -snapshot really does) and then open
that explicitly.

As you correctly concluded, this is something that libvirt should
probably implement.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]