qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, "open list:qcow2" <qemu-block@nongnu.org>
Subject: Re: [PATCH] qcow2: Allow resize of images with internal snapshots
Date: Thu, 23 Apr 2020 12:41:42 -0500	[thread overview]
Message-ID: <ade97dfc-a9c7-4f5d-7211-6a80f736e11d@redhat.com> (raw)
In-Reply-To: <0c3d69a7-9095-9f03-f83a-c527e0751880@redhat.com>

On 4/23/20 12:21 PM, Max Reitz wrote:

>>> The previous comment was incorrect as well, but actually
>>> qcow2_truncate_bitmaps_check() doesn’t return an error when there is any
>>> bitmap, but only if there are non-active bitmaps, or active bitmaps that
>>> cannot be modified.  So for non-disabled bitmaps, we generally do
>>> happily proceed.
>>
>> The comment change is collateral (only because I noticed it in the
>> diff); but I could indeed reword it slightly more accurately as:
>>
>> Check if bitmaps prevent a resize.  Although bitmaps can be resized,
>> there are situations where we don't know whether to set or clear new
>> bits, so for now it's easiest to just prevent resize in those cases.
> 
> But I don’t know whether that explanation is actually correct.  I mean,
> that would apply for enabled active bitmaps just as well.  But we do
> allow resizing an image with such bitmaps so it seems clear that we have
> some idea on what to do.  (Or at least we pretend we do, for better or
> worse).
> 
> (Which is that bdrv_dirty_bitmap_truncate() just calls
> hbitmap_truncate(), which fills the new space with zeroes.)
> 
> The real reason we can’t resize with certain kinds of bitmaps present
> seems more like:
> (1) There are some bitmaps that can’t be written to, but we’d have to if
> we wanted to resize the image and they’re persistent,
> (2) The second case are bitmaps that are persistent but present in
> memory; we just haven’t implemented that case, I presume.
> 
> So it seems less like a case of “We don’t know what to do”, but more a
> combination of “We can’t“ and “We haven‘t implemented this case, but
> it’s clear what to do if we did”.

Indeed. So definitely a reason to split this change to a separate patch 
(and/or fix the code to finally implement it)


>>> Speaking of the image size.  Is it intentional that the size is changed
>>> to 32 MB?  Should amend work more like a transaction, in that we should
>>> at least do a loose check on whether the options can be changed before
>>> we touch the image?
>>
>> Yes, the commit message tried to call it out.  It's a pre-existing
>> problem - during amend, we DO make changes to the disk in one step, with
>> no way to roll back those changes, even if a later step fails.
>>
>> Pre-patch, if you request an upgrade to v3 as well as a resize, but
>> resize fails, you still end up with the image being changed to v3.
>> That's no different from post-patch where if you request a resize and a
>> downgrade to v2, the resize happens but not the downgrade.  On the
>> bright side, our current failure scenarios at least leave the resulting
>> image viable, even if it is not the same as it was pre-attempt.
> 
> Yes.  OK.

Okay, v2 will have a better commit message.


> Yeah.  I don’t think anyone even would have realistic use for
> transactional amends.  I suppose all users can easily split their amend
> calls with multiple options into multiple amends in the order that would
> be most likely reversible, if something went wrong along the way.  (And
> that also works.  I.e., downgrading/upgrading is probably the most easy
> to revert, but maybe you can only downgrade if your image has the
> correct size, so you potentially need to truncate it first.  OTOH, I
> can’t imagine many people actually use qemu-img amend to downgrade qcow2
> images anyway...)

Indeed - any time that you worry that an interaction of multiple changes 
might fail half-way through, you can always serialize those changes 
yourself instead of hoping the tool sequences them correctly ;)


> I feel very much reminded of the LUKS keyslot discussion...
> 
> (That is to say, my thoughts on this have little to do with this
> specific patch at this point.)

Too true !

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



      reply	other threads:[~2020-04-23 17:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 20:53 [PATCH] qcow2: Allow resize of images with internal snapshots Eric Blake
2020-04-23 13:55 ` Max Reitz
2020-04-23 14:35   ` Eric Blake
2020-04-23 17:21     ` Max Reitz
2020-04-23 17:41       ` Eric Blake [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=ade97dfc-a9c7-4f5d-7211-6a80f736e11d@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.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 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).