From nobody Thu May 15 01:53:45 2025 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 1517353543140554.8517775240084; Tue, 30 Jan 2018 15:05:43 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BAC1776D0; Tue, 30 Jan 2018 23:05:39 +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 24B295D75F; Tue, 30 Jan 2018 23:05:39 +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 E0E5F5FBE2; Tue, 30 Jan 2018 23:05:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0UN5GeD006235 for ; Tue, 30 Jan 2018 18:05:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F5F55C20B; Tue, 30 Jan 2018 23:05:16 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-232.phx2.redhat.com [10.3.116.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CFEA5C261 for ; Tue, 30 Jan 2018 23:05:15 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 30 Jan 2018 18:04:59 -0500 Message-Id: <20180130230503.3820-6-jferlan@redhat.com> In-Reply-To: <20180130230503.3820-1-jferlan@redhat.com> References: <20180130230503.3820-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/9] qemu: Fetch/save the default SCSI controller model during hotplug 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 30 Jan 2018 23:05:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If we're going to add a controller to the domain, let's set the default SCSI model value if we cannot find another SCSI controller already present. NB: Requires updating the live output test data since the model will now be formatted. Signed-off-by: John Ferlan --- src/qemu/qemu_hotplug.c | 8 ++++= ++-- .../qemuhotplug-base-with-scsi-controller-live.xml | 8 ++++= ---- .../qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml | 8 ++++= ---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 6b245bd6a..fccbc29a0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -587,6 +587,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverP= tr driver, { size_t i; virDomainControllerDefPtr cont; + qemuDomainObjPrivatePtr priv =3D vm->privateData; int model =3D -1; =20 for (i =3D 0; i < vm->def->ncontrollers; i++) { @@ -615,10 +616,13 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDrive= rPtr driver, return NULL; cont->type =3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI; cont->idx =3D controller; - cont->model =3D model; + if (model =3D=3D -1) + cont->model =3D qemuDomainGetSCSIControllerModel(vm->def, cont, pr= iv->qemuCaps); + else + cont->model =3D model; =20 VIR_INFO("No SCSI controller present, hotplugging one model=3D%s", - virDomainControllerModelSCSITypeToString(model)); + virDomainControllerModelSCSITypeToString(cont->model)); if (qemuDomainAttachControllerDevice(driver, vm, cont) < 0) { VIR_FREE(cont); return NULL; diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-contro= ller-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-con= troller-live.xml index 63eb77007..d23d3d483 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-li= ve.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-li= ve.xml @@ -26,19 +26,19 @@ - +
- +
- +
- +
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-con= troller-live+disk-scsi-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-bas= e-without-scsi-controller-live+disk-scsi-2.xml index c12d18f71..cceb678bb 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller= -live+disk-scsi-2.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller= -live+disk-scsi-2.xml @@ -36,19 +36,19 @@ - +
- +
- +
- +
--=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list