From nobody Sun Apr 28 13:06:50 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 1510756894828718.2615500493732; Wed, 15 Nov 2017 06:41:34 -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 84BB272FE3; Wed, 15 Nov 2017 14:41:33 +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 5D55581BC0; Wed, 15 Nov 2017 14:41:33 +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 261703D383; Wed, 15 Nov 2017 14:41:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAFEeNOv016787 for ; Wed, 15 Nov 2017 09:40:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id E58DB7D12D; Wed, 15 Nov 2017 14:40:23 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 451297D120; Wed, 15 Nov 2017 14:40:23 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 15 Nov 2017 15:40:15 +0100 Message-Id: <2f694a7d35c347eb00e18ef422df333c28037d87.1510756669.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH v2 1/3] virQEMUCapsHasPCIMultiBus: Fix @def type 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.38]); Wed, 15 Nov 2017 14:41:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function only queries domani @def. It doesn't change it. Therefore it should take const pointer. Signed-off-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 2 +- src/qemu/qemu_capabilities.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1badadbc2..00c00c3c3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2390,7 +2390,7 @@ virQEMUCapsGet(virQEMUCapsPtr qemuCaps, =20 =20 bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, - virDomainDefPtr def) + const virDomainDef *def) { /* x86_64 and i686 support PCI-multibus on all machine types * since forever */ diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f0e2e9016..e7d766f80 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -451,7 +451,7 @@ bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps, virQEMUCapsFlags flag); =20 bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, - virDomainDefPtr def); + const virDomainDef *def); =20 bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, const virDomainDef *def); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 13:06:50 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 1510756850811975.3871041306883; Wed, 15 Nov 2017 06:40:50 -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 0FD75C034E16; Wed, 15 Nov 2017 14:40:49 +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 A972F121F40; Wed, 15 Nov 2017 14:40: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 0E5043D382; Wed, 15 Nov 2017 14:40:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAFEeOmW016792 for ; Wed, 15 Nov 2017 09:40:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id DE6767D12D; Wed, 15 Nov 2017 14:40:24 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E7287D120; Wed, 15 Nov 2017 14:40:24 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 15 Nov 2017 15:40:16 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH v2 2/3] qemuBuildDriveDevStr: Prefer default alias for SATA bus 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.31]); Wed, 15 Nov 2017 14:40:49 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1434451 Just like in 9324f67a572f9b32 we need to put default sata alias (which is hardcoded to "ide", obvious, right?) onto the command line instead of the one provided by user. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 15 ++++++++-- .../qemuxml2argv-user-aliases2.args | 1 + .../qemuxml2argv-user-aliases2.xml | 34 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 56729e498..4eda12179 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2020,9 +2020,18 @@ qemuBuildDriveDevStr(const virDomainDef *def, virBufferAddLit(&opt, "ide-drive"); } =20 - if (!(contAlias =3D virDomainControllerAliasFind(def, VIR_DOMAIN_C= ONTROLLER_TYPE_SATA, - disk->info.addr.driv= e.controller))) - goto error; + /* When domain has builtin SATA controller we don't put it onto cmd + * line. Therefore we can't set its alias. In that case, use the + * default one. */ + if (qemuDomainIsQ35(def) && + disk->info.addr.drive.controller =3D=3D 0) { + contAlias =3D "ide"; + } else { + if (!(contAlias =3D virDomainControllerAliasFind(def, + VIR_DOMAIN_CONT= ROLLER_TYPE_SATA, + disk->info.addr= .drive.controller))) + goto error; + } virBufferAsprintf(&opt, ",bus=3D%s.%d", contAlias, disk->info.addr.drive.unit); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args b/tests= /qemuxml2argvdata/qemuxml2argv-user-aliases2.args new file mode 120000 index 000000000..e029bc0ec --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.args @@ -0,0 +1 @@ +qemuxml2argv-boot-floppy-q35.args \ No newline at end of file diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml b/tests/= qemuxml2argvdata/qemuxml2argv-user-aliases2.xml new file mode 100644 index 000000000..a288b8611 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases2.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1bedc6874..d66e77ed4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2827,6 +2827,7 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC, QEMU_CAPS_HDA_DUPLEX); + DO_TEST("user-aliases2", QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI= ); =20 if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 13:06:50 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 1510756856173290.5233308233205; Wed, 15 Nov 2017 06:40:56 -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 D0A81FC7BB; Wed, 15 Nov 2017 14:40: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 B198D7D146; Wed, 15 Nov 2017 14:40:54 +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 7A2FF3D382; Wed, 15 Nov 2017 14:40:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vAFEePGa016808 for ; Wed, 15 Nov 2017 09:40:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id D89107D13E; Wed, 15 Nov 2017 14:40:25 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3894E7D120; Wed, 15 Nov 2017 14:40:25 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 15 Nov 2017 15:40:17 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com Subject: [libvirt] [PATCH v2 3/3] qemuBuildDeviceAddressStr: Prefer default alias for PCI bus 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.38]); Wed, 15 Nov 2017 14:40:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1434451 Just like in 9324f67a572f9b32 we need to put default pci-root alias onto the command line instead of the one provided by user. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 30 ++++++++++++++++--= ---- .../qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 4 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4eda12179..84aa1b933 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -318,16 +318,30 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, =20 if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && cont->idx =3D=3D info->addr.pci.bus) { - contAlias =3D cont->info.alias; contIsPHB =3D virDomainControllerIsPSeriesPHB(cont); contTargetIndex =3D cont->opts.pciopts.targetIndex; - if (!contAlias) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Device alias was not set for PCI " - "controller with index %u required " - "for device at address %s"), - info->addr.pci.bus, devStr); - goto cleanup; + + /* When domain has builtin pci-root controller we don't pu= t it + * onto cmd line. Therefore we can't set its alias. In that + * case, use the default one. */ + if (!qemuDomainIsPSeries(domainDef) && + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROO= T) { + if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef)) + contAlias =3D "pci.0"; + else + contAlias =3D "pci"; + } else if (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_= PCIE_ROOT) { + contAlias =3D "pcie.0"; + } else { + contAlias =3D cont->info.alias; + if (!contAlias) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Device alias was not set for PCI= " + "controller with index %u require= d " + "for device at address %s"), + info->addr.pci.bus, devStr); + goto cleanup; + } } break; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/q= emuxml2argvdata/qemuxml2argv-user-aliases.xml index d1cb8fea6..c760098fe 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml @@ -74,7 +74,9 @@
- + + +
--=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list