From nobody Mon Feb 9 17:07:36 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=1666276725; cv=none; d=zohomail.com; s=zohoarc; b=VogcxPZNEMfWgOe+VLIiU3beBlqPMeqpVekJ2kgA58zWAjlEWjqgjIU3EWeH3/tTooJY5sAJWLZebAak6Ft72JP2RUXD7QbQytayXCv7krBTWmgiNjDn6rflcliS1OAXfqZRSqDlgRCKBv6qKZCalozEU1nJGacVesuSR4PHGjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666276725; 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=ycAyE9HeDhqDPwTxgecrTJ088d4AQUxx+NJA2LPUADE=; b=NZXpdyyryiJWQggxyh+WjJ7ceddtSZfV6EZSbwGOBemIYKa/9jNL59EP939fPVAYhpq4xTcdfTDg+bM8MFYTUDm+Qmd7ygLCJ6oTWE1eauroDRfatg7fc1Jeb76FZBwAiUzaa1R0xYq+E9fnzwZFpPB8Zc+qCnVaM5tGEW4YjPY= 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 1666276725676451.163214045117; Thu, 20 Oct 2022 07:38:45 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-5SdCJKS5OC6gP1XWrWb-TQ-1; Thu, 20 Oct 2022 10:38:34 -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 905238065ED; Thu, 20 Oct 2022 14:38:28 +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 583831401CD3; Thu, 20 Oct 2022 14:38:28 +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 7E5061946A7E; Thu, 20 Oct 2022 14:38:10 +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 18E5119465B9 for ; Thu, 20 Oct 2022 14:38:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5FE9439D7C; Thu, 20 Oct 2022 14:38:01 +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 C9ED51759E for ; Thu, 20 Oct 2022 14:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666276724; 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=ycAyE9HeDhqDPwTxgecrTJ088d4AQUxx+NJA2LPUADE=; b=MuLK3hbB+n/wJIcxB8MTzDHyrGoF4OpNu04K/TcuFdis/BMM5nBiLV2AJh87BsWGJKD8WU N9vtq/iwqzkzw5a4VAB3F2ifk8ODguMNvzff6j9MZSUqZZTF8TC4hAJ+i3H9ZRHNbP4vBq sEr5hVSCCzPDzCe/31nVPFMKtYCfo5E= X-MC-Unique: 5SdCJKS5OC6gP1XWrWb-TQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] conf: storage: Add support for validating storage vol XML to virStorageVolDefParse Date: Thu, 20 Oct 2022 16:37:53 +0200 Message-Id: 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: 1666276727736100005 Content-Type: text/plain; charset="utf-8" Introduce the VIR_VOL_XML_PARSE_VALIDATE parser flag and wire it up into the validator. Signed-off-by: Peter Krempa --- src/conf/storage_conf.c | 3 ++- src/conf/storage_conf.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 0f4fe1451e..72c53872cb 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1407,9 +1407,10 @@ virStorageVolDefParse(virStoragePoolDef *pool, { g_autoptr(xmlDoc) xml =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; + bool validate =3D flags & VIR_VOL_XML_PARSE_VALIDATE; if (!(xml =3D virXMLParse(filename, xmlStr, _("(storage_volume_definit= ion)"), - "volume", &ctxt, NULL, false))) + "volume", &ctxt, "storagevol.rng", validate))) return NULL; return virStorageVolDefParseXML(pool, ctxt, flags); diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index bbfdbc2f2f..fc67957cfe 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -284,6 +284,8 @@ typedef enum { VIR_VOL_XML_PARSE_NO_CAPACITY =3D 1 << 0, /* do not require volume capacity if the volume has a backing store */ VIR_VOL_XML_PARSE_OPT_CAPACITY =3D 1 << 1, + /* validate the XML against the RNG schema */ + VIR_VOL_XML_PARSE_VALIDATE =3D 1 << 2, } virStorageVolDefParseFlags; virStorageVolDef * --=20 2.37.3