All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] how to dynamically add a block device using qmp?
       [not found] <mailman.0.1412981747.30924.qemu-devel@nongnu.org>
@ 2014-10-10 23:52 ` Ken Chiang
  2014-10-11  6:11   ` Fam Zheng
  2014-10-11  8:58   ` Markus Armbruster
  0 siblings, 2 replies; 3+ messages in thread
From: Ken Chiang @ 2014-10-10 23:52 UTC (permalink / raw)
  To: qemu-devel

Hello,

I am trying to add a block device dynamically using qmp and are having some issues.

After successfully adding the block device using "blockdev-add" and verifying that it has been added using "query-block", I am unable to see the block device in the VM under /dev/sdXX

I am using ubuntu14.04LTS: qmp version: 
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "package": " (Debian 2.0.0+dfsg-2ubuntu1.2)"}, "capabilities": []}}

Here's what I am doing:
1.  /usr/bin/kvm-spice -hda kvmimages/ubuntu.image -m 768 -usbdevice tablet -vnc :5 -qmp tcp:localhost:4444,server,nowait

2.  telnet localhost 4444

3.  In the telnet session run:
{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "blockdev-add",
   "arguments": { "options" : {
        "id": "disk1",
        "driver": "qcow2",
	"file": { "driver": "file",
            "filename": "testvm.qc2" } } } }
{"return": {}}

{ "execute": "query-block" }

4. query-block returns the device "disk1", but when I check the vm:
   # vncviewer :5
   
there are no new devices.

I thought that maybe it is a hotplug SATA bug detailed here: 
http://ubuntuforums.org/showthread.php?t=1998055

but running:
#rescan-scsi-bus resulted in no new block devices.

Thanks for any help!

Ken

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

* Re: [Qemu-devel] how to dynamically add a block device using qmp?
  2014-10-10 23:52 ` [Qemu-devel] how to dynamically add a block device using qmp? Ken Chiang
@ 2014-10-11  6:11   ` Fam Zheng
  2014-10-11  8:58   ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2014-10-11  6:11 UTC (permalink / raw)
  To: Ken Chiang; +Cc: qemu-devel

On Fri, 10/10 16:52, Ken Chiang wrote:
> Hello,
> 
> I am trying to add a block device dynamically using qmp and are having some issues.
> 
> After successfully adding the block device using "blockdev-add" and verifying that it has been added using "query-block", I am unable to see the block device in the VM under /dev/sdXX
> 
> I am using ubuntu14.04LTS: qmp version: 
> {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "package": " (Debian 2.0.0+dfsg-2ubuntu1.2)"}, "capabilities": []}}
> 
> Here's what I am doing:
> 1.  /usr/bin/kvm-spice -hda kvmimages/ubuntu.image -m 768 -usbdevice tablet -vnc :5 -qmp tcp:localhost:4444,server,nowait
> 
> 2.  telnet localhost 4444
> 
> 3.  In the telnet session run:
> {"execute":"qmp_capabilities"}
> {"return": {}}
> { "execute": "blockdev-add",
>    "arguments": { "options" : {
>         "id": "disk1",
>         "driver": "qcow2",
> 	"file": { "driver": "file",
>             "filename": "testvm.qc2" } } } }
> {"return": {}}
> 
> { "execute": "query-block" }

This is only the backend part.  You need "device-add" command to add a guest
visible frontend device, and specify the type (ide, scsi, etc..).

Thansk,
Fam

> 
> 4. query-block returns the device "disk1", but when I check the vm:
>    # vncviewer :5
>    
> there are no new devices.
> 
> I thought that maybe it is a hotplug SATA bug detailed here: 
> http://ubuntuforums.org/showthread.php?t=1998055
> 
> but running:
> #rescan-scsi-bus resulted in no new block devices.
> 
> Thanks for any help!
> 
> Ken
> 

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

* Re: [Qemu-devel] how to dynamically add a block device using qmp?
  2014-10-10 23:52 ` [Qemu-devel] how to dynamically add a block device using qmp? Ken Chiang
  2014-10-11  6:11   ` Fam Zheng
@ 2014-10-11  8:58   ` Markus Armbruster
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2014-10-11  8:58 UTC (permalink / raw)
  To: Ken Chiang; +Cc: qemu-devel

Ken Chiang <kchiang@sandia.gov> writes:

> Hello,
>
> I am trying to add a block device dynamically using qmp and are having
> some issues.
>
> After successfully adding the block device using "blockdev-add" and
> verifying that it has been added using "query-block", I am unable to
> see the block device in the VM under /dev/sdXX

Block devices consist of a frontend (a.k.a. device model) and a backend.
You added only a backend.  To add the frontend, use device_add.

> I am using ubuntu14.04LTS: qmp version: 
> {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "package": " (Debian 2.0.0+dfsg-2ubuntu1.2)"}, "capabilities": []}}
>
> Here's what I am doing:
> 1.  /usr/bin/kvm-spice -hda kvmimages/ubuntu.image -m 768 -usbdevice tablet -vnc :5 -qmp tcp:localhost:4444,server,nowait
>
> 2.  telnet localhost 4444
>
> 3.  In the telnet session run:
> {"execute":"qmp_capabilities"}
> {"return": {}}
> { "execute": "blockdev-add",
>    "arguments": { "options" : {
>         "id": "disk1",
>         "driver": "qcow2",
> 	"file": { "driver": "file",
>             "filename": "testvm.qc2" } } } }
> {"return": {}}
>
> { "execute": "query-block" }
>
> 4. query-block returns the device "disk1", but when I check the vm:
>    # vncviewer :5
>    
> there are no new devices.

For a virtio-blk disk, try:

    { "execute": "device_add", "arguments": {
        "driver": "virtio-blk-pci", "id": "vda", "drive": "disk1"  } }

For a SCSI disk, try:

    { "execute": "device_add", "arguments": {
        "driver": "virtio-scsi-pci", "id": "vs-hba" } }
    { "execute": "device_add", "arguments": {
        "driver": "scsi-disk", "id": "sda", "drive": "disk1",
        "bus": "vs-hba.0"  } }

[...]

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

end of thread, other threads:[~2014-10-11  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.0.1412981747.30924.qemu-devel@nongnu.org>
2014-10-10 23:52 ` [Qemu-devel] how to dynamically add a block device using qmp? Ken Chiang
2014-10-11  6:11   ` Fam Zheng
2014-10-11  8:58   ` Markus Armbruster

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.