qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Pavel Hrdina <phrdina@redhat.com>
Cc: kwolf@redhat.com, Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] block: move the bdrv_dev_change_media_cb()
Date: Mon, 17 Jun 2013 09:46:10 -0400	[thread overview]
Message-ID: <20130617094610.7b8a5b27@redhat.com> (raw)
In-Reply-To: <51BF114F.3000507@redhat.com>

On Mon, 17 Jun 2013 15:38:23 +0200
Pavel Hrdina <phrdina@redhat.com> wrote:

> On 17.6.2013 15:32, Luiz Capitulino wrote:
> > On Mon, 17 Jun 2013 15:25:24 +0200
> > Pavel Hrdina <phrdina@redhat.com> wrote:
> >
> >> On 17.6.2013 15:22, Luiz Capitulino wrote:
> >>> On Mon, 17 Jun 2013 14:33:10 +0200
> >>> Stefan Hajnoczi <stefanha@gmail.com> wrote:
> >>>
> >>>> On Mon, Jun 17, 2013 at 11:46:19AM +0200, Pavel Hrdina wrote:
> >>>>> On 5.6.2013 15:23, Stefan Hajnoczi wrote:
> >>>>>> On Wed, May 29, 2013 at 06:18:19PM +0200, Pavel Hrdina wrote:
> >>>>>>> @@ -1071,14 +1072,18 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename,
> >>>>>>>            if (password) {
> >>>>>>>                if (bdrv_set_key(bs, password) < 0) {
> >>>>>>>                    error_set(errp, QERR_INVALID_PASSWORD);
> >>>>>>> +                return;
> >>>>>>>                }
> >>>>>>>            } else {
> >>>>>>>                error_set(errp, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs),
> >>>>>>>                          bdrv_get_encrypted_filename(bs));
> >>>>>>> +            return;
> >>>>>>>            }
> >>>>>>>        } else if (password) {
> >>>>>>>            error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, bdrv_get_device_name(bs));
> >>>>>>>        }
> >>>>>>> +
> >>>>>>> +    bdrv_dev_change_media_cb(bs, true);
> >>>>>>>    }
> >>>>>>
> >>>>>> Calling bdrv_dev_change_media_cb() after raising
> >>>>>> QERR_DEVICE_NOT_ENCRYPTED is intentional?  It might warrant a comment.
> >>>>>>
> >>>>>
> >>>>> Sorry for my late answer.
> >>>>>
> >>>>> It's just a warning, that you used a password for a block device that
> >>>>> doesn't require it. The device is opened successfully and should be
> >>>>> handled correctly (call the bdrv_dev_change_media_cb() ).
> >>>>
> >>>> Yep, IMO it's worth a comment that this isn't an "error" just a
> >>>> "warning".
> >>>
> >>> Actually, you can't have such a warning in QMP. You either fail or you
> >>> succeed. We should just do what the current code does.
> >>>
> >>
> >> This is the same logic as the old one. The device is loaded but the
> >> error is emitted.
> >
> > That's a bug if the operation succeeded.
> >
> 
> In that case, how do you think, that we should handle the situation
> that user is trying to open device that isn't require the password, but
> user will provide the password?
> 
> I don't think that we should fail and abort that operation.

I agree, failing for real is probably incompatible by now.

I'm tempted to just drop the error then. But it's a very good idea to
isolate this change on its own commit with a clear changelog, so that
it's easy to identify it and revert case it also generates
compatibility problems in the future.

  reply	other threads:[~2013-06-17 13:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 16:18 [Qemu-devel] [PATCH v2 0/2] block: fix spurious DEVICE_TRAY_MOVED events on shutdown Pavel Hrdina
2013-05-29 16:18 ` [Qemu-devel] [PATCH v2 1/2] block: make bdrv_dev_change_media_cb() public Pavel Hrdina
2013-05-29 16:18 ` [Qemu-devel] [PATCH v2 2/2] block: move the bdrv_dev_change_media_cb() Pavel Hrdina
2013-06-05 13:23   ` Stefan Hajnoczi
2013-06-17  9:46     ` Pavel Hrdina
2013-06-17 12:33       ` Stefan Hajnoczi
2013-06-17 13:22         ` Luiz Capitulino
2013-06-17 13:25           ` Pavel Hrdina
2013-06-17 13:32             ` Luiz Capitulino
2013-06-17 13:38               ` Pavel Hrdina
2013-06-17 13:46                 ` Luiz Capitulino [this message]
2013-06-17 13:46                 ` Kevin Wolf
2013-06-17 13:51                   ` Luiz Capitulino
2013-06-17 14:49                     ` Kevin Wolf
2013-06-17 14:59                       ` Luiz Capitulino
2013-06-17 15:16                         ` Kevin Wolf
2013-06-18  6:26                           ` Pavel Hrdina
2013-05-30 15:51 ` [Qemu-devel] [PATCH v2 0/2] block: fix spurious DEVICE_TRAY_MOVED events on shutdown Luiz Capitulino

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=20130617094610.7b8a5b27@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=phrdina@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.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).