From nobody Tue Feb 10 11:56:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15535347216191015.5351578964945; Mon, 25 Mar 2019 10:25:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF67630FE5B9; Mon, 25 Mar 2019 17:25:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAA6064294; Mon, 25 Mar 2019 17:25:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 60FFA3FA48; Mon, 25 Mar 2019 17:25:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2PHOiD7029803 for ; Mon, 25 Mar 2019 13:24:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35D3F64294; Mon, 25 Mar 2019 17:24:44 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-122.phx2.redhat.com [10.3.116.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id D110987B4; Mon, 25 Mar 2019 17:24:43 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Mon, 25 Mar 2019 13:24:24 -0400 Message-Id: <20190325172436.17069-3-laine@laine.org> In-Reply-To: <20190325172436.17069-1-laine@laine.org> References: <20190325172436.17069-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 02/14] qemu_hotplug: remove extra function in middle of DetachController call chain 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 25 Mar 2019 17:25:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemuDomainDetachDeviceControllerLive() just checks if the controller type is SCSI, and then either returns failure, or calls qemuDomainDetachControllerDevice(). Instead, lets just check for type !=3D SCSI at the top of the latter function, and call it directly. Signed-off-by: Laine Stump --- Change from V1: remove unrelated code movement, per Peter's request. src/qemu/qemu_hotplug.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7be0f341b7..666657758e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5548,6 +5548,13 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPt= r driver, int idx, ret =3D -1; virDomainControllerDefPtr detach =3D NULL; =20 + if (dev->data.controller->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("'%s' controller cannot be hot unplugged."), + virDomainControllerTypeToString(dev->data.controlle= r->type)); + return -1; + } + if ((idx =3D virDomainControllerFind(vm->def, dev->data.controller->type, dev->data.controller->idx)) < 0) { @@ -6190,27 +6197,6 @@ qemuDomainDetachLease(virQEMUDriverPtr driver, } =20 =20 -static int -qemuDomainDetachDeviceControllerLive(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virDomainDeviceDefPtr dev, - bool async) -{ - virDomainControllerDefPtr cont =3D dev->data.controller; - int ret =3D -1; - - switch (cont->type) { - case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: - ret =3D qemuDomainDetachControllerDevice(driver, vm, dev, async); - break; - default : - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("'%s' controller cannot be hot unplugged."), - virDomainControllerTypeToString(cont->type)); - } - return ret; -} - int qemuDomainDetachDeviceLive(virDomainObjPtr vm, virDomainDeviceDefPtr dev, @@ -6224,7 +6210,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, ret =3D qemuDomainDetachDeviceDiskLive(driver, vm, dev, async); break; case VIR_DOMAIN_DEVICE_CONTROLLER: - ret =3D qemuDomainDetachDeviceControllerLive(driver, vm, dev, asyn= c); + ret =3D qemuDomainDetachControllerDevice(driver, vm, dev, async); break; case VIR_DOMAIN_DEVICE_LEASE: ret =3D qemuDomainDetachLease(driver, vm, dev->data.lease); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list