From patchwork Thu Apr 4 23:37:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161820 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2204550jan; Thu, 4 Apr 2019 16:38:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmhgSWAg4aM0awNbvFsM1POQielfpYTEldsKpbimfGaHkNBiD5jgj1kv9gH94WSfo52HxJ X-Received: by 2002:a0c:94d0:: with SMTP id k16mr7336588qvk.158.1554421110522; Thu, 04 Apr 2019 16:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554421110; cv=none; d=google.com; s=arc-20160816; b=nuEumDVo7Gb9jquKkHbY6DlNAUr02woXagrqTogdsov99MRTuTJeGiVRJDtuWR5fcs 5pcwodFeXMkKAJJAwk9HGKKhUeNOyhJpsbCogAipHjZvvX6neFFANAiYnsDqmn6UpYCj vR3jmoqIbrYyHtCl7TPUuksHno5l+Q0+zseD/RVQISqJsw4f/VtHlflaMW/VIe/F2Ga4 0IHV+mjMUz3EssRQv2Kmo/MQLFYyInB00ku8NbgYDkkc5C2hNXPE+BreMnuf++vSUY6W CZuFpTa0xOCHvNLdJaFYI7KoIe0bVcVhJ/WcAWea3lctpZd8PioMl2Od8i2Oqn533xwf zKJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=O18Hov2hq0TiImun7rfHlQCY39hemEomaVPrMRO5ZMo=; b=P0mHXySaH+OhX8O7+QUT+9vNh+ZgV0/AOlOpWl3pRo8Y8HxRo+mwWwylgYtzapCQ7a RKWMMAqWQpXIA89YEtoD0aWKLHP2tcQcJquPaA7drMw4hRUz4OTzIOMGrbN/2MEwykcf 1qgPR4WLlWeADKaT2xFWKlqfKXYUYxhY+kC6E7tcSsMgJNbDfNIRlL7wABISbedBiogs lmJFbrWn+wHc9N/zJk9IeiJIv3ujutW7eikSrvwL/lANDc7yMe6kdjfnxTj5lpqUemzx jLDMLDTuqpkEcbaaf2I0T0TAuuNpK4zpfZ73jp8LUFuw6RU89oCxg+bKlHUgyrfNI2Wk 4WWQ== 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 q47si2944395qvf.4.2019.04.04.16.38.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 16:38:30 -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-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BC3019CBCD; Thu, 4 Apr 2019 23:38:29 +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 17A831001E99; Thu, 4 Apr 2019 23:38:29 +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 D45E33FB16; Thu, 4 Apr 2019 23:38:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x34Nbih1011064 for ; Thu, 4 Apr 2019 19:37:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id D458660922; Thu, 4 Apr 2019 23:37:44 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-124-22.rdu2.redhat.com [10.10.124.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 062B96092D; Thu, 4 Apr 2019 23:37:43 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 4 Apr 2019 19:37:26 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/7] qemu: domain: Call virDomainCapsDeviceDefValidate 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 04 Apr 2019 23:38:29 +0000 (UTC) Fill in virDomainCaps at Validate time and use it to call virDomainCapsDeviceDefValidate Signed-off-by: Cole Robinson --- src/qemu/qemu_domain.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f0bf1aa4fe..6da27a79b0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -41,6 +41,7 @@ #include "viruuid.h" #include "virfile.h" #include "domain_addr.h" +#include "domain_capabilities.h" #include "domain_event.h" #include "virtime.h" #include "virnetdevopenvswitch.h" @@ -6119,14 +6120,24 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, int ret = 0; virQEMUDriverPtr driver = opaque; virQEMUCapsPtr qemuCaps = NULL; + virDomainCapsPtr domCaps = NULL; if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) return -1; + if (!(domCaps = virQEMUDriverGetDomainCapabilities(driver, qemuCaps, + def->os.machine, + def->os.arch, + def->virtType))) + goto cleanup; + if ((ret = qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0) goto cleanup; + if (virDomainCapsDeviceDefValidate(domCaps, dev, def) < 0) + goto cleanup; + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: ret = qemuDomainDeviceDefValidateNetwork(dev->data.net); @@ -6207,6 +6218,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, cleanup: virObjectUnref(qemuCaps); + virObjectUnref(domCaps); return ret; }