All of lore.kernel.org
 help / color / mirror / Atom feed
* Question: How do I discard any changes for the device which is set by blockdev option?
@ 2020-05-19 17:56 Masayoshi Mizuma
  2020-05-19 18:41 ` Eric Blake
  2020-05-20  8:24 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Masayoshi Mizuma @ 2020-05-19 17:56 UTC (permalink / raw)
  To: qemu-devel, qemu-block

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.

As for qcow2, I think we can do such things to use qemu-img snapshot
command, for example save the original image and restore the image
after the qemu guest OS is shutdowned. However, it may be complecated
for user. I would like the simple way like as snapshot/drive option...

If I'm missing something, let me know.

Thanks!
Masa


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: How do I discard any changes for the device which is set by blockdev option?
  2020-05-19 17:56 Question: How do I discard any changes for the device which is set by blockdev option? Masayoshi Mizuma
@ 2020-05-19 18:41 ` Eric Blake
  2020-05-19 20:16   ` Masayoshi Mizuma
  2020-05-20  8:24 ` Kevin Wolf
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2020-05-19 18:41 UTC (permalink / raw)
  To: Masayoshi Mizuma, qemu-devel, qemu-block, libvirt-list

On 5/19/20 12:56 PM, Masayoshi Mizuma wrote:
> 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.
> 
> As for qcow2, I think we can do such things to use qemu-img snapshot
> command, for example save the original image and restore the image
> after the qemu guest OS is shutdowned. However, it may be complecated
> for user. I would like the simple way like as snapshot/drive option...
> 
> If I'm missing something, let me know.
> 

Sounds like a repeat of this thread:
https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg06144.html

where the consensus is yes, -blockdev and -snapshot are incompatible, 
libvirt has plans to use the <transient/> tag to behave the same as what 
-snapshot does (but no one has implemented it yet), and in the meantime, 
it is possible to force libvirt to avoid -blockdev if you still need to 
supply -snapshot behind libvirt's back.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: How do I discard any changes for the device which is set by blockdev option?
  2020-05-19 18:41 ` Eric Blake
@ 2020-05-19 20:16   ` Masayoshi Mizuma
  0 siblings, 0 replies; 4+ messages in thread
From: Masayoshi Mizuma @ 2020-05-19 20:16 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, qemu-block, libvirt-list

On Tue, May 19, 2020 at 01:41:08PM -0500, Eric Blake wrote:
> On 5/19/20 12:56 PM, Masayoshi Mizuma wrote:
> > 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.
> > 
> > As for qcow2, I think we can do such things to use qemu-img snapshot
> > command, for example save the original image and restore the image
> > after the qemu guest OS is shutdowned. However, it may be complecated
> > for user. I would like the simple way like as snapshot/drive option...
> > 
> > If I'm missing something, let me know.
> > 
> 
> Sounds like a repeat of this thread:
> https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg06144.html
> 
> where the consensus is yes, -blockdev and -snapshot are incompatible,
> libvirt has plans to use the <transient/> tag to behave the same as what
> -snapshot does (but no one has implemented it yet), and in the meantime, it
> is possible to force libvirt to avoid -blockdev if you still need to supply
> -snapshot behind libvirt's back.

Thank you for the info! I didn't notice the thread.
I got we should implement that feature for libvirt side, not qemu.

Thanks!
Masa

> 
> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: How do I discard any changes for the device which is set by blockdev option?
  2020-05-19 17:56 Question: How do I discard any changes for the device which is set by blockdev option? Masayoshi Mizuma
  2020-05-19 18:41 ` Eric Blake
@ 2020-05-20  8:24 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2020-05-20  8:24 UTC (permalink / raw)
  To: Masayoshi Mizuma; +Cc: qemu-devel, qemu-block

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-20  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 17:56 Question: How do I discard any changes for the device which is set by blockdev option? Masayoshi Mizuma
2020-05-19 18:41 ` Eric Blake
2020-05-19 20:16   ` Masayoshi Mizuma
2020-05-20  8:24 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.