All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Masayoshi Mizuma <msys.mizuma@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
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	[thread overview]
Message-ID: <20200520082455.GA5192@linux.fritz.box> (raw)
In-Reply-To: <20200519175659.4poxgjmp4xoufl7h@gabell>

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



      parent reply	other threads:[~2020-05-20  8:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520082455.GA5192@linux.fritz.box \
    --to=kwolf@redhat.com \
    --cc=msys.mizuma@gmail.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.