From nobody Thu May 15 01:50:57 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 1517353543540467.2893779867976; Tue, 30 Jan 2018 15:05:43 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3824D4A711; Tue, 30 Jan 2018 23:05:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1202760BE0; Tue, 30 Jan 2018 23:05:42 +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 C638A18033E4; Tue, 30 Jan 2018 23:05:41 +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 w0UN5HxV006251 for ; Tue, 30 Jan 2018 18:05:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 375985C20B; Tue, 30 Jan 2018 23:05:17 +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 EA5715C542 for ; Tue, 30 Jan 2018 23:05:16 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 30 Jan 2018 18:05:01 -0500 Message-Id: <20180130230503.3820-8-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 7/9] conf: Allow configuration of implicit controller model 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 30 Jan 2018 23:05:42 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When an implicit controller is added, the model is defined as -1 (IOW: undefined). So, if an implicit SCSI controller was added, can set the model to the default value if the underlying hypervisor supports it. Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 17 +++++++++++++++++ tests/qemuargv2xmldata/nomachine-ppc64.xml | 2 +- tests/qemuargv2xmldata/pseries-disk.xml | 2 +- tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b39667952..8efe83489 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4924,6 +4924,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def, struct virDomainDefPostParseDeviceIteratorData= *data, virHashTablePtr bootHash) { + size_t i; + /* verify init path for container based domains */ if (def->os.type =3D=3D VIR_DOMAIN_OSTYPE_EXE && !def->os.init) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -4991,6 +4993,21 @@ virDomainDefPostParseCommon(virDomainDefPtr def, return -1; } =20 + /* Implicit SCSI controllers without a defined model might have + * been added in AddImplicitDevices, after we've done the per-device + * post-parse. */ + for (i =3D 0; i < def->ncontrollers; i++) { + if (def->controllers[i]->model =3D=3D -1 && + def->controllers[i]->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SC= SI) { + virDomainDeviceDef device =3D { + .type =3D VIR_DOMAIN_DEVICE_CONTROLLER, + .data.controller =3D def->controllers[i], + }; + if (virDomainDefPostParseDeviceIterator(def, &device, NULL, da= ta) < 0) + return -1; + } + } + /* clean up possibly duplicated metadata entries */ virXMLNodeSanitizeNamespaces(def->metadata); =20 diff --git a/tests/qemuargv2xmldata/nomachine-ppc64.xml b/tests/qemuargv2xm= ldata/nomachine-ppc64.xml index fa41070cb..439f9e9ac 100644 --- a/tests/qemuargv2xmldata/nomachine-ppc64.xml +++ b/tests/qemuargv2xmldata/nomachine-ppc64.xml @@ -33,7 +33,7 @@ - +
diff --git a/tests/qemuargv2xmldata/pseries-disk.xml b/tests/qemuargv2xmlda= ta/pseries-disk.xml index 601d0f7f6..1f15a950e 100644 --- a/tests/qemuargv2xmldata/pseries-disk.xml +++ b/tests/qemuargv2xmldata/pseries-disk.xml @@ -34,7 +34,7 @@ - +
diff --git a/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml b/tests/qem= uxml2xmloutdata/disk-scsi-device-auto.xml index dde374590..a0db32b56 100644 --- a/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml +++ b/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml @@ -31,7 +31,7 @@
- +
--=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list