All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
@ 2017-02-23 14:40 Kashyap Chamarthy
  2017-02-23 15:11 ` Markus Armbruster
  0 siblings, 1 reply; 6+ messages in thread
From: Kashyap Chamarthy @ 2017-02-23 14:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru

TL;DR: Using `blockdev-add` to create an overlay file succeeds with QEMU
       2.7.0, however the *same* test fails with QEMU from Git (plus a
       couple of patch series from mailing list).  Details below.

QEMU invocation:

  $ qemu-system-x86_64 -display none \
     -nodefconfig -nodefaults -m 512 -device virtio-scsi-pci,id=scsi \
     -device virtio-serial-pci \
     -drive file=./base.qcow2,format=qcow2,if=virtio \
     -monitor stdio -qmp unix:./qmp-sock,server,nowait

With QEMU 2.7.0
---------------

$ qemu-system-x86_64 --version
QEMU emulator version 2.7.0(qemu-2.7.0-8.fc24) [...]

Create the overlay file: 

    $ qemu-img create -f qcow2 /export/target.qcow2 1G

$ ./qmp-shell -v -p /export/qmp-sock

(QEMU) blockdev-add options={"id":"virtio1","driver":"qcow2","file":{"driver":"file","filename":"/export/target.qcow2"},"backing":"virtio0"}
{
    "execute": "blockdev-add", 
    "arguments": {
        "options": {
            "backing": "virtio0", 
            "driver": "qcow2", 
            "id": "virtio1", 
            "file": {
                "driver": "file", 
                "filename": "/export/target.qcow2"
            }
        }
    }
}
{
    "return": {}
}
(QEMU) 

* * *

With Git Master (v2.8.0-1462-g612bb5d-dirty)
--------------------------------------------

Note: I applied these three patch series:

  - [PATCH v2 00/24] QemuOpts util/cutils: Fix and clean up number
    conversions"
  - [PATCH 00/14] qobject: Cleanups, mostly in tests
  - [PATCH 0/2] qapi: Improve qobject input visitor error reporting

So, I'm here:

  $ git describe
	pull-block-2017-02-21-81-g612bb5d

The same test as above (but with the QEMU from Git + above patch
series):

- Stop system QEMU
- Start QEMU built from Git (with the above patches)
- Try to add 'target.qcow2' block device via `blockdev-add`, it now
  fails as below:

  [...]
  (QEMU)
  {
      "execute": "blockdev-add", 
      "arguments": {
          "options": {
              "backing": "virtio0", 
              "driver": "qcow2", 
              "id": "virtio1", 
              "file": {
                  "driver": "file", 
                  "filename": "/export/target.qcow2"
              }
          }
      }
  }
  {
      "error": {
          "class": "GenericError", 
          "desc": "Parameter 'driver' is missing"
      }
  }
  (QEMU) 

* * *

Is this a regression or am I missing something?

-- 
/kashyap

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
  2017-02-23 14:40 [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing" Kashyap Chamarthy
@ 2017-02-23 15:11 ` Markus Armbruster
  2017-02-23 16:33   ` Kashyap Chamarthy
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Armbruster @ 2017-02-23 15:11 UTC (permalink / raw)
  To: Kashyap Chamarthy; +Cc: qemu-devel

Kashyap Chamarthy <kchamart@redhat.com> writes:

> TL;DR: Using `blockdev-add` to create an overlay file succeeds with QEMU
>        2.7.0, however the *same* test fails with QEMU from Git (plus a
>        couple of patch series from mailing list).  Details below.

commit 0153d2f50bc2ad3f41810d838fcf66acbf10f07a
Author: Kevin Wolf <kwolf@redhat.com>
Date:   Fri Oct 7 17:05:04 2016 +0200

    block: Remove "options" indirection from blockdev-add
    
    Now that QAPI supports boxed types, we can have unions at the top level
    of a command, so let's put our real options directly there for
    blockdev-add instead of having a single "options" dict that contains the
    real arguments.
    
    blockdev-add is still experimental and we already made substantial
    changes to the API recently, so we're free to make changes like this
    one, too.
    
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Sorry for the confusion!  Early adopters always have the most fun ;)

[...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
  2017-02-23 15:11 ` Markus Armbruster
@ 2017-02-23 16:33   ` Kashyap Chamarthy
  2017-02-23 16:51     ` Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Kashyap Chamarthy @ 2017-02-23 16:33 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Thu, Feb 23, 2017 at 04:11:21PM +0100, Markus Armbruster wrote:
> Kashyap Chamarthy <kchamart@redhat.com> writes:
> 
> > TL;DR: Using `blockdev-add` to create an overlay file succeeds with QEMU
> >        2.7.0, however the *same* test fails with QEMU from Git (plus a
> >        couple of patch series from mailing list).  Details below.
> 
> commit 0153d2f50bc2ad3f41810d838fcf66acbf10f07a
> Author: Kevin Wolf <kwolf@redhat.com>
> Date:   Fri Oct 7 17:05:04 2016 +0200
> 
>     block: Remove "options" indirection from blockdev-add

