From nobody Mon Apr 29 07:21:07 2024 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 1515196303773813.5840436951463; Fri, 5 Jan 2018 15:51: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 72B4DC01FA91; Fri, 5 Jan 2018 23:51:42 +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 44B4960C4A; Fri, 5 Jan 2018 23:51: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 0FE96410B5; Fri, 5 Jan 2018 23:51:42 +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 w05NljXA013883 for ; Fri, 5 Jan 2018 18:47:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id AD2B75C261; Fri, 5 Jan 2018 23:47:45 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 627625C258 for ; Fri, 5 Jan 2018 23:47:45 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:24 -0500 Message-Id: <20180105234739.508-2-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 01/16] qemu: Split qemuDomainSetSCSIControllerModel 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.31]); Fri, 05 Jan 2018 23:51:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rather than one function serving two purposes, let's split things up into qemuDomainResetSCSIControllerModel for all current callers and then add qemuDomainCheckSCSIControllerModel when building the controller command line to check the capabilities. Signed-off-by: John Ferlan --- src/qemu/qemu_alias.c | 4 +-- src/qemu/qemu_command.c | 62 ++++++++++++++++++++++++++++++++--- src/qemu/qemu_domain_address.c | 74 +++++++++-----------------------------= ---- src/qemu/qemu_domain_address.h | 6 ++-- 4 files changed, 79 insertions(+), 67 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 37fe2aa80..b65276dd9 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -194,8 +194,8 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def, virDomainDeviceFindControllerModel(def, &disk->info, VIR_DOMAIN_CONTROLLER_T= YPE_SCSI); =20 - if ((qemuDomainSetSCSIControllerModel(def, qemuCaps, - &controllerModel)) < 0) + if ((qemuDomainResetSCSIControllerModel(def, qemuCaps, + &controllerModel)) < 0) return -1; } =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b8aede32d..5c084ae8c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1888,6 +1888,57 @@ qemuCheckIOThreads(const virDomainDef *def, } =20 =20 +static bool +qemuBuildCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, + int model) +{ + switch (model) { + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI 53C895A SCSI controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "virtio scsi controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: + /*TODO: need checking work here if necessary */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI SAS1068 (MPT Fusion) controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MEGASAS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI SAS1078 (MegaRAID) controller")); + return false; + } + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller model: %s"), + virDomainControllerModelSCSITypeToString(model)); + return false; + } + + return true; +} + + char * qemuBuildDriveDevStr(const virDomainDef *def, virDomainDiskDefPtr disk, @@ -1983,8 +2034,8 @@ qemuBuildDriveDevStr(const virDomainDef *def, controllerModel =3D virDomainDeviceFindControllerModel(def, &disk->info, VIR_DOMAIN_CONTROLLER_TYPE_= SCSI); - if ((qemuDomainSetSCSIControllerModel(def, qemuCaps, - &controllerModel)) < 0) + if ((qemuDomainResetSCSIControllerModel(def, qemuCaps, + &controllerModel)) < 0) goto error; =20 if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { @@ -2663,7 +2714,10 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, *devstr =3D NULL; =20 if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - if ((qemuDomainSetSCSIControllerModel(domainDef, qemuCaps, &model)= ) < 0) + if ((qemuDomainResetSCSIControllerModel(domainDef, qemuCaps, &mode= l)) < 0) + return -1; + + if (!qemuBuildCheckSCSIControllerModel(qemuCaps, model)) return -1; } =20 @@ -5084,7 +5138,7 @@ qemuBuildSCSIHostdevDevStr(const virDomainDef *def, model =3D virDomainDeviceFindControllerModel(def, dev->info, VIR_DOMAIN_CONTROLLER_TYPE_= SCSI); =20 - if (qemuDomainSetSCSIControllerModel(def, qemuCaps, &model) < 0) + if (qemuDomainResetSCSIControllerModel(def, qemuCaps, &model) < 0) goto error; =20 if (model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) { diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 6e7561d39..e3c1760d8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -41,65 +41,23 @@ VIR_LOG_INIT("qemu.qemu_domain_address"); =20 =20 int -qemuDomainSetSCSIControllerModel(const virDomainDef *def, - virQEMUCapsPtr qemuCaps, - int *model) +qemuDomainResetSCSIControllerModel(const virDomainDef *def, + virQEMUCapsPtr qemuCaps, + int *model) { - if (*model > 0) { - switch (*model) { - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI 53C895A SCSI controller")); - return -1; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "virtio scsi controller")); - return -1; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: - /*TODO: need checking work here if necessary */ - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI SAS1068 (MPT Fusion) controller"= )); - return -1; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MEGASAS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI SAS1078 (MegaRAID) controller")); - return -1; - } - break; - default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported controller model: %s"), - virDomainControllerModelSCSITypeToString(*model= )); - return -1; - } + if (*model > 0) + return 0; + + if (qemuDomainIsPSeries(def)) { + *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { + *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { + *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI; } else { - if (qemuDomainIsPSeries(def)) { - *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI; - } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { - *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC; - } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { - *model =3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI; - } else { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to determine model for scsi controlle= r")); - return -1; - } + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to determine model for scsi controller")); + return -1; } =20 return 0; @@ -230,7 +188,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def, =20 model =3D cont->model; if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { - if (qemuDomainSetSCSIControllerModel(def, qemuCaps, &model) < = 0) + if (qemuDomainResetSCSIControllerModel(def, qemuCaps, &model) = < 0) goto cleanup; } =20 diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h index e951a4c88..5a2cbe39d 100644 --- a/src/qemu/qemu_domain_address.h +++ b/src/qemu/qemu_domain_address.h @@ -28,9 +28,9 @@ # include "qemu_conf.h" # include "qemu_capabilities.h" =20 -int qemuDomainSetSCSIControllerModel(const virDomainDef *def, - virQEMUCapsPtr qemuCaps, - int *model); +int qemuDomainResetSCSIControllerModel(const virDomainDef *def, + virQEMUCapsPtr qemuCaps, + int *model); =20 int qemuDomainAssignAddresses(virDomainDefPtr def, virQEMUCapsPtr qemuCaps, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196306847283.7352545715911; Fri, 5 Jan 2018 15:51:46 -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 7F01DBDCC; Fri, 5 Jan 2018 23:51:45 +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 588DF5D6A6; Fri, 5 Jan 2018 23:51:45 +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 226F33FC71; Fri, 5 Jan 2018 23:51:45 +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 w05NlkAc013888 for ; Fri, 5 Jan 2018 18:47:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 178BB5C261; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2D055C258 for ; Fri, 5 Jan 2018 23:47:45 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:25 -0500 Message-Id: <20180105234739.508-3-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 02/16] qemu: Introduce qemuDomainDeviceDefValidateControllerAttributes 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.29]); Fri, 05 Jan 2018 23:51:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the checks that various attributes are not set on any controller other than SCSI controller using virtio-scsi model into the common controller validate checks. Need to also add a qemuDomainResetSCSIControllerModel call in order to ensure we get the "right" SCSI model if it's not set by default since it wouldn't be set during post parse processing. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 24 ------------------------ src/qemu/qemu_domain.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5c084ae8c..1a9249e1b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2721,30 +2721,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, return -1; } =20 - if (!(def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI && - model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) { - if (def->queues) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'queues' is only supported by virtio-scsi co= ntroller")); - return -1; - } - if (def->cmd_per_lun) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'cmd_per_lun' is only supported by virtio-sc= si controller")); - return -1; - } - if (def->max_sectors) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'max_sectors' is only supported by virtio-sc= si controller")); - return -1; - } - if (def->ioeventfd) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("'ioeventfd' is only supported by virtio-scsi= controller")); - return -1; - } - } - switch ((virDomainControllerType) def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch (model) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index de46ab996..1a890c01a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3941,6 +3941,38 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskD= ef *disk) =20 =20 static int +qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerD= ef *controller, + int model) +{ + if (!(controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI && + model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) { + if (controller->queues) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'queues' is only supported by virtio-scsi co= ntroller")); + return -1; + } + if (controller->cmd_per_lun) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'cmd_per_lun' is only supported by virtio-sc= si controller")); + return -1; + } + if (controller->max_sectors) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'max_sectors' is only supported by virtio-sc= si controller")); + return -1; + } + if (controller->ioeventfd) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'ioeventfd' is only supported by virtio-scsi= controller")); + return -1; + } + } + + return 0; +} + + +static int qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *con= troller, const virDomainDef *def) { @@ -3972,11 +4004,20 @@ qemuDomainDeviceDefValidateController(const virDoma= inControllerDef *controller, virQEMUCapsPtr qemuCaps) { int ret =3D 0; + int model =3D controller->model; =20 if (!qemuDomainCheckCCWS390AddressSupport(def, controller->info, qemuC= aps, "controller")) return -1; =20 + if (controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + if ((qemuDomainResetSCSIControllerModel(def, qemuCaps, &model)) < = 0) + return -1; + } + + if (qemuDomainDeviceDefValidateControllerAttributes(controller, model)= < 0) + return -1; + switch ((virDomainControllerType) controller->type) { case VIR_DOMAIN_CONTROLLER_TYPE_IDE: ret =3D qemuDomainDeviceDefValidateControllerIDE(controller, def); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196309822615.122080967564; Fri, 5 Jan 2018 15:51:49 -0800 (PST) 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 698A7780DA; Fri, 5 Jan 2018 23:51:48 +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 239615DC19; Fri, 5 Jan 2018 23:51:48 +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 C771C18033DB; Fri, 5 Jan 2018 23:51:47 +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 w05Nlk6M013894 for ; Fri, 5 Jan 2018 18:47:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 732555C261; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A43E5C258 for ; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:26 -0500 Message-Id: <20180105234739.508-4-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 03/16] qemu: Move and rename qemuBuildCheckSCSIControllerModel 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 05 Jan 2018 23:51:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move to qemu_domain during the validation of controller options and rename qemuDomainCheckSCSIControllerModel. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 54 ---------------------------------------------= ---- src/qemu/qemu_domain.c | 54 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1a9249e1b..0583f8fec 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1888,57 +1888,6 @@ qemuCheckIOThreads(const virDomainDef *def, } =20 =20 -static bool -qemuBuildCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, - int model) -{ - switch (model) { - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI 53C895A SCSI controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "virtio scsi controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: - /*TODO: need checking work here if necessary */ - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI SAS1068 (MPT Fusion) controller")); - return false; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MEGASAS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support " - "the LSI SAS1078 (MegaRAID) controller")); - return false; - } - break; - default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported controller model: %s"), - virDomainControllerModelSCSITypeToString(model)); - return false; - } - - return true; -} - - char * qemuBuildDriveDevStr(const virDomainDef *def, virDomainDiskDefPtr disk, @@ -2716,9 +2665,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { if ((qemuDomainResetSCSIControllerModel(domainDef, qemuCaps, &mode= l)) < 0) return -1; - - if (!qemuBuildCheckSCSIControllerModel(qemuCaps, model)) - return -1; } =20 switch ((virDomainControllerType) def->type) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1a890c01a..a253d4708 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3972,6 +3972,57 @@ qemuDomainDeviceDefValidateControllerAttributes(cons= t virDomainControllerDef *co } =20 =20 +static bool +qemuDomainCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps, + int model) +{ + switch (model) { + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI 53C895A SCSI controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "virtio scsi controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: + /*TODO: need checking work here if necessary */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MPTSAS1068)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI SAS1068 (MPT Fusion) controller")); + return false; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_MEGASAS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support " + "the LSI SAS1078 (MegaRAID) controller")); + return false; + } + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller model: %s"), + virDomainControllerModelSCSITypeToString(model)); + return false; + } + + return true; +} + + static int qemuDomainDeviceDefValidateControllerIDE(const virDomainControllerDef *con= troller, const virDomainDef *def) @@ -4013,6 +4064,9 @@ qemuDomainDeviceDefValidateController(const virDomain= ControllerDef *controller, if (controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { if ((qemuDomainResetSCSIControllerModel(def, qemuCaps, &model)) < = 0) return -1; + + if (!qemuDomainCheckSCSIControllerModel(qemuCaps, model)) + return -1; } =20 if (qemuDomainDeviceDefValidateControllerAttributes(controller, model)= < 0) --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196312484659.8547596028955; Fri, 5 Jan 2018 15:51:52 -0800 (PST) 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 361C5C056861; Fri, 5 Jan 2018 23:51:51 +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 0B41117C5E; Fri, 5 Jan 2018 23:51:51 +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 C5D7918033DE; Fri, 5 Jan 2018 23:51:50 +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 w05NlkVi013903 for ; Fri, 5 Jan 2018 18:47:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id CE8FC5C261; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 964A85C258 for ; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:27 -0500 Message-Id: <20180105234739.508-5-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 04/16] qemu: Move model set for qemuBuildControllerDevStr 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 05 Jan 2018 23:51:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We can move the @model reset inside the switch case for VIR_DOMAIN_CONTROLLER_TYPE_SCSI since it is the only case that uses an altered model name. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0583f8fec..b955fb66e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2662,13 +2662,11 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, =20 *devstr =3D NULL; =20 - if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + switch ((virDomainControllerType) def->type) { + case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: if ((qemuDomainResetSCSIControllerModel(domainDef, qemuCaps, &mode= l)) < 0) return -1; - } =20 - switch ((virDomainControllerType) def->type) { - case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: switch (model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196202773548.7878954876384; Fri, 5 Jan 2018 15:50:02 -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 6FB49356CD; Fri, 5 Jan 2018 23:50:00 +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 579795D6A6; Fri, 5 Jan 2018 23:49:59 +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 A2F3D18033D9; Fri, 5 Jan 2018 23:49:56 +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 w05Nlli4013909 for ; Fri, 5 Jan 2018 18:47:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 344135C261; Fri, 5 Jan 2018 23:47:47 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id F11F55C258 for ; Fri, 5 Jan 2018 23:47:46 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:28 -0500 Message-Id: <20180105234739.508-6-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 05/16] qemu: Adjust SCSI controller switch in qemuBuildControllerDevStr 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.30]); Fri, 05 Jan 2018 23:50:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Modify the SCSI controller switch during command line building to account for all virDomainControllerModelSCSI types rather than using the default label. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b955fb66e..515206261 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2667,7 +2667,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, if ((qemuDomainResetSCSIControllerModel(domainDef, qemuCaps, &mode= l)) < 0) return -1; =20 - switch (model) { + switch ((virDomainControllerModelSCSI) model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { virBufferAddLit(&buf, "virtio-scsi-ccw"); @@ -2707,7 +2707,10 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: virBufferAddLit(&buf, "megasas"); break; - default: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported controller model: %s"), virDomainControllerModelSCSITypeToString(def->m= odel)); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196315505566.4025523046855; Fri, 5 Jan 2018 15:51:55 -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 1328D83F46; Fri, 5 Jan 2018 23:51:54 +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 DB85C5D6A6; Fri, 5 Jan 2018 23:51:53 +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 A46E13FC75; Fri, 5 Jan 2018 23:51:53 +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 w05Nllng013914 for ; Fri, 5 Jan 2018 18:47:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 905315C261; Fri, 5 Jan 2018 23:47:47 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57A565C258 for ; Fri, 5 Jan 2018 23:47:47 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:29 -0500 Message-Id: <20180105234739.508-7-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 06/16] qemu: Add check for iothread attribute in validate controller 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]); Fri, 05 Jan 2018 23:51:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Let's make sure that non SCSI virtio-scsi isn't used for any type other than a virtio-scsi controller. This includes removing the check from qemuCheckSCSIControllerIOThreads which is a very suble difference because although def->model was used in the original comparison and just @model is used in the new comparison, the comparison is the same. This is because qemuDomainSetSCSIControllerModel doesn't change the def->model, thus we know that the resultant @model would result in either the same as input or if not set, whatever the default model is when def->model =3D=3D -1. In this second case, virtio-scsi is the last default chosen. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 8 -------- src/qemu/qemu_domain.c | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 515206261..732c720b0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2601,14 +2601,6 @@ qemuCheckSCSIControllerIOThreads(const virDomainDef = *domainDef, if (!def->iothread) return true; =20 - if (def->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("IOThreads only supported for virtio-scsi " - "controllers model is '%s'"), - virDomainControllerModelSCSITypeToString(def->model= )); - return false; - } - if (def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a253d4708..f60c6540e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3966,6 +3966,11 @@ qemuDomainDeviceDefValidateControllerAttributes(cons= t virDomainControllerDef *co _("'ioeventfd' is only supported by virtio-scsi= controller")); return -1; } + if (controller->iothread) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'iothread' is only supported for virtio-scsi= controller")); + return -1; + } } =20 return 0; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196224743545.3439603471372; Fri, 5 Jan 2018 15:50:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28552C052455; Fri, 5 Jan 2018 23:50:23 +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 C3C536090A; Fri, 5 Jan 2018 23:50:22 +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 5E9E84ED36; Fri, 5 Jan 2018 23:50:22 +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 w05NllIg013919 for ; Fri, 5 Jan 2018 18:47:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id EBA005C261; Fri, 5 Jan 2018 23:47:47 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2D7B5C258 for ; Fri, 5 Jan 2018 23:47:47 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:30 -0500 Message-Id: <20180105234739.508-8-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 07/16] qemu: Introduce qemuDomainDeviceDefValidateControllerSCSI 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 05 Jan 2018 23:50:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move SCSI validation from qemu_command into qemu_domain. Rename/reorder the args in qemuCheckSCSIControllerIOThreads to match the caller as well as fixing up the comments to remove the previously removed qemuCaps arg. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 48 ++-------------------------------- src/qemu/qemu_domain.c | 68 +++++++++++++++++++++++++++++++++++++++++++++= +++- 2 files changed, 69 insertions(+), 47 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 732c720b0..45c244c15 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2583,44 +2583,6 @@ qemuBuildUSBControllerDevStr(virDomainControllerDefP= tr def, } =20 =20 -/* qemuCheckSCSIControllerIOThreads: - * @domainDef: Pointer to domain def - * @def: Pointer to controller def - * @qemuCaps: Capabilities - * - * If this controller definition has iothreads set, let's make sure the - * configuration is right before adding to the command line - * - * Returns true if either supported or there are no iothreads for controll= er; - * otherwise, returns false if configuration is not quite right. - */ -static bool -qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef, - virDomainControllerDefPtr def) -{ - if (!def->iothread) - return true; - - if (def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - def->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("IOThreads only available for virtio pci and " - "virtio ccw controllers")); - return false; - } - - /* Can we find the controller iothread in the iothreadid list? */ - if (!virDomainIOThreadIDFind(domainDef, def->iothread)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("controller iothread '%u' not defined in iothread= id"), - def->iothread); - return false; - } - - return true; -} - - /** * qemuBuildControllerDevStr: * @domainDef: domain definition @@ -2663,12 +2625,9 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { virBufferAddLit(&buf, "virtio-scsi-ccw"); - if (def->iothread) { - if (!qemuCheckSCSIControllerIOThreads(domainDef, def)) - goto error; + if (def->iothread) virBufferAsprintf(&buf, ",iothread=3Diothread%u", def->iothread); - } } else if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { virBufferAddLit(&buf, "virtio-scsi-s390"); @@ -2677,12 +2636,9 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, virBufferAddLit(&buf, "virtio-scsi-device"); } else { virBufferAddLit(&buf, "virtio-scsi-pci"); - if (def->iothread) { - if (!qemuCheckSCSIControllerIOThreads(domainDef, def)) - goto error; + if (def->iothread) virBufferAsprintf(&buf, ",iothread=3Diothread%u", def->iothread); - } } if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f60c6540e..507bd2395 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4054,6 +4054,69 @@ qemuDomainDeviceDefValidateControllerIDE(const virDo= mainControllerDef *controlle } =20 =20 +/* qemuDomainCheckSCSIControllerIOThreads: + * @controller: Pointer to controller def + * @def: Pointer to domain def + * + * If this controller definition has iothreads set, let's make sure the + * configuration is right before adding to the command line + * + * Returns true if either supported or there are no iothreads for controll= er; + * otherwise, returns false if configuration is not quite right. + */ +static bool +qemuDomainCheckSCSIControllerIOThreads(const virDomainControllerDef *contr= oller, + const virDomainDef *def) +{ + if (!controller->iothread) + return true; + + if (controller->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + controller->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("IOThreads only available for virtio pci and " + "virtio ccw controllers")); + return false; + } + + /* Can we find the controller iothread in the iothreadid list? */ + if (!virDomainIOThreadIDFind(def, controller->iothread)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("controller iothread '%u' not defined in iothread= id"), + controller->iothread); + return false; + } + + return true; +} + + +static int +qemuDomainDeviceDefValidateControllerSCSI(const virDomainControllerDef *co= ntroller, + int model, + const virDomainDef *def) +{ + switch ((virDomainControllerModelSCSI) model) { + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: + if (!qemuDomainCheckSCSIControllerIOThreads(controller, def)) + return -1; + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078: + case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST: + break; + } + + return 0; +} + + static int qemuDomainDeviceDefValidateController(const virDomainControllerDef *contro= ller, const virDomainDef *def, @@ -4082,8 +4145,11 @@ qemuDomainDeviceDefValidateController(const virDomai= nControllerDef *controller, ret =3D qemuDomainDeviceDefValidateControllerIDE(controller, def); break; =20 - case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: + ret =3D qemuDomainDeviceDefValidateControllerSCSI(controller, mode= l, def); + break; + + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_SATA: case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_CONTROLLER_TYPE_CCID: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196317840223.3207931721863; Fri, 5 Jan 2018 15:51:57 -0800 (PST) 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 93A48C051790; Fri, 5 Jan 2018 23:51:56 +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 69E5B4A4; Fri, 5 Jan 2018 23:51:56 +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 3544A18033DF; Fri, 5 Jan 2018 23:51:56 +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 w05NlmEa013924 for ; Fri, 5 Jan 2018 18:47:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 519385C261; Fri, 5 Jan 2018 23:47:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A3615C258 for ; Fri, 5 Jan 2018 23:47:48 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:31 -0500 Message-Id: <20180105234739.508-9-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 08/16] qemu: Introduce qemuDomainDeviceDefValidateControllerPCI 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 05 Jan 2018 23:51:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move PCI validation checks out of qemu_command into the proper qemu_domain validation helper. Since there's a lot to move, we'll start slow by replicating the pcie-root and pci-root avoidance from qemuBuildSkipController and the first switch found in qemuBuildControllerDevStr. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 20 -------------------- src/qemu/qemu_domain.c | 47 +++++++++++++++++++++++++++++++++++++++++++++= +- 2 files changed, 46 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45c244c15..07830f781 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2720,26 +2720,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, case VIR_DOMAIN_CONTROLLER_TYPE_PCI: switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (def->idx =3D=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("index for pci controllers of model '%s' = must be > 0"), - virDomainControllerModelPCITypeToString(def= ->model)); - goto error; - } - break; - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: - break; - } - switch ((virDomainControllerModelPCI) def->model) { - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: if (def->opts.pciopts.modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || def->opts.pciopts.chassisNr =3D=3D -1) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 507bd2395..df265dc50 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4118,6 +4118,48 @@ qemuDomainDeviceDefValidateControllerSCSI(const virD= omainControllerDef *controll =20 =20 static int +qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *con= troller, + const virDomainDef *def) +{ + virDomainControllerModelPCI model =3D controller->model; + + /* skip pcie-root */ + if (controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) + return 0; + + /* Skip pci-root, except for pSeries guests (which actually + * support more than one PCI Host Bridge per guest) */ + if (!qemuDomainIsPSeries(def) && + controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) + return 0; + + switch (model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + if (controller->idx =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("index for pci controllers of model '%s' must= be > 0"), + virDomainControllerModelPCITypeToString(model)); + return -1; + } + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + + return 0; +} + + +static int qemuDomainDeviceDefValidateController(const virDomainControllerDef *contro= ller, const virDomainDef *def, virQEMUCapsPtr qemuCaps) @@ -4149,12 +4191,15 @@ qemuDomainDeviceDefValidateController(const virDoma= inControllerDef *controller, ret =3D qemuDomainDeviceDefValidateControllerSCSI(controller, mode= l, def); break; =20 + case VIR_DOMAIN_CONTROLLER_TYPE_PCI: + ret =3D qemuDomainDeviceDefValidateControllerPCI(controller, def); + break; + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_SATA: case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_CONTROLLER_TYPE_CCID: case VIR_DOMAIN_CONTROLLER_TYPE_USB: - case VIR_DOMAIN_CONTROLLER_TYPE_PCI: case VIR_DOMAIN_CONTROLLER_TYPE_LAST: break; } --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196275196148.02840490262736; Fri, 5 Jan 2018 15:51:15 -0800 (PST) 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 147EFC051665; Fri, 5 Jan 2018 23:51:14 +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 E241C5C258; Fri, 5 Jan 2018 23:51:13 +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 A368D4ED36; Fri, 5 Jan 2018 23:51:13 +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 w05NlmY0013930 for ; Fri, 5 Jan 2018 18:47:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id AF64E5C261; Fri, 5 Jan 2018 23:47:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74CB15C258 for ; Fri, 5 Jan 2018 23:47:48 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:32 -0500 Message-Id: <20180105234739.508-10-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 09/16] qemu: Add missing checks for pcie-root-port options 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 05 Jan 2018 23:51:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Andrea Bolognani We format the 'chassis' and 'port' properties on the QEMU command line later on, so we should make sure they've been set. Signed-off-by: Andrea Bolognani Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 07830f781..d62531110 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2823,7 +2823,9 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: if (def->opts.pciopts.modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) { + =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || + def->opts.pciopts.chassis =3D=3D -1 || + def->opts.pciopts.port =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-root-port options not= set")); goto error; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196321136308.9179646247684; Fri, 5 Jan 2018 15:52:01 -0800 (PST) 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 BF7EB25BAF; Fri, 5 Jan 2018 23:51:59 +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 7CCCB5D72E; Fri, 5 Jan 2018 23:51:59 +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 2F9BD18033E2; Fri, 5 Jan 2018 23:51:59 +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 w05NlnwM013942 for ; Fri, 5 Jan 2018 18:47:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 27E9B5C261; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id D334C5C258 for ; Fri, 5 Jan 2018 23:47:48 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:33 -0500 Message-Id: <20180105234739.508-11-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 10/16] qemu: Use virDomainPCIControllerOpts in qemuBuildControllerDevStr 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 05 Jan 2018 23:52:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Shorten up a few characters and reference the pciopts pointer Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 118 ++++++++++++++++++++++++--------------------= ---- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d62531110..0175daee3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2612,6 +2612,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, { virBuffer buf =3D VIR_BUFFER_INITIALIZER; int model =3D def->model; + const virDomainPCIControllerOpts *pciopts; const char *modelName =3D NULL; =20 *devstr =3D NULL; @@ -2718,24 +2719,26 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_PCI: + pciopts =3D &def->opts.pciopts; + switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - def->opts.pciopts.chassisNr =3D=3D -1) { + pciopts->chassisNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-bridge options not set= ")); goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pci-bridge model name value %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2750,26 +2753,26 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, goto error; } virBufferAsprintf(&buf, "%s,chassis_nr=3D%d,id=3D%s", - modelName, def->opts.pciopts.chassisNr, + modelName, pciopts->chassisNr, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - def->opts.pciopts.busNr =3D=3D -1) { + pciopts->busNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-expander-bus options n= ot set")); goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pci-expander-bus model name valu= e %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2784,28 +2787,28 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, goto error; } virBufferAsprintf(&buf, "%s,bus_nr=3D%d,id=3D%s", - modelName, def->opts.pciopts.busNr, + modelName, pciopts->busNr, def->info.alias); - if (def->opts.pciopts.numaNode !=3D -1) + if (pciopts->numaNode !=3D -1) virBufferAsprintf(&buf, ",numa_node=3D%d", - def->opts.pciopts.numaNode); + pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated dmi-to-pci-bridge options = not set")); goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown dmi-to-pci-bridge model name val= ue %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2822,24 +2825,23 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - def->opts.pciopts.chassis =3D=3D -1 || - def->opts.pciopts.port =3D=3D -1) { + pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-root-port options not= set")); goto error; } - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pcie-root-port model name value = %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if ((def->opts.pciopts.modelName !=3D + if ((pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && - (def->opts.pciopts.modelName !=3D + (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2847,7 +2849,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, modelName); goto error; } - if ((def->opts.pciopts.modelName =3D=3D + if ((pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2855,7 +2857,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, "controller is not supported in this QEMU= binary")); goto error; } - if ((def->opts.pciopts.modelName =3D=3D + if ((pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2865,24 +2867,24 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, } =20 virBufferAsprintf(&buf, "%s,port=3D0x%x,chassis=3D%d,id=3D%s", - modelName, def->opts.pciopts.port, - def->opts.pciopts.chassis, def->info.alias); + modelName, pciopts->port, + pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-switch-upstream-port = options not set")); goto error; } - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pcie-switch-upstream-port model = name value %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2900,24 +2902,24 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - def->opts.pciopts.chassis =3D=3D -1 || - def->opts.pciopts.port =3D=3D -1) { + pciopts->chassis =3D=3D -1 || + pciopts->port =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-switch-downstream-por= t " "options not set")); goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pcie-switch-downstream-port mode= l name value %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTRE= AM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2933,26 +2935,26 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, goto error; } virBufferAsprintf(&buf, "%s,port=3D0x%x,chassis=3D%d,id=3D%s", - modelName, def->opts.pciopts.port, - def->opts.pciopts.chassis, def->info.alias); + modelName, pciopts->port, + pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (def->opts.pciopts.modelName + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - def->opts.pciopts.busNr =3D=3D -1) { + pciopts->busNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-expander-bus options = not set")); goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pcie-expander-bus model name val= ue %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' " @@ -2967,32 +2969,32 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, goto error; } virBufferAsprintf(&buf, "%s,bus_nr=3D%d,id=3D%s", - modelName, def->opts.pciopts.busNr, + modelName, pciopts->busNr, def->info.alias); - if (def->opts.pciopts.numaNode !=3D -1) + if (pciopts->numaNode !=3D -1) virBufferAsprintf(&buf, ",numa_node=3D%d", - def->opts.pciopts.numaNode); + pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - if (def->opts.pciopts.modelName =3D=3D VIR_DOMAIN_CONTROLLER_P= CI_MODEL_NAME_NONE || - def->opts.pciopts.targetIndex =3D=3D -1) { + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_= NAME_NONE || + pciopts->targetIndex =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-root options not set")= ); goto error; } =20 /* Skip the implicit one */ - if (def->opts.pciopts.targetIndex =3D=3D 0) + if (pciopts->targetIndex =3D=3D 0) goto done; =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown pci-root model name value %d"), - def->opts.pciopts.modelName); + pciopts->modelName); goto error; } - if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI= _MODEL_NAME_SPAPR_PCI_HOST_BRIDGE) { + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NA= ME_SPAPR_PCI_HOST_BRIDGE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' is not va= lid for a pci-root"), modelName); @@ -3005,17 +3007,17 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, goto error; } virBufferAsprintf(&buf, "%s,index=3D%d,id=3D%s", - modelName, def->opts.pciopts.targetIndex, + modelName, pciopts->targetIndex, def->info.alias); =20 - if (def->opts.pciopts.numaNode !=3D -1) { + if (pciopts->numaNode !=3D -1) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPAPR_PCI_HOST_BRI= DGE_NUMA_NODE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the spapr-pci-host-bridge controller= " "doesn't support numa_node on this QE= MU binary")); goto error; } - virBufferAsprintf(&buf, ",numa_node=3D%d", def->opts.pciop= ts.numaNode); + virBufferAsprintf(&buf, ",numa_node=3D%d", pciopts->numaNo= de); } break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196278140868.5728174906155; Fri, 5 Jan 2018 15:51:18 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE6A5802; Fri, 5 Jan 2018 23:51:16 +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 A4A7E60BF3; Fri, 5 Jan 2018 23:51:16 +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 7309F4EE4F; Fri, 5 Jan 2018 23:51:16 +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 w05NlnQF013956 for ; Fri, 5 Jan 2018 18:47:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 86ED65C261; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D2EA5C258 for ; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:34 -0500 Message-Id: <20180105234739.508-12-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 11/16] qemu: Move PCI command modelName check to controller def validate 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 05 Jan 2018 23:51:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the various modelName =3D=3D NAME_NONE from the command line generation into domain controller validation. Also rather than have multiple cases with the same check, let's make the code more generic, but also note that it was the modelName option that caused the failure. We also have to be sure not to check the PCI models that we don't care about. For the remaining checks in command line building, we can use the field name in the error message to be more specific about what causes the failure. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 36 ++++++------------------------------ src/qemu/qemu_domain.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0175daee3..58f6bee3a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2723,9 +2723,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, =20 switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - pciopts->chassisNr =3D=3D -1) { + if (pciopts->chassisNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-bridge options not set= ")); goto error; @@ -2757,9 +2755,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - pciopts->busNr =3D=3D -1) { + if (pciopts->busNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-expander-bus options n= ot set")); goto error; @@ -2794,13 +2790,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated dmi-to-pci-bridge options = not set")); - goto error; - } - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2825,9 +2814,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { + if (pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-root-port options not= set")); goto error; @@ -2871,12 +2858,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pcie-switch-upstream-port = options not set")); - goto error; - } modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -2902,9 +2883,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - pciopts->chassis =3D=3D -1 || + if (pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-switch-downstream-por= t " @@ -2939,9 +2918,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (pciopts->modelName - =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || - pciopts->busNr =3D=3D -1) { + if (pciopts->busNr =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pcie-expander-bus options = not set")); goto error; @@ -2976,8 +2953,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_= NAME_NONE || - pciopts->targetIndex =3D=3D -1) { + if (pciopts->targetIndex =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("autogenerated pci-root options not set")= ); goto error; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index df265dc50..eb533f4b7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4122,6 +4122,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDom= ainControllerDef *controlle const virDomainDef *def) { virDomainControllerModelPCI model =3D controller->model; + const virDomainPCIControllerOpts *pciopts; =20 /* skip pcie-root */ if (controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) @@ -4155,6 +4156,17 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle break; } =20 + pciopts =3D &controller->opts.pciopts; + if (controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT && + controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST) { + if (pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME= _NONE) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("autogenerated %s options not set"), + virDomainControllerModelPCITypeToString(control= ler->model)); + return -1; + } + } + return 0; } =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196228865741.8739656097912; Fri, 5 Jan 2018 15:50:28 -0800 (PST) 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 9F2A3C057F9F; Fri, 5 Jan 2018 23:50:27 +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 71F785C258; Fri, 5 Jan 2018 23:50:27 +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 39C4118033DB; Fri, 5 Jan 2018 23:50:27 +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 w05NlnTx013968 for ; Fri, 5 Jan 2018 18:47:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id E160A5C261; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id A95715C258 for ; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:35 -0500 Message-Id: <20180105234739.508-13-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 12/16] qemu: Move PCI command modelName TypeToString to controller def validate 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 05 Jan 2018 23:50:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similar to the checking the modelName vs. NAME_NONE, let's make the ModelNameTypeToString check more generic too within the checking done in controller validation (with the same ignore certain models. NB: We need to keep the ModelNameTypeToString fetch in command line validation since we use it, but at least we can assume it returns something valid now. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 59 +++------------------------------------------= ---- src/qemu/qemu_domain.c | 10 +++++++++ 2 files changed, 13 insertions(+), 56 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 58f6bee3a..4a5d37f5d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2720,6 +2720,9 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, =20 case VIR_DOMAIN_CONTROLLER_TYPE_PCI: pciopts =3D &def->opts.pciopts; + if (def->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT && + def->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST) + modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); =20 switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: @@ -2729,13 +2732,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pci-bridge model name value %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2761,13 +2757,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pci-expander-bus model name valu= e %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2790,13 +2779,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown dmi-to-pci-bridge model name val= ue %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2819,13 +2801,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, _("autogenerated pcie-root-port options not= set")); goto error; } - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pcie-root-port model name value = %d"), - pciopts->modelName); - goto error; - } if ((pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && (pciopts->modelName !=3D @@ -2858,13 +2833,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pcie-switch-upstream-port model = name value %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2891,13 +2859,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pcie-switch-downstream-port mode= l name value %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTRE= AM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2924,13 +2885,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, goto error; } =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pcie-expander-bus model name val= ue %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2963,13 +2917,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, if (pciopts->targetIndex =3D=3D 0) goto done; =20 - modelName =3D virDomainControllerPCIModelNameTypeToString(pcio= pts->modelName); - if (!modelName) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown pci-root model name value %d"), - pciopts->modelName); - goto error; - } if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NA= ME_SPAPR_PCI_HOST_BRIDGE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller model name '%s' is not va= lid for a pci-root"), diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index eb533f4b7..082f1124c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4123,6 +4123,7 @@ qemuDomainDeviceDefValidateControllerPCI(const virDom= ainControllerDef *controlle { virDomainControllerModelPCI model =3D controller->model; const virDomainPCIControllerOpts *pciopts; + const char *modelName =3D NULL; =20 /* skip pcie-root */ if (controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) @@ -4165,6 +4166,15 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle virDomainControllerModelPCITypeToString(control= ler->model)); return -1; } + + modelName =3D virDomainControllerPCIModelNameTypeToString(pciopts-= >modelName); + if (!modelName) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown %s modelName value %d"), + virDomainControllerModelPCITypeToString(control= ler->model), + pciopts->modelName); + return -1; + } } =20 return 0; --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196281327714.986821679591; Fri, 5 Jan 2018 15:51:21 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9211B78238; Fri, 5 Jan 2018 23:51:19 +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 402626090A; Fri, 5 Jan 2018 23:51:19 +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 081E8410AD; Fri, 5 Jan 2018 23:51:19 +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 w05NloXe013979 for ; Fri, 5 Jan 2018 18:47:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 48BC95C261; Fri, 5 Jan 2018 23:47:50 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FA175C258 for ; Fri, 5 Jan 2018 23:47:49 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:36 -0500 Message-Id: <20180105234739.508-14-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 13/16] qemu: Move PCI more command checks to controller def validate 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 Jan 2018 23:51:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Excluding the qemuCaps checks, move the remainder of the checks that validate whether the PCI definition is valid or not into qemuDomainControllerDefValidatePCI. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 101 ----------------------------------- src/qemu/qemu_domain.c | 139 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 139 insertions(+), 101 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4a5d37f5d..0dbc73399 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2726,20 +2726,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, =20 switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - if (pciopts->chassisNr =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pci-bridge options not set= ")); - goto error; - } - - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pci-bridge"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the pci-bridge controller " @@ -2751,20 +2737,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - if (pciopts->busNr =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pci-expander-bus options n= ot set")); - goto error; - } - - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pci-expander-bus"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the pxb controller " @@ -2779,14 +2751,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I82801B11_BRIDGE= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a dmi-to-pci-bridge"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRID= GE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the dmi-to-pci-bridge (i82801b11-bridge)= " @@ -2796,21 +2760,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - if (pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pcie-root-port options not= set")); - goto error; - } - if ((pciopts->modelName !=3D - VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && - (pciopts->modelName !=3D - VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pcie-root-port"), - modelName); - goto error; - } if ((pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) { @@ -2833,14 +2782,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X3130_UPSTREAM) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pcie-switch-upstream-= port"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_X3130_UPSTREAM)= ) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the pcie-switch-upstream-port (x3130-ups= tream) " @@ -2851,22 +2792,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - if (pciopts->chassis =3D=3D -1 || - pciopts->port =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pcie-switch-downstream-por= t " - "options not set")); - goto error; - } - - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTRE= AM) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pcie-switch-downstrea= m-port"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_XIO3130_DOWNSTR= EAM)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("The pcie-switch-downstream-port " @@ -2879,20 +2804,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (pciopts->busNr =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pcie-expander-bus options = not set")); - goto error; - } - - if (pciopts->modelName - !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' " - "is not valid for a pcie-expander-bus"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB_PCIE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the pxb-pcie controller " @@ -2907,22 +2818,10 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - if (pciopts->targetIndex =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("autogenerated pci-root options not set")= ); - goto error; - } - /* Skip the implicit one */ if (pciopts->targetIndex =3D=3D 0) goto done; =20 - if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NA= ME_SPAPR_PCI_HOST_BRIDGE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("PCI controller model name '%s' is not va= lid for a pci-root"), - modelName); - goto error; - } if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_= BRIDGE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("the spapr-pci-host-bridge controller " diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 082f1124c..8cbb29e40 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4135,6 +4135,8 @@ qemuDomainDeviceDefValidateControllerPCI(const virDom= ainControllerDef *controlle controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) return 0; =20 + /* First pass - just check the controller index for the model's + * that we care to check... */ switch (model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: @@ -4177,6 +4179,143 @@ qemuDomainDeviceDefValidateControllerPCI(const virD= omainControllerDef *controlle } } =20 + /* Second pass - now the model specific checks */ + switch (model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + if (pciopts->chassisNr =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pci-bridge options not set")); + return -1; + } + + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_P= CI_BRIDGE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pci-bridge"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + if (pciopts->busNr =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pci-expander-bus options not s= et")); + return -1; + } + + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_P= XB) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pci-expander-bus"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_I= 82801B11_BRIDGE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a dmi-to-pci-bridge"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + if (pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pcie-root-port options not set= ")); + return -1; + } + + if ((pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_= IOH3420) && + (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_= PCIE_ROOT_PORT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pcie-root-port"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X= 3130_UPSTREAM) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pcie-switch-upstream-port"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + if (pciopts->chassis =3D=3D -1 || pciopts->port =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pcie-switch-downstream-port " + "options not set")); + return -1; + } + + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_X= IO3130_DOWNSTREAM) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pcie-switch-downstream-port"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + if (pciopts->busNr =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pcie-expander-bus options not = set")); + return -1; + } + + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_P= XB_PCIE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pcie-expander-bus"), + modelName); + return -1; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (pciopts->targetIndex =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pci-root options not set")); + return -1; + } + + /* Skip the implicit one */ + if (pciopts->targetIndex =3D=3D 0) + return 0; + + if (pciopts->modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_S= PAPR_PCI_HOST_BRIDGE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not valid " + "for a pci-root"), + modelName); + return 0; + } + + break; + + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + return 0; } =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196232176872.4099671902737; Fri, 5 Jan 2018 15:50:32 -0800 (PST) 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 6FDEBB0ADB; Fri, 5 Jan 2018 23:50:30 +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 44F375D724; Fri, 5 Jan 2018 23:50:30 +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 0B9554ED38; Fri, 5 Jan 2018 23:50:30 +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 w05Nloqj013986 for ; Fri, 5 Jan 2018 18:47:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7F3F5C261; Fri, 5 Jan 2018 23:47:50 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E9965C258 for ; Fri, 5 Jan 2018 23:47:50 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:37 -0500 Message-Id: <20180105234739.508-15-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 14/16] qemu: Complete PCI command checks to controller def validate 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 05 Jan 2018 23:50:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the qemuCaps checks over to qemuDomainControllerDefValidatePCI. This requires two test updates in order to set the correct capability bit for an xml2xml test as well as setting up the similar capability for the pseries memlocktest. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 70 +------------------------------------------ src/qemu/qemu_domain.c | 80 +++++++++++++++++++++++++++++++++++++++++++++= ++-- tests/qemumemlocktest.c | 14 +++++++++ tests/qemuxml2xmltest.c | 5 +++- 4 files changed, 97 insertions(+), 72 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0dbc73399..7a138f921 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2726,23 +2726,11 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, =20 switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pci-bridge controller " - "is not supported in this QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "%s,chassis_nr=3D%d,id=3D%s", modelName, pciopts->chassisNr, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pxb controller " - "is not supported in this QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "%s,bus_nr=3D%d,id=3D%s", modelName, pciopts->busNr, def->info.alias); @@ -2751,65 +2739,22 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, pciopts->numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRID= GE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the dmi-to-pci-bridge (i82801b11-bridge)= " - "controller is not supported in this QEMU= binary")); - goto error; - } virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - if ((pciopts->modelName =3D=3D - VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pcie-root-port (ioh3420) " - "controller is not supported in this QEMU= binary")); - goto error; - } - if ((pciopts->modelName =3D=3D - VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pcie-root-port (pcie-root-port) " - "controller is not supported in this QEMU= binary")); - goto error; - } - virBufferAsprintf(&buf, "%s,port=3D0x%x,chassis=3D%d,id=3D%s", modelName, pciopts->port, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_X3130_UPSTREAM)= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pcie-switch-upstream-port (x3130-ups= tream) " - "controller is not supported in this QEMU= binary")); - goto error; - } - virBufferAsprintf(&buf, "%s,id=3D%s", modelName, def->info.ali= as); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_XIO3130_DOWNSTR= EAM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("The pcie-switch-downstream-port " - "(xio3130-downstream) controller " - "is not supported in this QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "%s,port=3D0x%x,chassis=3D%d,id=3D%s", modelName, pciopts->port, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB_PCIE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the pxb-pcie controller " - "is not supported in this QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "%s,bus_nr=3D%d,id=3D%s", modelName, pciopts->busNr, def->info.alias); @@ -2822,25 +2767,12 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, if (pciopts->targetIndex =3D=3D 0) goto done; =20 - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_= BRIDGE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the spapr-pci-host-bridge controller " - "is not supported in this QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "%s,index=3D%d,id=3D%s", modelName, pciopts->targetIndex, def->info.alias); =20 - if (pciopts->numaNode !=3D -1) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPAPR_PCI_HOST_BRI= DGE_NUMA_NODE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the spapr-pci-host-bridge controller= " - "doesn't support numa_node on this QE= MU binary")); - goto error; - } + if (pciopts->numaNode !=3D -1) virBufferAsprintf(&buf, ",numa_node=3D%d", pciopts->numaNo= de); - } break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8cbb29e40..55750615c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4119,7 +4119,8 @@ qemuDomainDeviceDefValidateControllerSCSI(const virDo= mainControllerDef *controll =20 static int qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *con= troller, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { virDomainControllerModelPCI model =3D controller->model; const virDomainPCIControllerOpts *pciopts; @@ -4196,6 +4197,13 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pci-bridge controller is not supported " + "in this QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: @@ -4213,6 +4221,13 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pxb controller is not supported in this " + "QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: @@ -4224,6 +4239,13 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the dmi-to-pci-bridge (i82801b11-bridge) " + "controller is not supported in this QEMU bin= ary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: @@ -4242,6 +4264,22 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if ((pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAM= E_IOH3420) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pcie-root-port (ioh3420) controller " + "is not supported in this QEMU binary")); + return -1; + } + + if ((pciopts->modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAM= E_PCIE_ROOT_PORT) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pcie-root-port (pcie-root-port) controll= er " + "is not supported in this QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: @@ -4253,6 +4291,13 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_X3130_UPSTREAM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pcie-switch-upstream-port (x3130-upstrea= m) " + "controller is not supported in this QEMU bin= ary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: @@ -4271,6 +4316,14 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM)= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The pcie-switch-downstream-port " + "(xio3130-downstream) controller is not " + "supported in this QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: @@ -4288,6 +4341,13 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return -1; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB_PCIE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the pxb-pcie controller is not supported " + "in this QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: @@ -4309,6 +4369,21 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle return 0; } =20 + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRID= GE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the spapr-pci-host-bridge controller is not " + "supported in this QEMU binary")); + return -1; + } + + if (pciopts->numaNode !=3D -1 && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA= _NODE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the spapr-pci-host-bridge controller doe= sn't " + "support numa_node in this QEMU binary")); + return -1; + } + break; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: @@ -4353,7 +4428,8 @@ qemuDomainDeviceDefValidateController(const virDomain= ControllerDef *controller, break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_PCI: - ret =3D qemuDomainDeviceDefValidateControllerPCI(controller, def); + ret =3D qemuDomainDeviceDefValidateControllerPCI(controller, def, + qemuCaps); break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_FDC: diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c index 62bd25450..bc0b53e6f 100644 --- a/tests/qemumemlocktest.c +++ b/tests/qemumemlocktest.c @@ -63,6 +63,7 @@ mymain(void) { int ret =3D 0; char *fakerootdir; + virQEMUCapsPtr qemuCaps =3D NULL; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { fprintf(stderr, "Out of memory\n"); @@ -127,6 +128,16 @@ mymain(void) DO_TEST("pc-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); =20 qemuTestSetHostArch(driver.caps, VIR_ARCH_PPC64); + if (!(qemuCaps =3D virQEMUCapsNew())) { + ret =3D -1; + goto cleanup; + } + + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, qemuCaps) < 0) { + ret =3D -1; + goto cleanup; + }; =20 DO_TEST("pseries-kvm", 20971520); DO_TEST("pseries-tcg", 0); @@ -140,6 +151,9 @@ mymain(void) DO_TEST("pseries-hardlimit+locked+hostdev", 2147483648); DO_TEST("pseries-locked+hostdev", VIR_DOMAIN_MEMORY_PARAM_UNLIMITED); =20 + cleanup: + virObjectUnref(qemuCaps); + if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 2be8eb2c1..e866fb724 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1310,7 +1310,10 @@ mymain(void) DO_TEST("intel-iommu-machine", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_IOMMU); - DO_TEST("intel-iommu-caching-mode", NONE); + DO_TEST("intel-iommu-caching-mode", + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_IOH3420); DO_TEST("intel-iommu-eim", NONE); DO_TEST("intel-iommu-device-iotlb", NONE); =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196323952545.3873607991228; Fri, 5 Jan 2018 15:52:03 -0800 (PST) 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 AFF3D2D1ED4; Fri, 5 Jan 2018 23:52:02 +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 88F6D17C5E; Fri, 5 Jan 2018 23:52:02 +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 4B97D18033E4; Fri, 5 Jan 2018 23:52:02 +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 w05NlpPJ013991 for ; Fri, 5 Jan 2018 18:47:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 10D655C261; Fri, 5 Jan 2018 23:47:51 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD4CD5C258 for ; Fri, 5 Jan 2018 23:47:50 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:38 -0500 Message-Id: <20180105234739.508-16-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 15/16] qemu: Introduce qemuDomainDeviceDefValidateControllerSATA 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 05 Jan 2018 23:52:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the SATA controller check from command line building to controller def validation. This includes copying the SATA skip check found in qemuBuildSkipController. Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 6 ------ src/qemu/qemu_domain.c | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7a138f921..8c728c654 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2700,12 +2700,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_SATA: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("SATA is not supported with this " - "QEMU binary")); - goto error; - } virBufferAsprintf(&buf, "ahci,id=3D%s", def->info.alias); break; =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 55750615c..bc077ed72 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4396,6 +4396,24 @@ qemuDomainDeviceDefValidateControllerPCI(const virDo= mainControllerDef *controlle =20 =20 static int +qemuDomainDeviceDefValidateControllerSATA(const virDomainControllerDef *co= ntroller, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + /* first SATA controller on Q35 machines is implicit */ + if (controller->idx =3D=3D 0 && qemuDomainIsQ35(def)) + return 0; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SATA is not supported with this QEMU binary")); + return -1; + } + return 0; +} + + +static int qemuDomainDeviceDefValidateController(const virDomainControllerDef *contro= ller, const virDomainDef *def, virQEMUCapsPtr qemuCaps) @@ -4432,8 +4450,12 @@ qemuDomainDeviceDefValidateController(const virDomai= nControllerDef *controller, qemuCaps); break; =20 - case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_SATA: + ret =3D qemuDomainDeviceDefValidateControllerSATA(controller, def, + qemuCaps); + break; + + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_CONTROLLER_TYPE_CCID: case VIR_DOMAIN_CONTROLLER_TYPE_USB: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:21:07 2024 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 1515196327105234.97847535147264; Fri, 5 Jan 2018 15:52:07 -0800 (PST) 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 E38A1780EB; Fri, 5 Jan 2018 23:52:05 +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 C2FFD18983; Fri, 5 Jan 2018 23:52:05 +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 8603A18033E5; Fri, 5 Jan 2018 23:52:05 +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 w05NlplU013999 for ; Fri, 5 Jan 2018 18:47:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6C0585C261; Fri, 5 Jan 2018 23:47:51 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-143.phx2.redhat.com [10.3.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33F075C258 for ; Fri, 5 Jan 2018 23:47:51 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Fri, 5 Jan 2018 18:47:39 -0500 Message-Id: <20180105234739.508-17-jferlan@redhat.com> In-Reply-To: <20180105234739.508-1-jferlan@redhat.com> References: <20180105234739.508-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v5 16/16] qemu: Use switch statement for address types in qemuBuildControllerDevStr 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 05 Jan 2018 23:52:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc Hartmayer Use a switch statement instead of if-else-if statements. Move the command line building of the iothread attribute into the common path as the SCSI controller attributes are already validated. Signed-off-by: Marc Hartmayer Signed-off-by: John Ferlan --- src/qemu/qemu_command.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8c728c654..2523127cc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2612,6 +2612,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, { virBuffer buf =3D VIR_BUFFER_INITIALIZER; int model =3D def->model; + int address_type =3D def->info.type; const virDomainPCIControllerOpts *pciopts; const char *modelName =3D NULL; =20 @@ -2624,23 +2625,25 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, =20 switch ((virDomainControllerModelSCSI) model) { case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI: - if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { + switch ((virDomainDeviceAddressType) address_type) { + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: virBufferAddLit(&buf, "virtio-scsi-ccw"); - if (def->iothread) - virBufferAsprintf(&buf, ",iothread=3Diothread%u", - def->iothread); - } else if (def->info.type =3D=3D - VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390: virBufferAddLit(&buf, "virtio-scsi-s390"); - } else if (def->info.type =3D=3D - VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) { + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO: virBufferAddLit(&buf, "virtio-scsi-device"); - } else { + break; + default: virBufferAddLit(&buf, "virtio-scsi-pci"); - if (def->iothread) - virBufferAsprintf(&buf, ",iothread=3Diothread%u", - def->iothread); } + + if (def->iothread) { + virBufferAsprintf(&buf, ",iothread=3Diothread%u", + def->iothread); + } + if (qemuBuildVirtioOptionsStr(&buf, def->virtio, qemuCaps) < 0) goto error; break; @@ -2668,18 +2671,20 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: - if (def->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + switch ((virDomainDeviceAddressType) address_type) { + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: virBufferAddLit(&buf, "virtio-serial-pci"); - } else if (def->info.type =3D=3D - VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: virBufferAddLit(&buf, "virtio-serial-ccw"); - } else if (def->info.type =3D=3D - VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) { + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390: virBufferAddLit(&buf, "virtio-serial-s390"); - } else if (def->info.type =3D=3D - VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) { + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO: virBufferAddLit(&buf, "virtio-serial-device"); - } else { + break; + default: virBufferAddLit(&buf, "virtio-serial"); } virBufferAsprintf(&buf, ",id=3D%s", def->info.alias); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list