qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] how to dynamically add a block device using qmp?


From: Markus Armbruster
Subject: Re: [Qemu-devel] how to dynamically add a block device using qmp?
Date: Sat, 11 Oct 2014 10:58:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Ken Chiang <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]