From nobody Mon Feb 9 01:48:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1666276715; cv=none; d=zohomail.com; s=zohoarc; b=RM+QLSWP70OBswpb8heQPGrBz5VshHxFcQ3J110NUfdRn3GxHPHO/IHOYSqmOpkCDzn3Kg7kHcYeDJeLSu7a8CdzSJCX57n4wQP+ADdjaVA1hgmOEBdnoFFrWPl6GuCBshli9eUWzLaKKCKVrZ+HI046v0w61CE3713eoXMLYLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666276715; 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=2qi8HX3khxbI+vCGCKnPEsPZWb4x+6/npF/T65PNXKE=; b=EiEsipkZxDRzLrVldzjqq+ay1eTnn0cxo2bC+oC+IVl4NjCYcVUrp/qUx5a2yJ8s1GBhXrzB2AifIEAJ8dSOERpAFGk7RZiMud/hbmK57RwV4hFSXrc12lLkoQVZySWEd9PgE7oHQPsLcWKnEzKV0BFdY579kPRSq4useSmjwXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 166627671527159.88899437442103; Thu, 20 Oct 2022 07:38:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-574-pW9VZkf2NWKZVXHOUvqDqw-1; Thu, 20 Oct 2022 10:38:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E25F0380391E; Thu, 20 Oct 2022 14:38:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0FF21401CDA; Thu, 20 Oct 2022 14:38:27 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3C02D1946A66; Thu, 20 Oct 2022 14:38:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 18EDE19465BA for ; Thu, 20 Oct 2022 14:38:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7101735429; Thu, 20 Oct 2022 14:38:00 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id D039E1759E for ; Thu, 20 Oct 2022 14:37:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666276714; 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=2qi8HX3khxbI+vCGCKnPEsPZWb4x+6/npF/T65PNXKE=; b=VfoPav/A5gQ103tYoUUogDf9KC+mRc02TeCdlJRlXg9kz2T0X2OXwiy8wsl4XKMWC9+Mal r7oq9qm2Wkm+6jK7s1X3U3qEqextLfrvn6FayIk3yClyG5CH64GyM1uUOQMNUBxbuI/CLF /l++8srsZZWZwKH6G/YnMHqI94TE7kY= X-MC-Unique: pW9VZkf2NWKZVXHOUvqDqw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] nodedev|test: Implement support for validating node device XMLs Date: Thu, 20 Oct 2022 16:37:52 +0200 Message-Id: <922822dee7dbef2e06f6e01d0a5572ad2f5b4d53.1666276542.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666276715785100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- src/node_device/node_device_driver.c | 10 ++++++---- src/test/test_driver.c | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index d067234ab3..0fdfe1db96 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -876,8 +876,9 @@ nodeDeviceCreateXML(virConnectPtr conn, g_autofree char *wwpn =3D NULL; virNodeDevicePtr device =3D NULL; const char *virt_type =3D NULL; + bool validate =3D flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE; - virCheckFlags(0, NULL); + virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL); if (nodeDeviceInitWait() < 0) return NULL; @@ -885,7 +886,7 @@ nodeDeviceCreateXML(virConnectPtr conn, virt_type =3D virConnectGetType(conn); if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt= _type, - &driver->parserCallbacks, NULL, fals= e))) + &driver->parserCallbacks, NULL, vali= date))) return NULL; if (virNodeDeviceCreateXMLEnsureACL(conn, def) < 0) @@ -1397,8 +1398,9 @@ nodeDeviceDefineXML(virConnect *conn, const char *virt_type =3D NULL; g_autofree char *uuid =3D NULL; g_autofree char *name =3D NULL; + bool validate =3D flags & VIR_NODE_DEVICE_DEFINE_XML_VALIDATE; - virCheckFlags(0, NULL); + virCheckFlags(VIR_NODE_DEVICE_DEFINE_XML_VALIDATE, NULL); if (nodeDeviceInitWait() < 0) return NULL; @@ -1406,7 +1408,7 @@ nodeDeviceDefineXML(virConnect *conn, virt_type =3D virConnectGetType(conn); if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt= _type, - &driver->parserCallbacks, NULL, fals= e))) + &driver->parserCallbacks, NULL, vali= date))) return NULL; if (virNodeDeviceDefineXMLEnsureACL(conn, def) < 0) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 9b397e66b1..58c2a02561 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7688,10 +7688,12 @@ testNodeDeviceCreateXML(virConnectPtr conn, virNodeDeviceDef *objdef; g_autofree char *wwnn =3D NULL; g_autofree char *wwpn =3D NULL; + bool validate =3D flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE; - virCheckFlags(0, NULL); + virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL); - if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL= , NULL, NULL, false))) + if (!(def =3D virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL= , NULL, + NULL, validate))) goto cleanup; /* We run this simply for validation - it essentially validates that --=20 2.37.3