Ken Chiang <kchi...@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"  } }

[...]

Reply via email to