From nobody Wed Nov 5 15:51:27 2025 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.zoho.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 1496734708280780.0605392352846; Tue, 6 Jun 2017 00:38:28 -0700 (PDT) Received: from localhost ([::1]:36636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI94N-0002cE-3C for importer@patchew.org; Tue, 06 Jun 2017 03:38:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI90F-0007ew-QK for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI90F-0001S0-67 for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36844) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dI90E-0001RX-WB for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0AB2A81F01 for ; Tue, 6 Jun 2017 07:34:10 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B8BA4F9A6 for ; Tue, 6 Jun 2017 07:34:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1C4431138647; Tue, 6 Jun 2017 09:34:08 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0AB2A81F01 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0AB2A81F01 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 09:34:05 +0200 Message-Id: <1496734448-19256-2-git-send-email-armbru@redhat.com> In-Reply-To: <1496734448-19256-1-git-send-email-armbru@redhat.com> References: <1496734448-19256-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 06 Jun 2017 07:34:10 +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] [PULL 1/4] block: Clarify documentation of BlockInfo member io-status 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: , 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" Say "SCSI except scsi-generic" instead of "scsi-disk", because scsi-disk could mean either scsi-disk.c (which is correct) or device model scsi-disk (which would be incorrect). Signed-off-by: Markus Armbruster Message-Id: <1494327362-30727-2-git-send-email-armbru@redhat.com> Acked-by: Paolo Bonzini --- qapi/block-core.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 88a7471..f85c223 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -449,7 +449,8 @@ # # @io-status: @BlockDeviceIoStatus. Only present if the device # supports it and the VM is configured to stop on errors -# (supported device models: virtio-blk, ide, scsi-disk) +# (supported device models: virtio-blk, IDE, SCSI except +# scsi-generic) # # @inserted: @BlockDeviceInfo describing the device if media is # present --=20 2.7.5 From nobody Wed Nov 5 15:51:27 2025 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.zoho.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 1496734598718584.6537137699175; Tue, 6 Jun 2017 00:36:38 -0700 (PDT) Received: from localhost ([::1]:36625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI92b-0000yA-9W for importer@patchew.org; Tue, 06 Jun 2017 03:36:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI90F-0007ex-Qi for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI90F-0001Rz-5d for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49174) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dI90E-0001RZ-Vp for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C12A8124A for ; Tue, 6 Jun 2017 07:34:10 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B01317191 for ; Tue, 6 Jun 2017 07:34:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1F3BF1138648; Tue, 6 Jun 2017 09:34:08 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0C12A8124A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0C12A8124A From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 09:34:06 +0200 Message-Id: <1496734448-19256-3-git-send-email-armbru@redhat.com> In-Reply-To: <1496734448-19256-1-git-send-email-armbru@redhat.com> References: <1496734448-19256-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Jun 2017 07:34:10 +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] [PULL 2/4] virtio-scsi-test: Use scsi-hd instead of legacy scsi-disk 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: , 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: Markus Armbruster Message-Id: <1494327362-30727-3-git-send-email-armbru@redhat.com> Acked-by: Paolo Bonzini --- tests/virtio-scsi-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 8b0f77a..eff71df 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -149,7 +149,7 @@ static QVirtIOSCSI *qvirtio_scsi_pci_init(int slot) =20 vs->qs =3D qvirtio_scsi_start("-drive file=3Dblkdebug::null-co://," "if=3Dnone,id=3Ddr1,format=3Draw,file.alig= n=3D4k " - "-device scsi-disk,drive=3Ddr1,lun=3D0,scs= i-id=3D1"); + "-device scsi-hd,drive=3Ddr1,lun=3D0,scsi-= id=3D1"); dev =3D qvirtio_pci_device_find(vs->qs->pcibus, VIRTIO_ID_SCSI); vs->dev =3D (QVirtioDevice *)dev; g_assert(dev !=3D NULL); --=20 2.7.5 From nobody Wed Nov 5 15:51:27 2025 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.zoho.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 1496734565389791.3646634783297; Tue, 6 Jun 2017 00:36:05 -0700 (PDT) Received: from localhost ([::1]:36623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI922-0000Vz-TE for importer@patchew.org; Tue, 06 Jun 2017 03:36:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI90H-0007gG-FF for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI90G-0001Tu-7n for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51680) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dI90F-0001SM-VE; Tue, 06 Jun 2017 03:34:12 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00169142A99; Tue, 6 Jun 2017 07:34:10 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AB795C3FD; Tue, 6 Jun 2017 07:34:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 223DC113864A; Tue, 6 Jun 2017 09:34:08 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 00169142A99 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 00169142A99 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 09:34:07 +0200 Message-Id: <1496734448-19256-4-git-send-email-armbru@redhat.com> In-Reply-To: <1496734448-19256-1-git-send-email-armbru@redhat.com> References: <1496734448-19256-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 06 Jun 2017 07:34:11 +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] [PULL 3/4] tests: check-qom-proplist: add checks for cmdline-created objects 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: qemu-stable@nongnu.org, Michael Roth , "Dr. David Alan Gilbert" 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" From: Michael Roth check-qom-proplist originally added tests for verifying that object-creation helpers object_new_with_{props,propv} behaved in similar fashion to the "traditional" method involving setting each individual property separately after object creation rather than via a single call. Another similar "helper" for creating Objects exists in the form of objects specified via -object command-line parameters. By that rationale, we extend check-qom-proplist to include similar checks for command-line-created objects by employing the same qemu_opts_parse()-based parsing the vl.c employs. This parser has a side-effect of parsing the object's options into a QemuOpt structure and registering this in the global QemuOptsList using the Object's ID. This can conflict with future Object instances that attempt to use the same ID if we don't ensure this is cleaned up as part of Object finalization, so we include a FIXME stub to test for this case, which will then be resolved in a subsequent patch. Suggested-by: Daniel Berrange Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Cc: Eric Blake Cc: Daniel Berrange Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth Reviewed-by: Markus Armbruster Message-Id: <1496531612-22166-2-git-send-email-mdroth@linux.vnet.ibm.com> [Comment formatting tidied up] Signed-off-by: Markus Armbruster --- tests/check-qom-proplist.c | 56 ++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 56 insertions(+) diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index a16cefc..e3b3ae4 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -23,6 +23,9 @@ #include "qapi/error.h" #include "qom/object.h" #include "qemu/module.h" +#include "qemu/option.h" +#include "qemu/config-file.h" +#include "qom/object_interfaces.h" =20 =20 #define TYPE_DUMMY "qemu-dummy" @@ -162,6 +165,10 @@ static const TypeInfo dummy_info =3D { .instance_finalize =3D dummy_finalize, .class_size =3D sizeof(DummyObjectClass), .class_init =3D dummy_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_USER_CREATABLE }, + { } + } }; =20 =20 @@ -320,6 +327,14 @@ static const TypeInfo dummy_backend_info =3D { .class_size =3D sizeof(DummyBackendClass), }; =20 +static QemuOptsList qemu_object_opts =3D { + .name =3D "object", + .implied_opt_name =3D "qom-type", + .head =3D QTAILQ_HEAD_INITIALIZER(qemu_object_opts.head), + .desc =3D { + { } + }, +}; =20 =20 static void test_dummy_createv(void) @@ -388,6 +403,46 @@ static void test_dummy_createlist(void) object_unparent(OBJECT(dobj)); } =20 +static void test_dummy_createcmdl(void) +{ + QemuOpts *opts; + DummyObject *dobj; + Error *err =3D NULL; + const char *params =3D TYPE_DUMMY \ + ",id=3Ddev0," \ + "bv=3Dyes,sv=3DHiss hiss hiss,av=3Dplatypus"; + + qemu_add_opts(&qemu_object_opts); + opts =3D qemu_opts_parse(&qemu_object_opts, params, true, &err); + g_assert(err =3D=3D NULL); + g_assert(opts); + + dobj =3D DUMMY_OBJECT(user_creatable_add_opts(opts, &err)); + g_assert(err =3D=3D NULL); + g_assert(dobj); + g_assert_cmpstr(dobj->sv, =3D=3D, "Hiss hiss hiss"); + g_assert(dobj->bv =3D=3D true); + g_assert(dobj->av =3D=3D DUMMY_PLATYPUS); + + user_creatable_del("dev0", &err); + g_assert(err =3D=3D NULL); + error_free(err); + + /* + * cmdline-parsing via qemu_opts_parse() results in a QemuOpts entry + * corresponding to the Object's ID to be added to the QemuOptsList + * for objects. To avoid having this entry conflict with future + * Objects using the same ID (which can happen in cases where + * qemu_opts_parse() is used to parse the object params, such as + * with hmp_object_add() at the time of this comment), we need to + * check for this in user_creatable_del() and remove the QemuOpts if + * it is present. + * + * FIXME: add an assert to verify that the QemuOpts is cleaned up + * once the corresponding cleanup code is added. + */ +} + static void test_dummy_badenum(void) { Error *err =3D NULL; @@ -525,6 +580,7 @@ int main(int argc, char **argv) =20 g_test_add_func("/qom/proplist/createlist", test_dummy_createlist); g_test_add_func("/qom/proplist/createv", test_dummy_createv); + g_test_add_func("/qom/proplist/createcmdline", test_dummy_createcmdl); g_test_add_func("/qom/proplist/badenum", test_dummy_badenum); g_test_add_func("/qom/proplist/getenum", test_dummy_getenum); g_test_add_func("/qom/proplist/iterator", test_dummy_iterator); --=20 2.7.5 From nobody Wed Nov 5 15:51:27 2025 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.zoho.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 1496734684568910.8786349739588; Tue, 6 Jun 2017 00:38:04 -0700 (PDT) Received: from localhost ([::1]:36635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI93z-0002FX-70 for importer@patchew.org; Tue, 06 Jun 2017 03:38:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dI90G-0007fO-IH for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dI90F-0001SY-Ea for qemu-devel@nongnu.org; Tue, 06 Jun 2017 03:34:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42186) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dI90F-0001Rh-6r; Tue, 06 Jun 2017 03:34:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 373193DBE5; Tue, 6 Jun 2017 07:34:10 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A12D4FA4D; Tue, 6 Jun 2017 07:34:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 25680113864C; Tue, 6 Jun 2017 09:34:08 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 373193DBE5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 373193DBE5 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Jun 2017 09:34:08 +0200 Message-Id: <1496734448-19256-5-git-send-email-armbru@redhat.com> In-Reply-To: <1496734448-19256-1-git-send-email-armbru@redhat.com> References: <1496734448-19256-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 06 Jun 2017 07:34:10 +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] [PULL 4/4] monitor: fix object_del for command-line-created objects 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: qemu-stable@nongnu.org, Michael Roth , "Dr. David Alan Gilbert" 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" From: Michael Roth Currently objects specified on the command-line are only partially cleaned up when 'object_del' is issued in either HMP or QMP: the object itself is fully finalized, but the QemuOpts are not removed. This results in the following behavior: x86_64-softmmu/qemu-system-x86_64 -monitor stdio \ -object memory-backend-ram,id=3Dram1,size=3D256M QEMU 2.7.91 monitor - type 'help' for more information (qemu) object_del ram1 (qemu) object_del ram1 object 'ram1' not found (qemu) object_add memory-backend-ram,id=3Dram1,size=3D256M Duplicate ID 'ram1' for object Try "help object_add" for more information which can be an issue for use-cases like memory hotplug. This happens on the HMP side because hmp_object_add() attempts to create a temporary QemuOpts entry with ID 'ram1', which ends up conflicting with the command-line-created entry, since it was never cleaned up during the previous hmp_object_del() call. We address this by adding a check in user_creatable_del(), which is called by both qmp_object_del() and hmp_object_del() to handle the actual object cleanup, to determine whether an option group entry matching the object's ID is present and removing it if it is. Note that qmp_object_add() never attempts to create a temporary QemuOpts entry, so it does not encounter the duplicate ID error, which is why this isn't generally visible in libvirt. Cc: "Dr. David Alan Gilbert" Cc: Markus Armbruster Cc: Eric Blake Cc: Daniel Berrange Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth Reviewed-by: Daniel P. Berrange Reviewed-by: Markus Armbruster Message-Id: <1496531612-22166-3-git-send-email-mdroth@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster --- qom/object_interfaces.c | 9 +++++++++ tests/check-qom-proplist.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index d4253a8..ff27e06 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -4,6 +4,7 @@ #include "qemu/module.h" #include "qapi-visit.h" #include "qapi/opts-visitor.h" +#include "qemu/config-file.h" =20 void user_creatable_complete(Object *obj, Error **errp) { @@ -181,6 +182,14 @@ void user_creatable_del(const char *id, Error **errp) error_setg(errp, "object '%s' is in use, can not be deleted", id); return; } + + /* + * if object was defined on the command-line, remove its corresponding + * option group entry + */ + qemu_opts_del(qemu_opts_find(qemu_find_opts_err("object", &error_abort= ), + id)); + object_unparent(obj); } =20 diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index e3b3ae4..8e432e9 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -438,9 +438,9 @@ static void test_dummy_createcmdl(void) * check for this in user_creatable_del() and remove the QemuOpts if * it is present. * - * FIXME: add an assert to verify that the QemuOpts is cleaned up - * once the corresponding cleanup code is added. + * The below check ensures this works as expected. */ + g_assert_null(qemu_opts_find(&qemu_object_opts, "dev0")); } =20 static void test_dummy_badenum(void) --=20 2.7.5