From nobody Fri May 17 22:41:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607436649; cv=none; d=zohomail.com; s=zohoarc; b=Oah6LhT40TorfVBAiKOSqmxbDPGvJ1buFI+/EKwJfiu3/RzPbaFXiQTYItvLXvpcBTJq3jlGKYb/hiTC8h89krJ6nR8fXhlYm+NrckALHCnv/98Nf1HyQP5AxIK+7+XoGCgHnIuYjMgFDfMkBJZywLNES77TRsOIah+i+k+GYhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607436649; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FSmuPxlvs8Hdis++bFR576qXM+seh26f7yMaWcEGrc8=; b=L5U6VBRJ9lXWFEf4KIc1L7nYQ+tXUdY+TAm3CGp4lW4+NCCdQFAA2VTknwV+8/e3bVJTX5M+NpRR5gDbyTpVq/0mqgJN59jkGFpXjkaRripv6ZdO+h9XV3flzzsrBfIzllxRixfp22zPCLGI8dEXcA818/DZTpZia9ZkzGA8DAY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607436649042939.6139325716224; Tue, 8 Dec 2020 06:10:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-ud7QIkWNOgStDvnJc_6wOA-1; Tue, 08 Dec 2020 09:02:19 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0772D192FDA2; Tue, 8 Dec 2020 14:02:10 +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 CF31F5C1BB; Tue, 8 Dec 2020 14:02:09 +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 953E24E58F; Tue, 8 Dec 2020 14:02:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B8E2111020959 for ; Tue, 8 Dec 2020 09:02:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0F5D31042A49; Tue, 8 Dec 2020 14:02:01 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 084531042A4C for ; Tue, 8 Dec 2020 14:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436141; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FSmuPxlvs8Hdis++bFR576qXM+seh26f7yMaWcEGrc8=; b=KjtBeQHlqZ4THwrTYVE6ZZDPt9pKhi50M8r28gni/T54kLzCN+jdNh65qctD+BeDUNE6K8 7UPaoUPPuCuHG539rwSq4M3ZaR/tVvjZwY4UIAryF4Xf+X9F2hoyruJcc4RIGpq5agIEal kjUuZFN+icqCR8pqZ2IsfzmDMDotF7c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436644; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FSmuPxlvs8Hdis++bFR576qXM+seh26f7yMaWcEGrc8=; b=WqAfLKEPuLaaAeVsgaK47THB3z0GToFhqGif38W8mmUPTWDHz119pQS/8K01V74ZABg+di i3toWurOpUD8W8iLvbKdVmgKZNR/1ppT+73QogFElfkPPlW4E1i/ROQAp5g9xOsBqQ1P80 lj7oFnQ8XUqqo137aM92cArKKQ+DiIA= X-MC-Unique: ud7QIkWNOgStDvnJc_6wOA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/4] virDomainDefValidate: Add per-run 'opaque' data Date: Tue, 8 Dec 2020 15:01:43 +0100 Message-Id: <9ff0fe1cb137ffed8c203aa8ae0c52a47c7aa0c6.1607435748.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" virDomainDefPostParse infrastructure has apart from the global opaque data also per-run data, but this was not duplicated into the validation callbacks. This is important when drivers want to use correct run-state for the validation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_domain.c | 3 ++- src/conf/domain_conf.c | 21 +++++++++++++-------- src/conf/domain_conf.h | 9 ++++++--- src/qemu/qemu_process.c | 2 +- src/qemu/qemu_validate.c | 6 ++++-- src/qemu/qemu_validate.h | 7 +++++-- src/vz/vz_driver.c | 6 ++++-- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 6935609b96..f0e553113f 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -199,7 +199,8 @@ virBhyveDriverCreateXMLConf(bhyveConnPtr driver) static int bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def G_GNUC_UNUSED, - void *opaque G_GNUC_UNUSED) + void *opaque G_GNUC_UNUSED, + void *parseOpaque G_GNUC_UNUSED) { if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER && dev->data.controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_ISA && diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 66ee658e7b..fa19563a35 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6974,14 +6974,15 @@ static int virDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def, unsigned int parseFlags, - virDomainXMLOptionPtr xmlopt) + virDomainXMLOptionPtr xmlopt, + void *parseOpaque) { /* validate configuration only in certain places */ if (parseFlags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE) return 0; if (xmlopt->config.deviceValidateCallback && - xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.pri= v)) + xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.pri= v, parseOpaque)) return -1; if (virDomainDeviceDefValidateInternal(dev, def) < 0) @@ -6999,7 +7000,8 @@ virDomainDefValidateDeviceIterator(virDomainDefPtr de= f, { struct virDomainDefPostParseDeviceIteratorData *data =3D opaque; return virDomainDeviceDefValidate(dev, def, - data->parseFlags, data->xmlopt); + data->parseFlags, data->xmlopt, + data->parseOpaque); } @@ -7357,6 +7359,7 @@ virDomainDefValidateInternal(const virDomainDef *def, * @caps: driver capabilities object * @parseFlags: virDomainDefParseFlags * @xmlopt: XML parser option object + * @parseOpaque: hypervisor driver specific data for this validation run * * This validation function is designed to take checks of globally invalid * configurations that the parser needs to accept so that VMs don't vanish= upon @@ -7369,11 +7372,13 @@ virDomainDefValidateInternal(const virDomainDef *de= f, int virDomainDefValidate(virDomainDefPtr def, unsigned int parseFlags, - virDomainXMLOptionPtr xmlopt) + virDomainXMLOptionPtr xmlopt, + void *parseOpaque) { struct virDomainDefPostParseDeviceIteratorData data =3D { .xmlopt =3D xmlopt, .parseFlags =3D parseFlags, + .parseOpaque =3D parseOpaque, }; /* validate configuration only in certain places */ @@ -7382,7 +7387,7 @@ virDomainDefValidate(virDomainDefPtr def, /* call the domain config callback */ if (xmlopt->config.domainValidateCallback && - xmlopt->config.domainValidateCallback(def, xmlopt->config.priv) < = 0) + xmlopt->config.domainValidateCallback(def, xmlopt->config.priv, pa= rseOpaque) < 0) return -1; /* iterate the devices */ @@ -17220,7 +17225,7 @@ virDomainDeviceDefParse(const char *xmlStr, return NULL; /* validate the configuration */ - if (virDomainDeviceDefValidate(dev, def, flags, xmlopt) < 0) + if (virDomainDeviceDefValidate(dev, def, flags, xmlopt, parseOpaque) <= 0) return NULL; return g_steal_pointer(&dev); @@ -22617,7 +22622,7 @@ virDomainObjParseXML(xmlDocPtr xml, goto error; /* validate configuration */ - if (virDomainDefValidate(obj->def, flags, xmlopt) < 0) + if (virDomainDefValidate(obj->def, flags, xmlopt, parseOpaque) < 0) goto error; return obj; @@ -22701,7 +22706,7 @@ virDomainDefParseNode(xmlDocPtr xml, return NULL; /* validate configuration */ - if (virDomainDefValidate(def, flags, xmlopt) < 0) + if (virDomainDefValidate(def, flags, xmlopt, parseOpaque) < 0) return NULL; return g_steal_pointer(&def); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cdf08de60a..72771c46b9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2867,13 +2867,15 @@ typedef void (*virDomainDefPostParseDataFree)(void = *parseOpaque); * for configurations that were previously accepted. This shall not modify= the * config. */ typedef int (*virDomainDefValidateCallback)(const virDomainDef *def, - void *opaque); + void *opaque, + void *parseOpaque); /* Called once per device, for adjusting per-device settings while * leaving the overall domain otherwise unchanged. */ typedef int (*virDomainDeviceDefValidateCallback)(const virDomainDeviceDef= *dev, const virDomainDef *def, - void *opaque); + void *opaque, + void *parseOpaque); struct _virDomainDefParserConfig { /* driver domain definition callbacks */ @@ -2993,7 +2995,8 @@ bool virDomainDeviceAliasIsUserAlias(const char *alia= sStr); int virDomainDefValidate(virDomainDefPtr def, unsigned int parseFlags, - virDomainXMLOptionPtr xmlopt); + virDomainXMLOptionPtr xmlopt, + void *parseOpaque); int virDomainActualNetDefValidate(const virDomainNetDef *net); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e0b42ee2c9..474cb93bad 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5464,7 +5464,7 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, * VM that was running before (migration, snapshots, save). It's more * important to start such VM than keep the configuration clean */ if ((flags & VIR_QEMU_PROCESS_START_NEW) && - virDomainDefValidate(vm->def, 0, driver->xmlopt) < 0) + virDomainDefValidate(vm->def, 0, driver->xmlopt, qemuCaps) < 0) return -1; if (qemuProcessStartValidateGraphics(vm) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 52d15defed..62d7243e21 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1066,7 +1066,8 @@ qemuValidateDomainDefPanic(const virDomainDef *def, int qemuValidateDomainDef(const virDomainDef *def, - void *opaque) + void *opaque, + void *parseOpaque G_GNUC_UNUSED) { virQEMUDriverPtr driver =3D opaque; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); @@ -4670,7 +4671,8 @@ qemuValidateDomainDeviceDefShmem(virDomainShmemDefPtr= shmem, int qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, const virDomainDef *def, - void *opaque) + void *opaque, + void *parseOpaque G_GNUC_UNUSED) { int ret =3D 0; virQEMUDriverPtr driver =3D opaque; diff --git a/src/qemu/qemu_validate.h b/src/qemu/qemu_validate.h index acf7d26ce0..b6c5441f90 100644 --- a/src/qemu/qemu_validate.h +++ b/src/qemu/qemu_validate.h @@ -26,10 +26,13 @@ #include "qemu_capabilities.h" #include "qemu_conf.h" -int qemuValidateDomainDef(const virDomainDef *def, void *opaque); +int qemuValidateDomainDef(const virDomainDef *def, + void *opaque, + void *parseOpaque); int qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, const virDomainDef *def, virQEMUCapsPtr qemuCaps); int qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, const virDomainDef *def, - void *opaque); + void *opaque, + void *parseOpaque); diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 8d47b90bdb..b60e99d4f5 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -259,7 +259,8 @@ vzDomainDefPostParse(virDomainDefPtr def, static int vzDomainDefValidate(const virDomainDef *def, - void *opaque) + void *opaque, + void *parseOpaque G_GNUC_UNUSED) { if (vzCheckUnsupportedControllers(def, opaque) < 0) return -1; @@ -295,7 +296,8 @@ vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, static int vzDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def, - void *opaque) + void *opaque, + void *parseOpaque G_GNUC_UNUSED) { vzDriverPtr driver =3D opaque; --=20 2.28.0 From nobody Fri May 17 22:41:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607436378; cv=none; d=zohomail.com; s=zohoarc; b=YGEHrO+bxfB6PQA0HbHeg9eEJ73JgDRqDDO7X7kvdfLfo2m7XimtM6nVeLtbe4CZYreXj6fo7/eBy8OhhS5y5Sy1Nv6wa2Pxdx+0U7x/1C5znWHWOZ8AxWpkZy3VQjRit1o3QAuTZ/1UttSqGz7lqEjQCMyU8g6B0msppPkd9aM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607436378; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EFnTYM1RpFUJuYOcoKNCBYhC24JDdndnVXTWcAt7dQg=; b=lHHCTlePOkDn0UkUhFohEdTqEIze38opXk7g1mBCuqr09YdlYjwcwKKMT1qeZQFJk0aXLSgzvdaEGfRPEXX+dK+BPzv7f+Q7xE64BOqMIBsKRjA7L2Q+OCSii1tBfQll0AqFWBaixU8OpQB8Lyuh8uyZRrxH8lhUEh8wqggjvgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607436378603908.9256367040898; Tue, 8 Dec 2020 06:06:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-jxyOP1akN82OXe64Tn-ufQ-1; Tue, 08 Dec 2020 09:02:10 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9552C192D792; Tue, 8 Dec 2020 14:02:04 +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 5E7A35D9E2; Tue, 8 Dec 2020 14:02:04 +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 F11784BB7B; Tue, 8 Dec 2020 14:02:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B8E22Et020970 for ; Tue, 8 Dec 2020 09:02:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 35480101E81C; Tue, 8 Dec 2020 14:02:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7646F1045D01 for ; Tue, 8 Dec 2020 14:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436133; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EFnTYM1RpFUJuYOcoKNCBYhC24JDdndnVXTWcAt7dQg=; b=ZISy+OUeVGB7MLuFzekZYRQUeSO45sgPkOO0A9HH4OQjToGlUJMX2AyOLVDJSReysYEXR/ jX6OdC9J59JA3XSrk9rBMqB0v47QdJUywkgrdnv6U6d7fajrIFo43Q6ecgQeu87xEn9jlA UEdhHmO54DPZDtnQ9YZJki4VrWegehw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436374; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EFnTYM1RpFUJuYOcoKNCBYhC24JDdndnVXTWcAt7dQg=; b=IqSY0rpiCVaoC9eoQ4RPyT/I+R33FMa4CQ2J+F7JVNxG9o1p7oND6hvKcOnwwJZKxY1zk5 LK0QM8WmfRZJv5SDlOOuQNxDPh0Q+uucxzEMNREzm/LwS0Zr/YF5/rtBiyLzn12evtt3Ag pX43ZGPwyqYWcXVFujL0jiCbuu1541c= X-MC-Unique: jxyOP1akN82OXe64Tn-ufQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu: validate: Don't check that qemuCaps is non-NULL Date: Tue, 8 Dec 2020 15:01:44 +0100 Message-Id: <3e5e3ab4c633b44a845b56636152b04c3801133e.1607435748.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The validation callbacks always fetch latest qemuCaps so it won't ever be NULL. Remove the tautological conditions. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 103 +++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 62d7243e21..81a9c9d45b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1099,8 +1099,7 @@ qemuValidateDomainDef(const virDomainDef *def, return -1; } - if (qemuCaps && - !virQEMUCapsIsMachineSupported(qemuCaps, def->virtType, def->os.ma= chine)) { + if (!virQEMUCapsIsMachineSupported(qemuCaps, def->virtType, def->os.ma= chine)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Emulator '%s' does not support machine type '%s'= "), def->emulator, def->os.machine); @@ -2648,37 +2647,35 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDo= mainDiskDef *disk, return -1; } - if (qemuCaps) { - if (disk->serial && - disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && - disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("scsi-block 'lun' devices do not support the " - "serial property")); - return -1; - } + if (disk->serial && + disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && + disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("scsi-block 'lun' devices do not support the " + "serial property")); + return -1; + } - if (disk->discard && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("discard is not supported by this QEMU binary= ")); - return -1; - } + if (disk->discard && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("discard is not supported by this QEMU binary")); + return -1; + } + + if (disk->detect_zeroes && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DETECT_ZEROES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("detect_zeroes is not supported by this QEMU bina= ry")); + return -1; + } - if (disk->detect_zeroes && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DETECT_ZEROES)) { + if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_URING) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("detect_zeroes is not supported by this QEMU = binary")); + _("io uring is not supported by this QEMU binar= y")); return -1; } - - if (disk->iomode =3D=3D VIR_DOMAIN_DISK_IO_URING) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("io uring is not supported by this QEMU b= inary")); - return -1; - } - } } if (disk->serial && @@ -2753,33 +2750,31 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const v= irDomainDiskDef *disk, return -1; } - if (qemuCaps) { - /* block I/O throttling 1.7 */ - if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling paramete= rs " - "that are not supported with this QEMU binary= ")); - return -1; - } + /* block I/O throttling 1.7 */ + if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("there are some block I/O throttling parameters " + "that are not supported with this QEMU binary")); + return -1; + } - /* block I/O group 2.4 */ - if (disk->blkdeviotune.group_name && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the block I/O throttling group parameter is " - "not supported with this QEMU binary")); - return -1; - } + /* block I/O group 2.4 */ + if (disk->blkdeviotune.group_name && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the block I/O throttling group parameter is " + "not supported with this QEMU binary")); + return -1; + } - /* block I/O throttling length 2.6 */ - if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling length p= arameters " - "that are not supported with this QEMU binary= ")); - return -1; - } + /* block I/O throttling length 2.6 */ + if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("there are some block I/O throttling length param= eters " + "that are not supported with this QEMU binary")); + return -1; } return 0; @@ -2822,7 +2817,7 @@ qemuValidateDomainDeviceDefDiskTransient(const virDom= ainDiskDef *disk, return -1; } - if (qemuCaps && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("transient disk not supported by this QEMU binary= (%s)"), disk->dst); --=20 2.28.0 From nobody Fri May 17 22:41:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607436153; cv=none; d=zohomail.com; s=zohoarc; b=IEE0YEaj/dRAEPRUYctqQLw5MIfIs4uvGDoV6/DwYvWrp0WXLzm48rcFsJxYzKxopVMuCidhJnSWbwP6+bgQHZoSSwA8+goHqTRrX/BED5tmpGCN1sRFDe7gTn7cx1OXCYFD1zHTPunDthAKlei4UV5YO4CxhJKxug9gdf8UzE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607436153; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T3vT3MJHpU55HdXtno4p/aa8EY+e4mufBMRsKf1+Cbc=; b=hbx4mKQrgP1viN7XRmRsJj3DnglYNnYnUoZmDHvGqh0BtTJ+jLjzc/D+g9DLq4IHfZesWhsOM+g5M2kGXt05/bK/p45dIKi970qn24y9Y42Q80cdIL+OuVGtaAWzNrUNVFDCWdUMKnh5rYO0S1JMojlMsDcvom9ZN+QLVvhvorw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607436152890816.5424044179625; Tue, 8 Dec 2020 06:02:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-h4V7NC2RNgScVmb2_1aLxg-1; Tue, 08 Dec 2020 09:02:22 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2730858180; Tue, 8 Dec 2020 14:02:12 +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 9F5711346F; Tue, 8 Dec 2020 14:02:12 +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 673BB4EBC6; Tue, 8 Dec 2020 14:02:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B8E23rH020984 for ; Tue, 8 Dec 2020 09:02:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 523C510246F1; Tue, 8 Dec 2020 14:02:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A22A210246FB for ; Tue, 8 Dec 2020 14:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436145; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=T3vT3MJHpU55HdXtno4p/aa8EY+e4mufBMRsKf1+Cbc=; b=BoYubQaWwPOCBN3g4UT5yv0LBc8WZe/+odCDRXLiu4cUPd470Ie88lMr/WKBScRSoIt9VA 3RbJ/t9hKdRUflcMAe6ViSSP8LXoKJdFUTh8TEZF1XECTGx6/jgXqTLWh5HxhhUoW8/K6P o8dPEotTo4EKiHKZT5aCPtmmQm6uoWA= X-MC-Unique: h4V7NC2RNgScVmb2_1aLxg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] qemuValidateDomainDeviceDefFS: Fix block indentation Date: Tue, 8 Dec 2020 15:01:45 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 81a9c9d45b..cb0f830cf1 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3997,8 +3997,7 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs, return -1; } if (fs->multidevs !=3D VIR_DOMAIN_FS_MODEL_DEFAULT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_MULTIDEVS)) - { + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_FSDEV_MULTIDEVS)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("multidevs is not supported with this QEMU binary= ")); return -1; --=20 2.28.0 From nobody Fri May 17 22:41:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607436149; cv=none; d=zohomail.com; s=zohoarc; b=awNh63mdMhIahM3p/eqD3gNiJGLLW3KYzgFxA1zxyhW0bYtsn+7XsLEjOxjwc/68uowsKc6elP3sGGY7rwKKnqnbBa5Bqr5KicnzKUiLEpT9F1Z13nkTltt1kiCMUOWH+aFXvdA1jKGLpi30XFGn8zrU/2dN7cPflz7dH8+zDA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607436149; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dUdtvJ8oS2wxYcuYmiGPAOl8H0rUjGThrP5U2O5DWUg=; b=OGdCxPhxZj7p1Y7grjC6wFmSS8x7oZnbPEP+2Jkj6HkDmyKaXZJbghKiud5dL5WAQflm+r/R103TXU2VLlWuEWW0M29fkbC7fYiQlW40mficpSxKuMl4obzWK2HqXNuwLSe/sXy3KrQs/VpcpiKoE88P29isNYGL/893nBzLA2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607436149769669.9424403995056; Tue, 8 Dec 2020 06:02:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-Ki0bsKf6NeahWhkCUjzhoA-1; Tue, 08 Dec 2020 09:02:23 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6FB22858199; Tue, 8 Dec 2020 14:02:13 +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 4D66C39A60; Tue, 8 Dec 2020 14:02: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 114B01809CA0; Tue, 8 Dec 2020 14:02:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B8E2CWO021043 for ; Tue, 8 Dec 2020 09:02:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F8C810002A6; Tue, 8 Dec 2020 14:02:12 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79FC81002393 for ; Tue, 8 Dec 2020 14:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607436145; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dUdtvJ8oS2wxYcuYmiGPAOl8H0rUjGThrP5U2O5DWUg=; b=CKFffrW4f3R4IEcHtm4DlKVzO7jvxurhQu7KPnx8m9PDWuiXxrHNTFaIGb5EVh4cHHt/Kd Ad+4XCGLRzkSOCErN3Fri0dklF6Bdg7x5rirOSW8jjVuLa7qMjDi1/c1jHVyEntcZ3zy6f wNcVHue+2QCsldhydJ8ow07WX0L8Drk= X-MC-Unique: Ki0bsKf6NeahWhkCUjzhoA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/4] qemu: validate: Prefer existing qemuCaps Date: Tue, 8 Dec 2020 15:01:46 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The validation callback always fetched a fresh copy of 'qemuCaps' to use for validation which is wrong in cases when the VM is already running, such as device hotplug. The newly-fetched qemuCaps may contain flags which weren't originally in use when starting the VM e.g. on a libvirtd upgrade. Since the post-parse/validation machinery has a per-run 'parseOpaque' field filled with qemuCaps of the actual process we can reuse the caps in cases when we get them. The code still fetches a fresh copy if parseOpaque doesn't have a per-run copy to preserve existing functionality. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index cb0f830cf1..bf8127a575 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1067,16 +1067,21 @@ qemuValidateDomainDefPanic(const virDomainDef *def, int qemuValidateDomainDef(const virDomainDef *def, void *opaque, - void *parseOpaque G_GNUC_UNUSED) + void *parseOpaque) { virQEMUDriverPtr driver =3D opaque; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); - g_autoptr(virQEMUCaps) qemuCaps =3D NULL; + g_autoptr(virQEMUCaps) qemuCapsLocal =3D NULL; + virQEMUCapsPtr qemuCaps =3D parseOpaque; size_t i; - if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, - def->emulator))) - return -1; + if (!qemuCaps) { + if (!(qemuCapsLocal =3D virQEMUCapsCacheLookup(driver->qemuCapsCac= he, + def->emulator))) + return -1; + + qemuCaps =3D qemuCapsLocal; + } if (def->os.type !=3D VIR_DOMAIN_OSTYPE_HVM) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -4666,15 +4671,20 @@ int qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev, const virDomainDef *def, void *opaque, - void *parseOpaque G_GNUC_UNUSED) + void *parseOpaque) { int ret =3D 0; virQEMUDriverPtr driver =3D opaque; - g_autoptr(virQEMUCaps) qemuCaps =3D NULL; + g_autoptr(virQEMUCaps) qemuCapsLocal =3D NULL; + virQEMUCapsPtr qemuCaps =3D parseOpaque; - if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, - def->emulator))) - return -1; + if (!qemuCaps) { + if (!(qemuCapsLocal =3D virQEMUCapsCacheLookup(driver->qemuCapsCac= he, + def->emulator))) + return -1; + + qemuCaps =3D qemuCapsLocal; + } if ((ret =3D qemuValidateDomainDeviceDefAddress(dev, qemuCaps)) < 0) return ret; --=20 2.28.0