From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946221168738.1359095740327; Thu, 13 Jul 2017 04:43:41 -0700 (PDT) Received: from localhost ([::1]:58958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcWx-0003rz-1d for importer@patchew.org; Thu, 13 Jul 2017 07:43:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVD-0002cY-SY for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:41:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVD-0002hg-09 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:41:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVA-0002fm-Sx; Thu, 13 Jul 2017 07:41:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A608C8E77F; Thu, 13 Jul 2017 11:41:47 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id C469960609; Thu, 13 Jul 2017 11:41:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A608C8E77F Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A608C8E77F From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:27 +0200 Message-Id: <1499946095-8224-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 13 Jul 2017 11:41:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/9] block: Make blk_get_attached_dev_id() public X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- block/block-backend.c | 3 +-- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 0df3457..d60e53b 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -83,7 +83,6 @@ static const AIOCBInfo block_backend_aiocb_info =3D { =20 static void drive_info_del(DriveInfo *dinfo); static BlockBackend *bdrv_first_blk(BlockDriverState *bs); -static char *blk_get_attached_dev_id(BlockBackend *blk); =20 /* All BlockBackends */ static QTAILQ_HEAD(, BlockBackend) block_backends =3D @@ -726,7 +725,7 @@ void *blk_get_attached_dev(BlockBackend *blk) =20 /* 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; =20 diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 1e05281..80096f2 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -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 *opaq= ue); --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149994634724978.2828800041026; Thu, 13 Jul 2017 04:45:47 -0700 (PDT) Received: from localhost ([::1]:58980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcYz-0006RC-MH for importer@patchew.org; Thu, 13 Jul 2017 07:45:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVG-0002ep-8R for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:41:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVF-0002j8-7Y for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:41:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59490) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVC-0002h3-Tp; Thu, 13 Jul 2017 07:41:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C921D7CE1F; Thu, 13 Jul 2017 11:41:49 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7DC16060E; Thu, 13 Jul 2017 11:41:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C921D7CE1F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C921D7CE1F From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:28 +0200 Message-Id: <1499946095-8224-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 13 Jul 2017 11:41:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/9] block/qapi: Add qdev device name to query-block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With -blockdev/-device, users can indirectly create anonymous BlockBackends, while the state of such backends is still of interest. 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. Signed-off-by: Kevin Wolf Reviewed-by: John Snow --- block/qapi.c | 10 ++++++++++ hmp.c | 3 +++ qapi/block-core.json | 9 ++++++++- tests/qemu-iotests/067.out | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/block/qapi.c b/block/qapi.c index 0a41d59..705cd11 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -322,11 +322,21 @@ static void bdrv_query_info(BlockBackend *blk, BlockI= nfo **p_info, { BlockInfo *info =3D g_malloc0(sizeof(*info)); BlockDriverState *bs =3D blk_bs(blk); + char *qdev; + info->device =3D g_strdup(blk_name(blk)); info->type =3D g_strdup("unknown"); info->locked =3D blk_dev_is_medium_locked(blk); info->removable =3D blk_dev_has_removable_media(blk); =20 + qdev =3D blk_get_attached_dev_id(blk); + if (qdev && *qdev) { + info->has_qdev =3D true; + info->qdev =3D qdev; + } else { + g_free(qdev); + } + if (blk_dev_has_tray(blk)) { info->has_tray_open =3D true; info->tray_open =3D blk_dev_is_tray_open(blk); diff --git a/hmp.c b/hmp.c index dee4028..d1d769e 100644 --- a/hmp.c +++ b/hmp.c @@ -425,6 +425,9 @@ static void print_block_info(Monitor *mon, BlockInfo *i= nfo, } =20 if (info) { + if (info->has_qdev) { + monitor_printf(mon, " Attached to: %s\n", info->qdev); + } if (info->has_io_status && info->io_status !=3D BLOCK_DEVICE_IO_ST= ATUS_OK) { monitor_printf(mon, " I/O status: %s\n", BlockDeviceIoStatus_lookup[info->io_status]); diff --git a/qapi/block-core.json b/qapi/block-core.json index f85c223..0dd9c30 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -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. (since 2.10) +# # @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': 'b= ool', 'locked': 'bool', '*inserted': 'BlockDeviceInfo', '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', '*dirty-bitmaps': ['BlockDirtyInfo'] } } @@ -528,6 +531,7 @@ # } # } # }, +# "qdev": "ide_disk", # "type":"unknown" # }, # { @@ -535,12 +539,15 @@ # "device":"ide1-cd0", # "locked":false, # "removable":true, +# "qdev": "/machine/unattached/device[23]", +# "tray_open": false, # "type":"unknown" # }, # { # "device":"floppy0", # "locked":false, # "removable":true, +# "qdev": "/machine/unattached/device[20]", # "type":"unknown" # }, # { diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out index 782eae2..e3c4496 100644 --- a/tests/qemu-iotests/067.out +++ b/tests/qemu-iotests/067.out @@ -57,6 +57,7 @@ Testing: -drive file=3DTEST_DIR/t.qcow2,format=3Dqcow2,if= =3Dnone,id=3Ddisk -device virti "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false }, + "qdev": "/machine/peripheral/virtio0/virtio-backend", "type": "unknown" } ] --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946231741718.5976980620725; Thu, 13 Jul 2017 04:43:51 -0700 (PDT) Received: from localhost ([::1]:58960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcX8-00043g-EJ for importer@patchew.org; Thu, 13 Jul 2017 07:43:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVL-0002jq-6S for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVH-0002kD-AT for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:41:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVF-0002ir-6k; Thu, 13 Jul 2017 07:41:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06AE519F20; Thu, 13 Jul 2017 11:41:52 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CDA46060E; Thu, 13 Jul 2017 11:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 06AE519F20 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 06AE519F20 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:29 +0200 Message-Id: <1499946095-8224-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 13 Jul 2017 11:41:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/9] block: Make blk_all_next() public X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- block/block-backend.c | 2 +- include/sysemu/block-backend.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/block/block-backend.c b/block/block-backend.c index d60e53b..15072f8 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -342,7 +342,7 @@ void blk_unref(BlockBackend *blk) * Behaves similarly to blk_next() but iterates over all BlockBackends, ev= en 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); diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 80096f2..dfdd3b8 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -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); =20 --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946472076273.57229494296223; Thu, 13 Jul 2017 04:47:52 -0700 (PDT) Received: from localhost ([::1]:58990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcaz-0007vN-RW for importer@patchew.org; Thu, 13 Jul 2017 07:47:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVN-0002mP-EA for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVM-0002nL-Ju for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59738) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVH-0002jl-4t; Thu, 13 Jul 2017 07:41:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A747A163; Thu, 13 Jul 2017 11:41:54 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B8086060E; Thu, 13 Jul 2017 11:41:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 15A747A163 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 15A747A163 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:30 +0200 Message-Id: <1499946095-8224-5-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 13 Jul 2017 11:41:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/9] block/qapi: Use blk_all_next() for query-block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This 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 semantic difference. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- block/qapi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index 705cd11..2f86c79 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -472,8 +472,14 @@ BlockInfoList *qmp_query_block(Error **errp) BlockBackend *blk; Error *local_err =3D NULL; =20 - for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { - BlockInfoList *info =3D g_malloc0(sizeof(*info)); + for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { + BlockInfoList *info; + + if (!*blk_name(blk)) { + continue; + } + + info =3D g_malloc0(sizeof(*info)); bdrv_query_info(blk, &info->value, &local_err); if (local_err) { error_propagate(errp, local_err); --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946229006779.432525995001; Thu, 13 Jul 2017 04:43:49 -0700 (PDT) Received: from localhost ([::1]:58959 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcX4-0003za-Lr for importer@patchew.org; Thu, 13 Jul 2017 07:43:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVN-0002m7-6I for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVM-0002n9-F9 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVJ-0002kp-87; Thu, 13 Jul 2017 07:41:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28F2FC00862C; Thu, 13 Jul 2017 11:41:56 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F4336060E; Thu, 13 Jul 2017 11:41:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 28F2FC00862C Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 28F2FC00862C From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:31 +0200 Message-Id: <1499946095-8224-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 13 Jul 2017 11:41:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/9] block: List anonymous device BBs in query-block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 using query-block to inspect BlockBackends for the modern configuration syntax with -blockdev and -device. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- block/qapi.c | 2 +- hmp.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index 2f86c79..b5bb42b 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -475,7 +475,7 @@ BlockInfoList *qmp_query_block(Error **errp) for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { BlockInfoList *info; =20 - if (!*blk_name(blk)) { + if (!*blk_name(blk) && !blk_get_attached_dev(blk)) { continue; } =20 diff --git a/hmp.c b/hmp.c index d1d769e..4caa9c1 100644 --- a/hmp.c +++ b/hmp.c @@ -401,16 +401,16 @@ static void print_block_info(Monitor *mon, BlockInfo = *info, =20 assert(!info || !info->has_inserted || info->inserted =3D=3D inserted); =20 - 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->nod= e_name + : info && info->has_qdev ? info->qdev : ""); } =20 --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946554248981.7022530854192; Thu, 13 Jul 2017 04:49:14 -0700 (PDT) Received: from localhost ([::1]:59002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVccL-0000hy-4k for importer@patchew.org; Thu, 13 Jul 2017 07:49:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVO-0002nD-B3 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVN-0002nr-He for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39668) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVL-0002m7-9o; Thu, 13 Jul 2017 07:41:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 407ABC0733F5; Thu, 13 Jul 2017 11:41:58 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72B0360609; Thu, 13 Jul 2017 11:41:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 407ABC0733F5 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 407ABC0733F5 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:32 +0200 Message-Id: <1499946095-8224-7-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 13 Jul 2017 11:41:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 6/9] ide: bdrv_attach_dev() for empty CD-ROM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If no drive=3D... 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. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- hw/ide/qdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 299e592..cc2f5bd 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -164,6 +164,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind = kind) IDEBus *bus =3D DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); IDEState *s =3D bus->ifs + dev->unit; Error *err =3D NULL; + int ret; =20 if (!dev->conf.blk) { if (kind !=3D 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 =3D blk_new(0, BLK_PERM_ALL); + ret =3D blk_attach_dev(dev->conf.blk, &dev->qdev); + assert(ret =3D=3D 0); } } =20 --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149994664881957.41542473328104; Thu, 13 Jul 2017 04:50:48 -0700 (PDT) Received: from localhost ([::1]:59012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcdr-0001yA-7d for importer@patchew.org; Thu, 13 Jul 2017 07:50:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVV-0002uI-Au for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVR-0002qI-ED for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVP-0002ot-Br; Thu, 13 Jul 2017 07:42:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D793315D2C; Thu, 13 Jul 2017 11:42:02 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AAAD60609; Thu, 13 Jul 2017 11:41:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2D793315D2C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2D793315D2C From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:33 +0200 Message-Id: <1499946095-8224-8-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 13 Jul 2017 11:42:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 7/9] scsi-disk: bdrv_attach_dev() for empty CD-ROM X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If no drive=3D... 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. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: John Snow --- hw/scsi/scsi-disk.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index a53f058..5f1e5e8 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2384,9 +2384,14 @@ static void scsi_hd_realize(SCSIDevice *dev, Error *= *errp) static void scsi_cd_realize(SCSIDevice *dev, Error **errp) { SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, dev); + int ret; =20 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 =3D blk_new(0, BLK_PERM_ALL); + ret =3D blk_attach_dev(dev->conf.blk, &dev->qdev); + assert(ret =3D=3D 0); } =20 s->qdev.blocksize =3D 2048; --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946384560659.4053308235183; Thu, 13 Jul 2017 04:46:24 -0700 (PDT) Received: from localhost ([::1]:58982 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcZZ-0006tT-EJ for importer@patchew.org; Thu, 13 Jul 2017 07:46:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVb-000308-Ot for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVY-0002wT-UX for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVR-0002q4-Kj; Thu, 13 Jul 2017 07:42:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8459CC00862C; Thu, 13 Jul 2017 11:42:04 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696D16060E; Thu, 13 Jul 2017 11:42:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8459CC00862C Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8459CC00862C From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:34 +0200 Message-Id: <1499946095-8224-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 13 Jul 2017 11:42:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 8/9] qemu-iotests: Test 'info block' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake Reviewed-by: John Snow --- 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 diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 new file mode 100755 index 0000000..ab83ee4 --- /dev/null +++ b/tests/qemu-iotests/186 @@ -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 . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # 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" !=3D "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 -monito= r stdio "$@" + echo +} + +function check_info_block() +{ + echo "info block" | + QEMU_OPTIONS=3D"" do_run_qemu "$@" | _filter_win32 | _filter_hmp | + _filter_qemu | _filter_generated_node_ids +} + + +size=3D64M +_make_test_img $size + +removable=3D"floppy ide-cd scsi-cd" +fixed=3D"ide-hd scsi-hd virtio-blk-pci" + +echo +echo "=3D=3D=3D Empty drives =3D=3D=3D" +echo + +for dev in $removable; do + check_info_block -device $dev + check_info_block -device $dev,id=3Dqdev_id +done + +echo +echo "=3D=3D=3D -blockdev/-device=3D =3D=3D=3D" +echo + +for dev in $fixed $removable; do + check_info_block -blockdev driver=3Dnull-co,node-name=3Dnull -device $= dev,drive=3Dnull + check_info_block -blockdev driver=3Dnull-co,node-name=3Dnull -device $= dev,drive=3Dnull,id=3Dqdev_id +done + +echo +echo "=3D=3D=3D -drive if=3Dnone/-device=3D =3D=3D=3D" +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=3Dnone,driver=3Dnull-co,node-name=3Dnull -d= evice $dev,drive=3Dnull,id=3Dqdev_id +done + +echo +echo "=3D=3D=3D -drive if=3Dnone/-device=3D (with medium) =3D=3D= =3D" +echo + +for dev in $fixed $removable; do + check_info_block -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -d= evice $dev,drive=3Dnone0 + check_info_block -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -d= evice $dev,drive=3Dnone0,id=3Dqdev_id +done + +echo +echo "=3D=3D=3D -drive if=3Dnone/-device=3D (without medium) =3D= =3D=3D" +echo + +check_info_block -drive if=3Dnone + +for dev in $removable; do + check_info_block -drive if=3Dnone -device $dev,drive=3Dnone0 + check_info_block -drive if=3Dnone -device $dev,drive=3Dnone0,id=3Dqdev= _id +done + +echo +echo "=3D=3D=3D -drive if=3D... =3D=3D=3D" +echo + +check_info_block -drive if=3Dfloppy +check_info_block -drive if=3Dfloppy,driver=3Dnull-co + +check_info_block -drive if=3Dide,driver=3Dnull-co +check_info_block -drive if=3Dide,media=3Dcdrom +check_info_block -drive if=3Dide,driver=3Dnull-co,media=3Dcdrom + +check_info_block -drive if=3Dscsi,driver=3Dnull-co +check_info_block -drive if=3Dscsi,media=3Dcdrom +check_info_block -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdrom + +check_info_block -drive if=3Dvirtio,driver=3Dnull-co + +check_info_block -drive if=3Dpflash,driver=3Dnull-co,size=3D1M + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out new file mode 100644 index 0000000..3cf19be --- /dev/null +++ b/tests/qemu-iotests/186.out @@ -0,0 +1,489 @@ +QA output created by 186 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 + +=3D=3D=3D Empty drives =3D=3D=3D + +Testing: -device floppy +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +/machine/peripheral-anon/device[1]: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -device floppy,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +qdev_id: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + +Testing: -device ide-cd +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +/machine/peripheral-anon/device[1]: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -device ide-cd,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +qdev_id: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + +Testing: -device scsi-cd +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +/machine/peripheral-anon/device[1]: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -device scsi-cd,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +qdev_id: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + + +=3D=3D=3D -blockdev/-device=3D =3D=3D=3D + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device ide-hd,drive= =3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device ide-hd,drive= =3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device scsi-hd,drive= =3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device scsi-hd,drive= =3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device virtio-blk-pc= i,drive=3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1]/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device virtio-blk-pc= i,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral/qdev_id/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device floppy,drive= =3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device floppy,drive= =3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device ide-cd,drive= =3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device ide-cd,drive= =3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device scsi-cd,drive= =3Dnull +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -blockdev driver=3Dnull-co,node-name=3Dnull -device scsi-cd,drive= =3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + + +=3D=3D=3D -drive if=3Dnone/-device=3D =3D=3D=3D + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-hd= ,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-h= d,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device virtio= -blk-pci,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: /machine/peripheral/qdev_id/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device floppy= ,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-cd= ,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-c= d,drive=3Dnull,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Removable device: not locked, tray closed + Cache mode: writeback + +null: null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + + +=3D=3D=3D -drive if=3Dnone/-device=3D (with medium) =3D=3D=3D + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-hd= ,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-hd= ,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-h= d,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-h= d,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: qdev_id + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device virtio= -blk-pci,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1]/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device virtio= -blk-pci,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral/qdev_id/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device floppy= ,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device floppy= ,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-cd= ,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device ide-cd= ,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-c= d,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dnone,driver=3Dnull-co,node-name=3Dnull -device scsi-c= d,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0 (null): null-co:// (null-co) + Attached to: qdev_id + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + + +=3D=3D=3D -drive if=3Dnone/-device=3D (without medium) =3D=3D=3D + +Testing: -drive if=3Dnone +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device floppy,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device floppy,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device ide-cd,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device ide-cd,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device scsi-cd,drive=3Dnone0 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dnone -device scsi-cd,drive=3Dnone0,id=3Dqdev_id +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +none0: [not inserted] + Attached to: qdev_id + Removable device: not locked, tray closed +(qemu) quit + + +=3D=3D=3D -drive if=3D... =3D=3D=3D + +Testing: -drive if=3Dfloppy +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +floppy0: [not inserted] + Attached to: /machine/unattached/device[17] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dfloppy,driver=3Dnull-co +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +floppy0 (NODE_NAME): null-co:// (null-co) + Attached to: /machine/unattached/device[17] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dide,driver=3Dnull-co +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +ide0-hd0 (NODE_NAME): null-co:// (null-co) + Attached to: /machine/unattached/device[18] + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dide,media=3Dcdrom +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +ide0-cd0: [not inserted] + Attached to: /machine/unattached/device[18] + Removable device: not locked, tray closed +(qemu) quit + +Testing: -drive if=3Dide,driver=3Dnull-co,media=3Dcdrom +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only) + Attached to: /machine/unattached/device[18] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +qemu: -drive if=3Dscsi,driver=3Dnull-co: warning: bus=3D0,unit=3D0 is depr= ecated with this machine type +Testing: -drive if=3Dscsi,driver=3Dnull-co +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +scsi0-hd0 (NODE_NAME): null-co:// (null-co) + Attached to: /machine/unattached/device[27]/scsi.0/legacy[0] + Cache mode: writeback +(qemu) quit + +qemu: -drive if=3Dscsi,media=3Dcdrom: warning: bus=3D0,unit=3D0 is depreca= ted with this machine type +Testing: -drive if=3Dscsi,media=3Dcdrom +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +scsi0-cd0: [not inserted] + Attached to: /machine/unattached/device[27]/scsi.0/legacy[0] + Removable device: not locked, tray closed +(qemu) quit + +qemu: -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdrom: warning: bus=3D0,un= it=3D0 is deprecated with this machine type +Testing: -drive if=3Dscsi,driver=3Dnull-co,media=3Dcdrom +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +scsi0-cd0 (NODE_NAME): null-co:// (null-co, read-only) + Attached to: /machine/unattached/device[27]/scsi.0/legacy[0] + Removable device: not locked, tray closed + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dvirtio,driver=3Dnull-co +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +virtio0 (NODE_NAME): null-co:// (null-co) + Attached to: /machine/peripheral-anon/device[1]/virtio-backend + Cache mode: writeback +(qemu) quit + +Testing: -drive if=3Dpflash,driver=3Dnull-co,size=3D1M +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) info block +pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co) + Attached to: /machine/unattached/device[2] + Cache mode: writeback +(qemu) quit + +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 318ae74..a6c7e1f 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -176,3 +176,4 @@ 182 rw auto quick 183 rw auto migration 185 rw auto +186 rw auto --=20 1.8.3.1 From nobody Sat May 4 00:34:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499946369957283.4363670863511; Thu, 13 Jul 2017 04:46:09 -0700 (PDT) Received: from localhost ([::1]:58981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcZM-0006jT-Kr for importer@patchew.org; Thu, 13 Jul 2017 07:46:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50342) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVcVX-0002we-Af for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVcVW-0002tE-Hl for qemu-devel@nongnu.org; Thu, 13 Jul 2017 07:42:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40740) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVcVT-0002rF-Sf; Thu, 13 Jul 2017 07:42:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C464964A76; Thu, 13 Jul 2017 11:42:06 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-143.ams2.redhat.com [10.36.117.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDEF660616; Thu, 13 Jul 2017 11:42:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C464964A76 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C464964A76 From: Kevin Wolf To: qemu-block@nongnu.org Date: Thu, 13 Jul 2017 13:41:35 +0200 Message-Id: <1499946095-8224-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1499946095-8224-1-git-send-email-kwolf@redhat.com> References: <1499946095-8224-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 13 Jul 2017 11:42:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 9/9] qemu-iotests: Test unplug of -device without drive X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake Reviewed-by: John Snow --- tests/qemu-iotests/067 | 13 +++++++++++++ tests/qemu-iotests/067.out | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067 index 38d23fc..5d4ca4b 100755 --- a/tests/qemu-iotests/067 +++ b/tests/qemu-iotests/067 @@ -137,6 +137,19 @@ run_qemu <