qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] blockdev: loosen restrictions on drive-backup source node
Date: Tue, 21 May 2019 16:57:51 -0400	[thread overview]
Message-ID: <678c6156-16b7-93ff-4bf2-94befacec817@redhat.com> (raw)
In-Reply-To: <e6dae5b3-8ad4-df6b-e280-08202c61e61d@virtuozzo.com>



On 5/21/19 5:54 AM, Vladimir Sementsov-Ogievskiy wrote:
> 21.05.2019 1:38, John Snow wrote:
>>
>>
>> On 5/10/19 5:11 PM, John Snow wrote:
>>> We mandate that the source node must be a root node; but there's no reason
>>> I am aware of that it needs to be restricted to such. In some cases, we need
>>> to make sure that there's a medium present, but in the general case we can
>>> allow the backup job itself to do the graph checking.
>>>
>>> This patch helps improve the error message when you try to backup from
>>> the same node more than once, which is reflected in the change to test
>>> 056.
>>>
>>> For backups with bitmaps, it will also show a better error message that
>>> the bitmap is in use instead of giving you something cryptic like "need
>>> a root node."
>>>
>>> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1707303
>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>> ---
>>>   blockdev.c             | 6 +++++-
>>>   tests/qemu-iotests/056 | 2 +-
>>>   2 files changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/blockdev.c b/blockdev.c
>>> index 79fbac8450..27cb72f7aa 100644
>>> --- a/blockdev.c
>>> +++ b/blockdev.c
>>> @@ -3450,7 +3450,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
>>>           backup->compress = false;
>>>       }
>>>   
>>> -    bs = qmp_get_root_bs(backup->device, errp);
>>> +    bs = bdrv_lookup_bs(backup->device, backup->device, errp);
>>>       if (!bs) {
>>>           return NULL;
>>>       }
>>> @@ -3459,6 +3459,10 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn,
>>>       aio_context_acquire(aio_context);
>>>   
>>>       if (!backup->has_format) {
>>> +        if (!bs->drv) {
>>> +            error_setg(errp, "Device has no medium");
>>> +            return NULL;
>>> +        }
>>
>> Pinging my own patch with a review comment. It is weird that I shuffled
>> the error checking down below a conditional, but it's the only case
>> where we directly need do access bs->drv now.
> 
> not the only: it's accessed in following
>      if (backup->mode != NEW_IMAGE_MODE_EXISTING) {
>          assert(backup->format);
>          if (source) {
> as well.
> 

Ah, of course. Thanks.


      reply	other threads:[~2019-05-21 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 21:11 [Qemu-devel] [PATCH] blockdev: loosen restrictions on drive-backup source node John Snow
2019-05-20 22:38 ` John Snow
2019-05-21  9:54   ` Vladimir Sementsov-Ogievskiy
2019-05-21 20:57     ` John Snow [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=678c6156-16b7-93ff-4bf2-94befacec817@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /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).