[...]

> Sorry for the confusion!  Early adopters always have the most fun ;)

Ah, I see, thanks for the pointer.

I tried to come up with the below JSON, after looking at the QAPI schema
documentation (from qemu/qapi/block-core.json), still I seem to be
tripping up somewhere.  Now it doesn't recognize the 'backing' option:

$ socat UNIX:./qmp-sock READLINE,history=$HOME/.qmp_history,prompt='QMP> '
[...]
QMP> {
QMP>   "execute":"blockdev-add",
QMP>   "arguments":{
QMP>     "driver":"qcow2",
QMP>     "node-name":"node1"
QMP>   },
QMP>   "file":{
QMP>     "driver":"file",
QMP>     "filename":"/export/target.qcow2"
QMP>   },
QMP>   "backing":{
QMP>     "driver":"qcow2",
QMP>     "file":{
QMP>       "driver":"file",
QMP>       "filename":"/export/base.qcow2"
QMP>     }
QMP>   }
QMP> }
{"error": {"class": "GenericError", "desc": "QMP input object member 'backing' is unexpected"}}
QMP> 

-- 
/kashyap

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
  2017-02-23 16:33   ` Kashyap Chamarthy
@ 2017-02-23 16:51     ` Eric Blake
  2017-02-24 10:53       ` Kashyap Chamarthy
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2017-02-23 16:51 UTC (permalink / raw)
  To: Kashyap Chamarthy, Markus Armbruster; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2684 bytes --]

On 02/23/2017 10:33 AM, Kashyap Chamarthy wrote:
> On Thu, Feb 23, 2017 at 04:11:21PM +0100, Markus Armbruster wrote:
>> Kashyap Chamarthy <kchamart@redhat.com> writes:
>>
>>> TL;DR: Using `blockdev-add` to create an overlay file succeeds with QEMU
>>>        2.7.0, however the *same* test fails with QEMU from Git (plus a
>>>        couple of patch series from mailing list).  Details below.
>>
>> commit 0153d2f50bc2ad3f41810d838fcf66acbf10f07a
>> Author: Kevin Wolf <kwolf@redhat.com>
>> Date:   Fri Oct 7 17:05:04 2016 +0200
>>
>>     block: Remove "options" indirection from blockdev-add
> 
> [...]
> 
>> Sorry for the confusion!  Early adopters always have the most fun ;)
> 
> Ah, I see, thanks for the pointer.
> 
> I tried to come up with the below JSON, after looking at the QAPI schema
> documentation (from qemu/qapi/block-core.json), still I seem to be
> tripping up somewhere.  Now it doesn't recognize the 'backing' option:
> 
> $ socat UNIX:./qmp-sock READLINE,history=$HOME/.qmp_history,prompt='QMP> '
> [...]
> QMP> {
> QMP>   "execute":"blockdev-add",
> QMP>   "arguments":{
> QMP>     "driver":"qcow2",
> QMP>     "node-name":"node1"
> QMP>   },

Oops, you ended your arguments too soon.

> QMP>   "file":{
> QMP>     "driver":"file",
> QMP>     "filename":"/export/target.qcow2"
> QMP>   },
> QMP>   "backing":{

Here, you passed "file" and "backing" as siblings of "execute", but they
should be children of "arguments".

> QMP>     "driver":"qcow2",
> QMP>     "file":{
> QMP>       "driver":"file",
> QMP>       "filename":"/export/base.qcow2"
> QMP>     }
> QMP>   }
> QMP> }
> {"error": {"class": "GenericError", "desc": "QMP input object member 'backing' is unexpected"}}
> QMP> 

Try (untested on my end) this rewrite of your original post (just
removing the '"options":{' and corresponding '}' from that listing):

{
    "execute": "blockdev-add",
    "arguments": {
            "backing": "virtio0",
            "driver": "qcow2",
            "id": "virtio1",
            "file": {
                "driver": "file",
                "filename": "/export/target.qcow2"
            }
    }
}

or this attempt at your current post:

{   "execute":"blockdev-add",
    "arguments":{
     "driver":"qcow2",
     "node-name":"node1"
     "file":{
      "driver":"file",
      "filename":"/export/target.qcow2"
     },
     "backing":{
      "driver":"qcow2",
      "file":{
        "driver":"file",
        "filename":"/export/base.qcow2"
      }
     }
    }
}

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
  2017-02-23 16:51     ` Eric Blake
@ 2017-02-24 10:53       ` Kashyap Chamarthy
  2017-02-24 11:43         ` Kashyap Chamarthy
  0 siblings, 1 reply; 6+ messages in thread
