From nobody Sat Apr 20 14:00:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 148779180364433.520862214747694; Wed, 22 Feb 2017 11:30:03 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1MJQqxO043605; Wed, 22 Feb 2017 14:26:52 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1MJQpfY010197 for ; Wed, 22 Feb 2017 14:26:51 -0500 Received: from localhost (ovpn-116-33.gru2.redhat.com [10.97.116.33]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1MJQotI027448; Wed, 22 Feb 2017 14:26:51 -0500 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Wed, 22 Feb 2017 16:26:47 -0300 Message-Id: <20170222192647.19690-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: "Michael S. Tsirkin" , libvir-list@redhat.com, Laine Stump , Igor Mammedov , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [libvirt] [PATCH RESEND] qdev: Make "hotplugged" property read-only X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The "hotplugged" property is user visible, but it was never meant to be set by the user. There are probably multiple ways to break or crash device code by overriding the property. For example, we recently fixed a crash in rtc_set_memory() related to the property (commit 26ef65beab852caf2b1ef4976e3473f2d525164d). There has been some discussion about making management software use "hotplugged=3Don" on migration, to indicate devices that were hotplugged in the migration source. There were other suggestions to address this, like including the "hotplugged" field in the migration stream instead of requiring it to be set propertly. Whatever solution we choose in the future, this patch disables setting "hotplugged" explicitly in the command-line by now, because the ability to set the property is unused, untested, and undocumented. Signed-off-by: Eduardo Habkost Reviewed-by: Eric Blake --- hw/core/qdev.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 06ba02e2a3..800c9ca23f 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -1016,13 +1016,6 @@ static bool device_get_hotplugged(Object *obj, Error= **err) return dev->hotplugged; } =20 -static void device_set_hotplugged(Object *obj, bool value, Error **err) -{ - DeviceState *dev =3D DEVICE(obj); - - dev->hotplugged =3D value; -} - static void device_initfn(Object *obj) { DeviceState *dev =3D DEVICE(obj); @@ -1042,7 +1035,7 @@ static void device_initfn(Object *obj) object_property_add_bool(obj, "hotpluggable", device_get_hotpluggable, NULL, NULL); object_property_add_bool(obj, "hotplugged", - device_get_hotplugged, device_set_hotplugged, + device_get_hotplugged, NULL, &error_abort); =20 class =3D object_get_class(OBJECT(dev)); --=20 2.11.0.259.g40922b1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list