From patchwork Tue Jul 24 21:23:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 142829 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp55967ljj; Tue, 24 Jul 2018 14:24:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfOC2Br2HS7Col+Da+EuqzqKjCy7yWLm8/EHStFwJosjiHq9taZDdcOmRddCtAA7PHQv4Dv X-Received: by 2002:a37:4b46:: with SMTP id y67-v6mr16239985qka.207.1532467460596; Tue, 24 Jul 2018 14:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532467460; cv=none; d=google.com; s=arc-20160816; b=d6o2rpumVBaPf0mXjqx0xds/w3XJpeBh5q8DDDz1+bsKsfI29nOMOc1wRUC8/tDdcv JHRfJ4UYxr39s6VwTdV8lJ9WpcY5cAyc2C4RhSyNdBWGVtjDoTnZoes5E9QhBQ5VI4Ks 99SOvpq9MHfeBm3VmgrHptU5oCT2uFuUATbL0roDBZAzmKNec2u96gqeIiRPQqV2fpJp 4XbJVYITH4PBAekzXW+JMBz6jgGOSGFtU1MrtJySLNDHrMM3EG2JD5oXu1KqK1pJHDrS SLeCn+Es7V+5fRtMs3++O+TTAJPYpEcWdhdPs58a9AzNsnwxcLcof05wI5YzZQ33LVOZ iAIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=VBFQLjQ1DW6mFjB8Z0z2CgH+cBTOAJxZV9JD0qdSrxM=; b=e/X+7sGfZCP7DCO6Yse4losmLPAn4t3qeWMZsO1SRlBxsh7mfnHXH9Mg8w1Qhpkl3v WEtCLcp8MdQK6JsIO8eqrPBss7LUXqsot5shLscTMu0lY4LI0HNKuLallGUFwpBws6VT 0e5NwT639m0fcGdNXSvIdfrQniwitkfDdlZO3VtkX318a5ySNHpLf/rzJDuff3v6BUJD zUpZ5Uvai1J9I1xMH7plbqjYUvQ33XGeEcrr8sgp32qNo9dIv00iRXYK7k95d6wcQml0 g9BbEMHvNciBnF9InAK953KKetcz5reAwP+98nfi3jBFKlGTpKhWOJrCwkTOzysn0JX3 s0NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id e65-v6si755694qkd.158.2018.07.24.14.24.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 14:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) Delivered-To: libvirt-list@redhat.com 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 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) 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(-) -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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; } - if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS)) { - if (!(capsdata = virCapabilitiesDomainDataLookup(caps, - def->os.type, def->os.arch, def->virtType, - NULL, NULL))) + if (!(capsdata = 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 = capsdata->arch; if ((!def->os.machine && - VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) { + VIR_STRDUP(def->os.machine, capsdata->machinetype) < 0)) goto cleanup; - } } ret = 0; diff --git a/tests/qemuxml2argvdata/missing-machine.xml b/tests/qemuxml2argvdata/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); + /* 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);