Received: from eggs.gnu.org ([2001:4830:134:3::10]:42364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdmrI-0006Fz-Sy for qemu-devel@nongnu.org; Mon, 13 Oct 2014 17:08:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xdmr8-0006Us-Q1 for qemu-devel@nongnu.org; Mon, 13 Oct 2014 17:08:48 -0400 Received: from smtp02asnl.sandia.gov ([198.102.153.117]:22063) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xdmr8-0006UF-Fy for qemu-devel@nongnu.org; Mon, 13 Oct 2014 17:08:38 -0400 Received: from mailgate2.sandia.gov (mailgate2.sandia.gov [132.175.109.4]) by interceptor1.sandia.gov (RSA Interceptor) for ; Mon, 13 Oct 2014 15:08:20 -0600 Received: from mail.sandia.gov (es03amsnlnt.sandia.gov [134.253.103.163] (may be forged)) by mailgate2.sandia.gov (8.14.4/8.14.4) with ESMTP id s9DL8KnA023377 for ; Mon, 13 Oct 2014 15:08:20 -0600 Date: Mon, 13 Oct 2014 14:08:18 -0700 From: Ken Chiang Message-ID: <20141013210818.GA12920@sandia.gov> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline Subject: Re: [Qemu-devel] [EXTERNAL] Re: how to dynamically add a block device using qmp? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline I also tried to add a virt io device to the frontend but still no disc in the VM. Am I missing anything else? {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "package": " (Debian 2.0.0+dfsg-2ubuntu1.2)"}, "capabilities": []}} {"execute":"qmp_capabilities"} {"return": {}} { "execute": "blockdev-add", "arguments": { "options" : { "id": "tc1", "driver": "qcow2", "file": { "driver": "file", "filename": "test.qc2" } } } } {"return": {}} { "execute": "device_add", "arguments": { "driver": "virtio-blk-pci", "id": "vda", "drive": "tc1" } } {"return": {}} Thanks! Ken --7AUc2qLy4jB3hD7Z Content-Type: message/rfc822 Content-Disposition: inline Date: Mon, 13 Oct 2014 12:28:51 -0700 From: Ken Chiang To: Markus Armbruster Subject: Re: [EXTERNAL] Re: [Qemu-devel] how to dynamically add a block device using qmp? Message-ID: <20141013192851.GA12699@sandia.gov> References: <20141010235227.GA28606@sandia.gov> <87k347f0do.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <87k347f0do.fsf@blackfin.pond.sub.org> User-Agent: Mutt/1.5.18 (2008-05-17) Markus, Nevermind my previous question, I see now that you add a scsi bus prior to = adding the scsi disk. =20 However, I did this and qmp returned {[]} in both cases and I am still not = seeing the disk in the vm. here's the qmp session: {"execute":"qmp_capabilities"} {"return": {}} { "execute": "blockdev-add", = =20 "arguments": { "options" : { = =20 "id": "tc1", = =20 "driver": "qcow2", = =20 "file": { "driver": "file", = =20 "filename": "/home/kchiang/kvmimages/xpsp2_b-02222012.qc2" } } = } }=20 {"return": {}} { "execute": "device_add", "arguments": { "driver": "virtio-scsi-pci", "id": "vs-hba" } } {"return": {}} { "execute": "device_add", "arguments": { "driver": "scsi-disk", "id": "sdb", "drive": "tc1", "bus": "vs-hba.0" } } {"return": {}} { "execute": "query-block" } {"return": [{"io-status": "ok", "device": "ide0-hd0", "locked": false, "rem= ovable": false, "inserted": {"iops_rd": 0, "image": {"virtual-size": 599995= 1872, "filename": "kvmimages/vts-6g-u12-inetsim.image", "format": "raw", "a= ctual-size": 5999955968, "dirty-flag": false}, "iops_wr": 0, "ro": false, "= backing_file_depth": 0, "drv": "raw", "iops": 0, "bps_wr": 0, "encrypted": = false, "bps": 0, "bps_rd": 0, "file": "kvmimages/vts-6g-u12-inetsim.image",= "encryption_key_missing": false}, "type": "unknown"}, {"io-status": "ok", = "device": "ide1-cd0", "locked": false, "removable": true, "tray_open": fals= e, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": = true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked": f= alse, "removable": true, "tray_open": false, "type": "unknown"}, {"io-statu= s": "ok", "device": "tc1", "locked": false, "removable": false, "inserted":= {"iops_rd": 0, "image": {"virtual-size": 5368709120, "filename": "/home/kc= hiang/kvmimages/xpsp2_b-02222012.qc2", "cluster-size": 65536, "format": "qc= ow2", "actual-size": 1550454784, "format-specific": {"type": "qcow2", "data= ": {"compat": "0.10"}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "b= acking_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted":= false, "bps": 0, "bps_rd": 0, "file": "/home/kchiang/kvmimages/xpsp2_b-022= 22012.qc2", "encryption_key_missing": false}, "type": "unknown"}]} am I missing anything else? I've also tried rebooting the VM and running rescan-scsi-bus to no avail. Ken On Sat, Oct 11, 2014 at 10:58:59AM +0200, Markus Armbruster wrote: > Ken Chiang writes: >=20 > > 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 >=20 > 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. >=20 > > I am using ubuntu14.04LTS: qmp version:=20 > > {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "pac= kage": " (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 ta= blet -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 > > =20 > > there are no new devices. >=20 > For a virtio-blk disk, try: >=20 > { "execute": "device_add", "arguments": { > "driver": "virtio-blk-pci", "id": "vda", "drive": "disk1" } } >=20 > For a SCSI disk, try: >=20 > { "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" } } >=20 > [...] --=20 Ken Chiang Information Assurance Sandia National Labs - CA 925-294-2018 --7AUc2qLy4jB3hD7Z--