From nobody Sun Feb 8 09:41:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532467460238836.5909542036605; Tue, 24 Jul 2018 14:24:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4693681108; Tue, 24 Jul 2018 21:24:17 +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 0972316BF5; Tue, 24 Jul 2018 21:24:17 +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 9710D1800B6B; Tue, 24 Jul 2018 21:24:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6OLNqGf018734 for ; Tue, 24 Jul 2018 17:23:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09C3C2027047; Tue, 24 Jul 2018 21:23:52 +0000 (UTC) Received: from worklaptop.bos.redhat.com (wlan-196-187.bos.redhat.com [10.16.196.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id E185E2026D68; Tue, 24 Jul 2018 21:23:51 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 24 Jul 2018 17:23:46 -0400 Message-Id: <09f9dd272a34ce25dd6f18a25c46645df24740d8.1532467269.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/7] conf: Sync caps data even when SKIP_OSTYPE_CHECKS 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 24 Jul 2018 21:24:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We should still make an effort to fill in data, just not raise an error if say an ostype/virttype combo disappeared from caps. Signed-off-by: Cole Robinson --- src/conf/domain_conf.c | 13 ++++++------- tests/qemuxml2argvdata/missing-machine.xml | 2 +- tests/qemuxml2argvtest.c | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b7f6a22e20..78ee000857 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19178,18 +19178,17 @@ virDomainDefParseCaps(virDomainDefPtr def, goto cleanup; } =20 - if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { - if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, - def->os.type, def->os.arch, def->virtType, - NULL, NULL))) + if (!(capsdata =3D virCapabilitiesDomainDataLookup(caps, def->os.type, + def->os.arch, def->virtType, NULL, NULL))) { + if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)) goto cleanup; - + virResetLastError(); + } else { if (!def->os.arch) def->os.arch =3D capsdata->arch; if ((!def->os.machine && - VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) { + VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) goto cleanup; - } } =20 ret =3D 0; diff --git a/tests/qemuxml2argvdata/missing-machine.xml b/tests/qemuxml2arg= vdata/missing-machine.xml index 4ce7b377a5..2900baec90 100644 --- a/tests/qemuxml2argvdata/missing-machine.xml +++ b/tests/qemuxml2argvdata/missing-machine.xml @@ -6,7 +6,7 @@ 219100 1 - hvm + hvm diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1a936faef1..03b6d92912 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2773,6 +2773,9 @@ mymain(void) QEMU_CAPS_OBJECT_GPEX, QEMU_CAPS_NEC_USB_XHCI); =20 + /* VM XML has invalid arch/ostype/virttype combo, but the SKIP flag + * will avoid the error. Still, we expect qemu driver to complain about + * missing machine error, and not crash */ DO_TEST_PARSE_FLAGS_ERROR("missing-machine", VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS, NONE); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list