Received: from eggs.gnu.org ([2001:4830:134:3::10]:59222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xe7do-0005WQ-Md for qemu-devel@nongnu.org; Tue, 14 Oct 2014 15:20:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xe7dk-0004fW-8y for qemu-devel@nongnu.org; Tue, 14 Oct 2014 15:20:16 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:55312 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xe7dj-0004f7-Ts for qemu-devel@nongnu.org; Tue, 14 Oct 2014 15:20:12 -0400 Date: Tue, 14 Oct 2014 21:20:09 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20141014192008.GB11046@irqsave.net> References: <20141013210818.GA12920@sandia.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20141013210818.GA12920@sandia.gov> 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: Ken Chiang Cc: qemu-devel@nongnu.org The Monday 13 Oct 2014 =E0 14:08:18 (-0700), Ken Chiang wrote : > I also tried to add a virt io device to the frontend but still no disc in= the VM. Am I missing anything else? >=20 >=20 > {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2}, "packa= ge": " (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" } } } } >=20 > {"return": {}} > { "execute": "device_add", "arguments": { > "driver": "virtio-blk-pci", "id": "vda", "drive": "tc1" } } > {"return": {}} >=20 > Thanks! Maybe try for m in acpiphp pci_hotplug; do sudo modprobe ${m}; done in the guest before adding the pci device. Best regards Beno=EEt >=20 > Ken >=20 >=20 >=20 > 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> > In-Reply-To: <87k347f0do.fsf@blackfin.pond.sub.org> > User-Agent: Mutt/1.5.18 (2008-05-17) >=20 > Markus, >=20 > Nevermind my previous question, I see now that you add a scsi bus prior t= o adding the scsi disk. =20 >=20 > However, I did this and qmp returned {[]} in both cases and I am still no= t seeing the disk in the vm. >=20 >=20 > here's the qmp session: >=20 > {"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, "r= emovable": false, "inserted": {"iops_rd": 0, "image": {"virtual-size": 5999= 951872, "filename": "kvmimages/vts-6g-u12-inetsim.image", "format": "raw", = "actual-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": fa= lse, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable"= : true, "tray_open": false, "type": "unknown"}, {"device": "sd0", "locked":= false, "removable": true, "tray_open": false, "type": "unknown"}, {"io-sta= tus": "ok", "device": "tc1", "locked": false, "removable": false, "inserted= ": {"iops_rd": 0, "image": {"virtual-size": 5368709120, "filename": "/home/= kchiang/kvmimages/xpsp2_b-02222012.qc2", "cluster-size": 65536, "format": "= qcow2", "actual-size": 1550454784, "format-specific": {"type": "qcow2", "da= ta": {"compat": "0.10"}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, = "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted= ": false, "bps": 0, "bps_rd": 0, "file": "/home/kchiang/kvmimages/xpsp2_b-0= 2222012.qc2", "encryption_key_missing": false}, "type": "unknown"}]} >=20 > am I missing anything else? >=20 > I've also tried rebooting the VM and running rescan-scsi-bus to no avail. >=20 > Ken >=20 > 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}, "p= ackage": " (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 > > > =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 > --=20 > Ken Chiang > Information Assurance > Sandia National Labs - CA > 925-294-2018