block: -device drive=<node-name> fixes
cover block: -device drive=<node-name> fixes
Since 2.9 it is possible for a user to care only about nodes and qdev devices, but not about BlockBackends, by defining with -blockdev and using their node name in -device. Devices create an anonymous BlockBackend internally then.
One of the major problems in this setup is that such devices are not listed in query-block or HMP 'info block' because the BBs are not monitor-owned. A recent discussion concluded that we really want to replace query-block and friends with something that matches QEMU's internals better, but there's no way to do that in 2.10 (and I wouldn't bet on it to be completed for 2.11). So for now, just make the devices appear in query-block and add the qdev ID there in order to make the devices identifiable (they have 'device': '' because the BB is anonymous).
With the additional qdev field, it turned out that with empty drives, ide-cd and scsi-cd weren't even properly attached to the BlockBackend. If you do it right, this even results in crashes. (Floppy already gets it right, in case you wondered.)
After this series, -device drive=<node-name> should be reasonably usable without a major loss of functionality like before.
Kevin Wolf (9):
block: Make blk_get_attached_dev_id() public block/qapi: Add qdev device name to query-block
block: Make blk_all_next() public block/qapi: Use blk_all_next() for query-block
block: List anonymous device BBs in query-block
ide: bdrv_attach_dev() for empty CD-ROM
scsi-disk: bdrv_attach_dev() for empty CD-ROM
qemu-iotests: Test 'info block'
qemu-iotests: Test unplug of -device without drive
block/block-backend.c | 5 +- block/qapi.c | 20 +- hmp.c | 11 +- hw/ide/qdev.c | 3 + hw/scsi/scsi-disk.c | 5 + include/sysemu/block-backend.h | 2 + qapi/block-core.json | 5 +- tests/qemu-iotests/067 | 13 ++ tests/qemu-iotests/067.out | 40 ++++ tests/qemu-iotests/186 | 147 +++++++++++++ tests/qemu-iotests/186.out | 489 +++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 12 files changed, 731 insertions(+), 10 deletions(-) create mode 100755 tests/qemu-iotests/186 create mode 100644 tests/qemu-iotests/186.out
Signature · 1 line
1.8.3.1
PATCH 1/9 block: Make blk_get_attached_dev_id() public
--- block/block-backend.c | 3 +-- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
block/block-backend.c +1 -2
@@ -83,7 +83,6 @@ static const AIOCBInfo block_backend_aiocb_info = {static void drive_info_del (DriveInfo *dinfo);static BlockBackend *bdrv_first_blk (BlockDriverState *bs); -static char *blk_get_attached_dev_id (BlockBackend *blk);/* All BlockBackends */ static QTAILQ_HEAD(, BlockBackend) block_backends =
@@ -726,7 +725,7 @@ void *blk_get_attached_dev(BlockBackend *blk)/* Return the qdev ID, or if no ID is assigned the QOM path, of the block * device attached to the BlockBackend. */ -static char *blk_get_attached_dev_id (BlockBackend *blk) +char *blk_get_attached_dev_id (BlockBackend *blk) {DeviceState *dev;
include/sysemu/block-backend.h +1 -0
@@ -126,6 +126,7 @@ int blk_attach_dev(BlockBackend *blk, DeviceState *dev);void blk_attach_dev_legacy (BlockBackend *blk,void *dev);void blk_detach_dev (BlockBackend *blk,void *dev);void *blk_get_attached_dev (BlockBackend *blk); +char *blk_get_attached_dev_id (BlockBackend *blk);BlockBackend *blk_by_dev (void *dev);BlockBackend *blk_by_qdev_id (const char *id,Error **errp);void blk_set_dev_ops (BlockBackend *blk,const BlockDevOps *ops,void *opaque);
Signature · 1 line
1.8.3.1
PATCH 2/9 block/qapi: Add qdev device name to query-block
In reply to Kevin WolfWith -blockdev/-device, users can indirectly create anonymous BlockBackends, in the state of which they are still interested. As a preparation for making such BBs visible in query-block, make sure that they can be identified even without a name by adding the ID/QOM path of their qdev device to BlockInfo.
--- block/qapi.c | 10 ++++++++++ hmp.c | 3 +++ qapi/block-core.json | 5 ++++- tests/qemu-iotests/067.out | 1 + 4 files changed, 18 insertions(+), 1 deletion(-)
block/qapi.c +10 -0
@@ -322,11 +322,21 @@ static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, {BlockInfo *info =g_malloc0 (sizeof (*info));BlockDriverState *bs =blk_bs (blk); +char *qdev; + info->device =g_strdup (blk_name (blk)); info->type =g_strdup ("unknown" ); info->locked =blk_dev_is_medium_locked (blk); info->removable =blk_dev_has_removable_media (blk); + qdev =blk_get_attached_dev_id (blk); +if (qdev && *qdev) { + info->has_qdev = true; + info->qdev = qdev; + }else { +g_free (qdev); + } +if (blk_dev_has_tray (blk)) { info->has_tray_open = true; info->tray_open =blk_dev_is_tray_open (blk);
hmp.c +3 -0
@@ -425,6 +425,9 @@ static void print_block_info(Monitor *mon, BlockInfo *info, }if (info) { +if (info->has_qdev) { +monitor_printf (mon," Attached to: %s\n" , info->qdev); + }if (info->has_io_status && info->io_status !=BLOCK_DEVICE_IO_STATUS_OK ) {monitor_printf (mon," I/O status: %s\n" , BlockDeviceIoStatus_lookup[info->io_status]);
qapi/block-core.json +4 -1
@@ -433,6 +433,9 @@ # # @device: The device name associated with the virtual device. # +# @qdev: The qdev ID, or if no ID is assigned the QOM path, of the block +# device. +# # @type: This field is returned only for compatibility reasons, it should # not be used (always returns 'unknown') #
@@ -458,7 +461,7 @@ # Since: 0.14.0 ## { 'struct': 'BlockInfo', - 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', + 'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool', 'locked': 'bool', '*inserted': 'BlockDeviceInfo', '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
tests/qemu-iotests/067.out +1 -0
@@ -57,6 +57,7 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false }, + "qdev": "/machine/peripheral/virtio0/virtio-backend", "type": "unknown" } ]
Signature · 1 line
1.8.3.1
PATCH 3/9 block: Make blk_all_next() public
In reply to Kevin Wolf--- block/block-backend.c | 2 +- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
block/block-backend.c +1 -1
@@ -342,7 +342,7 @@ void blk_unref(BlockBackend *blk)* Behaves similarly to blk_next() but iterates over all BlockBackends, even the * ones which are hidden (i.e. are not referenced by the monitor). */ -static BlockBackend *blk_all_next (BlockBackend *blk) +BlockBackend *blk_all_next (BlockBackend *blk) {return blk ?QTAILQ_NEXT (blk, link) :QTAILQ_FIRST (&block_backends);
include/sysemu/block-backend.h +1 -0
@@ -100,6 +100,7 @@ void blk_remove_all_bs(void);const char *blk_name (const BlockBackend *blk);BlockBackend *blk_by_name (const char *name);BlockBackend *blk_next (BlockBackend *blk); +BlockBackend *blk_all_next (BlockBackend *blk);bool monitor_add_blk (BlockBackend *blk,const char *name,Error **errp);void monitor_remove_blk (BlockBackend *blk);
Signature · 1 line
1.8.3.1
PATCH 4/9 block/qapi: Use blk_all_next() for query-block
In reply to Kevin WolfThis patch replaces the blk_next() loop in query-block by a blk_all_next() one so that we also get access to BlockBackends that aren't owned by the monitor. For now, the next thing we do is check whether each BB has a name, so there is no semantical difference.
--- block/qapi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
block/qapi.c +8 -2
@@ -472,8 +472,14 @@ BlockInfoList *qmp_query_block(Error **errp)BlockBackend *blk;Error *local_err =NULL ; -for (blk =blk_next (NULL ); blk; blk =blk_next (blk)) { -BlockInfoList *info =g_malloc0 (sizeof (*info)); +for (blk =blk_all_next (NULL ); blk; blk =blk_all_next (blk)) { +BlockInfoList *info; + +if (!*blk_name (blk)) { +continue ; + } + + info =g_malloc0 (sizeof (*info));bdrv_query_info (blk, &info->value, &local_err);if (local_err) {error_propagate (errp, local_err);
Signature · 1 line
1.8.3.1
PATCH 5/9 block: List anonymous device BBs in query-block
In reply to Kevin WolfInstead of listing only monitor-owned BlockBackends in query-block, also add those anonymous BlockBackends that are owned by a qdev device and as such under the control of the user.
This allows to use query-block to inspect BlockBackends for the modern configuration syntax with -blockdev and -device.
--- block/qapi.c | 2 +- hmp.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
block/qapi.c +1 -1
@@ -475,7 +475,7 @@ BlockInfoList *qmp_query_block(Error **errp)for (blk =blk_all_next (NULL ); blk; blk =blk_all_next (blk)) {BlockInfoList *info; -if (!*blk_name (blk)) { +if (!*blk_name (blk) && !blk_get_attached_dev (blk)) {continue ; }
hmp.c +4 -4
@@ -401,16 +401,16 @@ static void print_block_info(Monitor *mon, BlockInfo *info,assert (!info || !info->has_inserted || info->inserted == inserted); -if (info) { +if (info && *info->device) {monitor_printf (mon,"%s" , info->device);if (inserted && inserted->has_node_name) {monitor_printf (mon," (%s)" , inserted->node_name); } }else { -assert (inserted); +assert (info || inserted);monitor_printf (mon,"%s" , - inserted->has_node_name - ? inserted->node_name + inserted && inserted->has_node_name ? inserted->node_name + : info && info->has_qdev ? info->qdev :"<anonymous>" ); }
Signature · 1 line
1.8.3.1
PATCH 6/9 ide: bdrv_attach_dev() for empty CD-ROM
In reply to Kevin WolfIf no drive=... option is passed (for an empty drive), we don't only lack the BlockBackend normally created by parse_drive(), but we also need to manually call blk_attach_dev().
IDE does not support hot unplug, but if it did, qdev would take care to call the matching blk_detach_dev() on unplug.
This fixes at least the bug that such devices didn't show up in query-block, and probably some more problems.
--- hw/ide/qdev.c | 3 +++ 1 file changed, 3 insertions(+)
hw/ide/qdev.c +3 -0
@@ -164,6 +164,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)IDEBus *bus =DO_UPCAST (IDEBus, qbus, dev->qdev.parent_bus);IDEState *s = bus->ifs + dev->unit;Error *err =NULL ; +int ret;if (!dev->conf.blk) {if (kind !=IDE_CD ) {
@@ -172,6 +173,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) }else {/* Anonymous BlockBackend for an empty drive */ dev->conf.blk =blk_new (0 ,BLK_PERM_ALL ); + ret =blk_attach_dev (dev->conf.blk, &dev->qdev); +assert (ret ==0 ); } }
Signature · 1 line
1.8.3.1
PATCH 7/9 scsi-disk: bdrv_attach_dev() for empty CD-ROM
In reply to Kevin WolfIf no drive=... option is passed (for an empty drive), we don't only lack the BlockBackend normally created by parse_drive(), but we also need to manually call blk_attach_dev().
This fixes at least a segfault when unplugging such devices, the bug that they didn't show up in query-block, and probably some more problems.
--- hw/scsi/scsi-disk.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/scsi/scsi-disk.c +5 -0
@@ -2384,9 +2384,14 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **errp)static void scsi_cd_realize (SCSIDevice *dev,Error **errp) {SCSIDiskState *s =DO_UPCAST (SCSIDiskState, qdev, dev); +int ret;if (!dev->conf.blk) { +/* Anonymous BlockBackend for an empty drive. As we put it into +* dev->conf, qdev takes care of detaching on unplug. */ dev->conf.blk =blk_new (0 ,BLK_PERM_ALL ); + ret =blk_attach_dev (dev->conf.blk, &dev->qdev); +assert (ret ==0 ); } s->qdev.blocksize =2048 ;
Signature · 1 line
1.8.3.1
PATCH 8/9 qemu-iotests: Test 'info block'
In reply to Kevin WolfThis test makes sure that all block devices show up on 'info block', with all of the expected information, in different configurations.
--- tests/qemu-iotests/186 | 147 ++++++++++++++ tests/qemu-iotests/186.out | 489 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 637 insertions(+) create mode 100755 tests/qemu-iotests/186 create mode 100644 tests/qemu-iotests/186.out
tests/qemu-iotests/186 new file +147 -0
@@ -0,0 +1,147 @@ +#!/bin/bash +# +# Test 'info block' with all kinds of configurations +# +# Copyright (C) 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto file +_supported_os Linux + +if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then + _notrun "Requires a PC machine" +fi + +function do_run_qemu() +{ + echo Testing: "$@" + + ( + if ! test -t 0; then + while read cmd; do + echo $cmd + done + fi + echo quit + ) | $QEMU -S -nodefaults -display none -device virtio-scsi-pci -monitor stdio "$@" + echo +} + +function check_info_block() +{ + echo "info block" | + QEMU_OPTIONS="" do_run_qemu "$@" | _filter_win32 | _filter_hmp | + _filter_qemu | _filter_generated_node_ids +} + + +size=64M +_make_test_img $size + +removable="floppy ide-cd scsi-cd" +fixed="ide-hd scsi-hd virtio-blk-pci" + +echo +echo "=== Empty drives ===" +echo + +for dev in $removable; do + check_info_block -device $dev + check_info_block -device $dev,id=qdev_id +done + +echo +echo "=== -blockdev/-device=<node-name> ===" +echo + +for dev in $fixed $removable; do + check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null + check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id +done + +echo +echo "=== -drive if=none/-device=<node-name> ===" +echo + +# This creates two BlockBackends that will show up in 'info block'! +# A monitor-owned one from -drive, and anonymous one from -device +for dev in $fixed $removable; do + check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id +done + +echo +echo "=== -drive if=none/-device=<bb-name> (with medium) ===" +echo + +for dev in $fixed $removable; do + check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0 + check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id +done + +echo +echo "=== -drive if=none/-device=<bb-name> (without medium) ===" +echo + +check_info_block -drive if=none + +for dev in $removable; do + check_info_block -drive if=none -device $dev,drive=none0 + check_info_block -drive if=none -device $dev,drive=none0,id=qdev_id +done + +echo +echo "=== -drive if=... ===" +echo + +check_info_block -drive if=floppy +check_info_block -drive if=floppy,driver=null-co + +check_info_block -drive if=ide,driver=null-co +check_info_block -drive if=ide,media=cdrom +check_info_block -drive if=ide,driver=null-co,media=cdrom + +check_info_block -drive if=scsi,driver=null-co +check_info_block -drive if=scsi,media=cdrom +check_info_block -drive if=scsi,driver=null-co,media=cdrom + +check_info_block -drive if=virtio,driver=null-co + +check_info_block -drive if=pflash,driver=null-co,size=1M + +# success, all done +echo "*** done" +rm -f $seq.full +status=0
tests/qemu-iotests/186.out new file +489 -0
489 lines not on this page · raw message
tests/qemu-iotests/group +1 -0
@@ -176,3 +176,4 @@ 182 rw auto quick 183 rw auto migration 185 rw auto +186 rw auto
Signature · 1 line
1.8.3.1
PATCH 9/9 qemu-iotests: Test unplug of -device without drive
In reply to Kevin WolfThis caused an assertion failure until recently because the BlockBackend would be detached on unplug, but was in fact never attached in the first place. Add a regression test.
--- tests/qemu-iotests/067 | 13 +++++++++++++ tests/qemu-iotests/067.out | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
tests/qemu-iotests/067 +13 -0
@@ -137,6 +137,19 @@ run_qemu <<EOF { "execute": "quit" } EOF +echo +echo === Empty drive with -device and device_del === +echo + +run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF +{ "execute": "qmp_capabilities" } +{ "execute": "query-block" } +{ "execute": "device_del", "arguments": { "id": "cd0" } } +{ "execute": "system_reset" } +{ "execute": "query-block" } +{ "execute": "quit" } +EOF + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/067.out +39 -0
@@ -416,4 +416,43 @@ Testing: "return": { } } + +=== Empty drive with -device and device_del === + +Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0 +{ + QMP_VERSION +} +{ + "return": { + } +} +{ + "return": [ + { + "device": "", + "locked": false, + "removable": true, + "qdev": "cd0", + "tray_open": false, + "type": "unknown" + } + ] +} +{ + "return": { + } +} +{ + "return": { + } +} +{ + "return": [ + ] +} +{ + "return": { + } +} *** done
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/9] block: Make blk_get_attached_dev_id() public
In reply to Kevin WolfQuoted 6 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/block-backend.c | 3 +-- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 2/9] block/qapi: Add qdev device name to query-block
In reply to Kevin WolfQuoted 2 lines · Kevin Wolf
With -blockdev/-device, users can indirectly create anonymous BlockBackends, in the state of which they are still interested. As a
Reads awkwardly. Maybe:
BlockBackends, although it is still of interest to learn the state of such backends.
qapi/block-core.json line 436
Quoted 13 lines
preparation for making such BBs visible in query-block, make sure that they can be identified even without a name by adding the ID/QOM path of their qdev device to BlockInfo.
Signed-off-by Kevin Wolf <[email protected]>---
+++
b/qapi/block-core.jsonqapi/block-core.json +1
-0@@ -433,6 +433,9 @@ # # @device: The device name associated with the virtual device. # +# @qdev: The qdev ID, or if no ID is assigned the QOM path, of the block
s/assigned the QOM path, of/assigned, the QOM path of/
qapi/block-core.json line 437
Quoted 1 line
qapi/block-core.json +1
-0+# device.
Missing a (since 2.10) tag.
qapi/block-core.json line 467
Quoted 13 lines
qapi/block-core.json +2
-1+# # @type: This field is returned only for compatibility reasons, it should # not be used (always returns 'unknown') #@@ -458,7 +461,7 @@ # Since: 0.14.0 ## { 'struct': 'BlockInfo', - 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', + 'data': {'device': 'str', '*qdev': 'str', 'type': 'str', 'removable': 'bool', 'locked': 'bool', '*inserted': 'BlockDeviceInfo', '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', '*dirty-bitmaps': ['BlockDirtyInfo'] } }
Besides the testsuite, are there any example outputs that need to be adjusted?
Quoted 13 lines
tests/qemu-iotests/067.out +1
-0@@ -57,6 +57,7 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device virti "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false }, + "qdev": "/machine/peripheral/virtio0/virtio-backend", "type": "unknown" } ]
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 3/9] block: Make blk_all_next() public
In reply to Kevin WolfQuoted 5 lines · Kevin Wolf
Signed-off-by Kevin Wolf <[email protected]>--- block/block-backend.c | 2 +- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
(although the commit message could mention WHY it is useful to be public, because of a pending patch that will need it to do XYZ)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 4/9] block/qapi: Use blk_all_next() for query-block
In reply to Kevin WolfQuoted 4 lines · Kevin Wolf
This patch replaces the
blk_next()loop in query-block by ablk_all_next()one so that we also get access to BlockBackends that aren't owned by the monitor. For now, the next thing we do is check whether each BB has a name, so there is no semantical difference.
s/semantical/semantic/
Quoted 6 lines
Signed-off-by Kevin Wolf <[email protected]>--- block/qapi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 5/9] block: List anonymous device BBs in query-block
In reply to Kevin WolfQuoted 5 lines · Kevin Wolf
Instead of listing only monitor-owned BlockBackends in query-block, also add those anonymous BlockBackends that are owned by a qdev device and as such under the control of the user.
This allows to use query-block to inspect BlockBackends for the modern
"allows to VERB" is not idiomatic; better is "allows VERBing" (as in "allows using query-block"); or "allows SUBJECT to VERB" (as in the verbose "allows the client to use query-block"). For your particular wording choice, it is also possible to do "allows the use of query-block", although that rewrite is not possible for all VERB.
Quoted 8 lines
configuration syntax with -blockdev and -device.
Signed-off-by Kevin Wolf <[email protected]>--- block/qapi.c | 2 +- hmp.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 6/9] ide: bdrv_attach_dev() for empty CD-ROM
In reply to Kevin WolfQuoted 7 lines · Kevin Wolf
If no drive=... option is passed (for an empty drive), we don't only lack the BlockBackend normally created by
parse_drive(), but we also need to manually callblk_attach_dev().IDE does not support hot unplug, but if it did, qdev would take care to call the matching
blk_detach_dev()on unplug.
Quoted 7 lines
This fixes at least the bug that such devices didn't show up in query-block, and probably some more problems.
Signed-off-by Kevin Wolf <[email protected]>--- hw/ide/qdev.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 7/9] scsi-disk: bdrv_attach_dev() for empty CD-ROM
In reply to Kevin WolfQuoted 4 lines · Kevin Wolf
If no drive=... option is passed (for an empty drive), we don't only lack the BlockBackend normally created by
parse_drive(), but we also need to manually callblk_attach_dev().
Quoted 9 lines
This fixes at least a segfault when unplugging such devices, the bug that they didn't show up in query-block, and probably some more problems.
Signed-off-by Kevin Wolf <[email protected]>--- hw/scsi/scsi-disk.c | 5 +++++ 1 file changed, 5 insertions(+)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 8/9] qemu-iotests: Test 'info block'
In reply to Kevin WolfQuoted 12 lines · Kevin Wolf
This test makes sure that all block devices show up on 'info block', with all of the expected information, in different configurations.
Signed-off-by Kevin Wolf <[email protected]>--- tests/qemu-iotests/186 | 147 ++++++++++++++ tests/qemu-iotests/186.out | 489 +++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 637 insertions(+) create mode 100755 tests/qemu-iotests/186 create mode 100644 tests/qemu-iotests/186.out
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 9/9] qemu-iotests: Test unplug of -device without drive
In reply to Kevin WolfQuoted 10 lines · Kevin Wolf
This caused an assertion failure until recently because the BlockBackend would be detached on unplug, but was in fact never attached in the first place. Add a regression test.
Signed-off-by Kevin Wolf <[email protected]>--- tests/qemu-iotests/067 | 13 +++++++++++++ tests/qemu-iotests/067.out | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 5/9] block: List anonymous device BBs in query-block
In reply to Eric BlakeAm 12.07.2017 um 17:47 hat Eric Blake geschrieben:
Quoted 10 lines · Kevin Wolf
Quoted 5 lines
Instead of listing only monitor-owned BlockBackends in query-block, also add those anonymous BlockBackends that are owned by a qdev device and as such under the control of the user.
This allows to use query-block to inspect BlockBackends for the modern
"allows to VERB" is not idiomatic; better is "allows VERBing" (as in "allows using query-block"); or "allows SUBJECT to VERB" (as in the verbose "allows the client to use query-block").
Is this inconsistency a known problem in English or should we file a new bug report against it? But as long as this isn't fixed yet, I'll apply your workaround.
Kevin