qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: blockdev driver=file,filename=/dev/block forbidden?
Date: Wed, 29 Sep 2021 13:06:15 +0100	[thread overview]
Message-ID: <YVRWt/riIaMO4F8Y@redhat.com> (raw)
In-Reply-To: <1232448f-c7e4-9d97-c667-4400bf279109@msgid.tls.msk.ru>

On Wed, Sep 29, 2021 at 02:46:56PM +0300, Michael Tokarev wrote:
> 29.09.2021 14:35, Daniel P. Berrangé wrote:
> > On Wed, Sep 29, 2021 at 02:21:58PM +0300, Michael Tokarev wrote:
> > > Commit 8d17adf34f501ded65a106572740760f0a75577c
> > > "block: remove support for using "file" driver with block/char devices"
> > > explicitly forbids usage of file driver for block devices.
> > > 
> > > But _why_?
> > > 
> > > Hasn't we always used file for everything on *nix? And what's the _actual_
> > > difference between file and host_device?
> > 
> > There are various things QEMU does differently for plain files vs
> > block devices. The check for read-only volume, determining data
> > transfer size, media geometry, supporting discard. This is seen
> > in the BlockDriver structs that have different callbacks for each.
> 
> Well, I took a look at file-posix.c meanwhile.
> And I see no actual reason to require the user to change driver.
> It definitely is not user-friendly :)
> 
> It can open the file (with 'file' driver) and check if it is a
> regular file or a block (or char) device, and use corresponding
> callbacks in each case. Or just remember the "blockiness" of the
> underlying file and do a simple if() around it.
> 
> Having the user to *require* to change driver like this is.. strange.
> 
> I often use symlinks in our VM scripts which points to file or a block
> device - eg, a vm with a name grabs all /guest/name-foo.img - be these
> regular files or symlinks to /dev/mapper/foo..  And while it is
> not that big issue to change a script to add detection of blkdev/file,
> it is definitely not as easy for a user. And the thing is again - why
> qemu can't do that automatically, this is exactly the place where computers
> are good for..
> 
> Yes, some "sub-parameters" are different.  There, we can either error-out
> for a given parameter when it can't be used for a given file "type", or
> can have some relaxed warning instead.  But when there's no such specific
> parameters are given, I for one see no reason to require the user to
> change configuration when qemu itself can trivially figure it out..
> 
> I can (try to) produce a patch of this theme.
> 
> > > Please note this change has been added to qemu long before libvirt has
> > > been adapted (I guess there's no released libvirt can be used with
> > > qemu 6.0+).
> > 
> > Can you show your libvirt guest XML config that is causing trouble, as
> > it has done the right thing here for  a long while AFAIK, so I suspect
> > a mis-configuration.
> 
> This started as https://bugs.debian.org/993688 which leads to
> https://gitlab.com/libvirt/libvirt/-/issues/212 which created only
> 3 weeks ago. While the commit in question has been committed
> in February.

The libvirt gitlab issue there is closed as not-a-bug, as the
user had told libvirt <disk type="file" > instead of
<disk type="block">.

The same mistake is present in the XML shown in the debian bug.

Even before the QEMU change, this mistake would cause trouble with
certain areas of libvirt functionality too, especially around
migration and snapshotting.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



      reply	other threads:[~2021-09-29 12:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 11:21 blockdev driver=file,filename=/dev/block forbidden? Michael Tokarev
2021-09-29 11:35 ` Daniel P. Berrangé
2021-09-29 11:46   ` Michael Tokarev
2021-09-29 12:06     ` Daniel P. Berrangé [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=YVRWt/riIaMO4F8Y@redhat.com \
    --to=berrange@redhat.com \
    --cc=mjt@tls.msk.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).