From: Kashyap Chamarthy @ 2017-02-24 10:53 UTC (permalink / raw)
  To: Eric Blake; +Cc: Markus Armbruster, qemu-devel

On Thu, Feb 23, 2017 at 10:51:38AM -0600, Eric Blake wrote:
> On 02/23/2017 10:33 AM, Kashyap Chamarthy wrote:

[...]

> > I tried to come up with the below JSON, after looking at the QAPI schema
> > documentation (from qemu/qapi/block-core.json), still I seem to be
> > tripping up somewhere.  Now it doesn't recognize the 'backing' option:
> > 
> > $ socat UNIX:./qmp-sock READLINE,history=$HOME/.qmp_history,prompt='QMP> '
> > [...]
> > QMP> {
> > QMP>   "execute":"blockdev-add",
> > QMP>   "arguments":{
> > QMP>     "driver":"qcow2",
> > QMP>     "node-name":"node1"
> > QMP>   },
> 
> Oops, you ended your arguments too soon.

Sigh, that was a stray closing bracket that I didn't clean up (it was
part of the "cache" section that I borrowed from the schema docs).

> > QMP>   "file":{
> > QMP>     "driver":"file",
> > QMP>     "filename":"/export/target.qcow2"
> > QMP>   },
> > QMP>   "backing":{
> 
> Here, you passed "file" and "backing" as siblings of "execute", but they
> should be children of "arguments".

Oops, you're right.

[...]

> Try (untested on my end) this rewrite of your original post (just
> removing the '"options":{' and corresponding '}' from that listing):
> 
> {
>     "execute": "blockdev-add",
>     "arguments": {
>             "backing": "virtio0",
>             "driver": "qcow2",
>             "id": "virtio1",
>             "file": {
>                 "driver": "file",
>                 "filename": "/export/target.qcow2"
>             }
>     }
> }

This does not work (tested), because my current QEMU build from Git,
will reject the "id" key (Kevin mentioned so on IRC, but I couldn't
find the relevant Git commit from my `grep`ing in the Git history):

{"error": {"class": "GenericError", "desc": "QMP input object member 'id' is unexpected"}}
 
> or this attempt at your current post:
> 
> {   "execute":"blockdev-add",
>     "arguments":{
>      "driver":"qcow2",
>      "node-name":"node1"

A comma missing here :-)  With that fixed, it returns success.  

However, bizzarely enough, when I ran `query-block` after `blockdev-add`
succeeded (well, at least after it returned success), I don't see the
new node ('target.qcow2') reflected in the return output.  Me
investigates.

https://kashyapc.fedorapeople.org/virt/temp/blockdev-add-followed-by-buggy-query-block.txt

>      "file":{
>       "driver":"file",
>       "filename":"/export/target.qcow2"
>      },
>      "backing":{
>       "driver":"qcow2",
>       "file":{
>         "driver":"file",
>         "filename":"/export/base.qcow2"
>       }
>      }
>     }
> }

Just for completeness, the new working incantation (that removes the
need for "options" indirection, and the "id" key) that takes
'node-name':

--------------------------------------------
{
  "execute":"blockdev-add",
  "arguments":{
    "driver":"qcow2",
    "node-name":"node1",
    "file":{
      "driver":"file",
      "filename":"/export/target.qcow2"
    },
    "backing":{
      "driver":"qcow2",
      "file":{
        "driver":"file",
        "filename":"/export/base.qcow2"
      }
    }
  }
}
--------------------------------------------

-- 
/kashyap

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing"
  2017-02-24 10:53       ` Kashyap Chamarthy
@ 2017-02-24 11:43         ` Kashyap Chamarthy
  0 siblings, 0 replies; 6+ messages in thread
From: Kashyap Chamarthy @ 2017-02-24 11:43 UTC (permalink / raw)
  To: Eric Blake; +Cc: Markus Armbruster, qemu-devel

On Fri, Feb 24, 2017 at 11:53:12AM +0100, Kashyap Chamarthy wrote:

[...]

> However, bizzarely enough, when I ran `query-block` after `blockdev-add`
> succeeded (well, at least after it returned success), I don't see the
> new node ('target.qcow2') reflected in the return output.  Me
> investigates.

Okay, Kevin educated me IRC that I should rather use
`query-named-block-nodes`.  That gives the intended output.

[...]

-- 
/kashyap

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-24 11:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 14:40 [Qemu-devel] Adding an overlay with 'blockdev-add' fails with: "Parameter 'driver' is missing" Kashyap Chamarthy
2017-02-23 15:11 ` Markus Armbruster
2017-02-23 16:33   ` Kashyap Chamarthy
2017-02-23 16:51     ` Eric Blake
2017-02-24 10:53       ` Kashyap Chamarthy
2017-02-24 11:43         ` Kashyap Chamarthy

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.