From nobody Tue Feb 10 09:24:36 2026 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=1628685756; cv=none; d=zohomail.com; s=zohoarc; b=LYVXB10mSd/oX1bQ7vhnXNyT3GOsi43dw2Avgrzi33RXVotO3V90UH9AbsKwVKs4RRi2kLVk69WqCYMgrkP6cGcjUfUF58brc7oDMGVw8lTdj3WIBQlvhaG62hU75T4zIR7QTNGubrA+J0JleoaSLxfZvhJ6WqZGfPem/DCqGWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628685756; 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=I/oKVLMst+LOVPb5kbvmJuqtcTIK2pI9gdPQXZRGDDo=; b=njST/X3fHC4sZTqtklvGPt4ySwXabX1uSWEWxhB3dYqOwrGKRkhHdWgkrLf4U9upUsJeK/7xHlhwilWfJvDg4HlKZQTd8FLN+LsfrmR2CLz0P07Hh4y/XkJBYK7Nfr6phtxoBkLOUk5XZVqQVj04EjYEr9gF/YUiE4/Lexx6H+o= 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) 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 1628685756503267.31008792617126; Wed, 11 Aug 2021 05:42:36 -0700 (PDT) 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-517-i2u0EmnzOA2CueMDLHaPjw-1; Wed, 11 Aug 2021 08:42:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0004F8799F5; Wed, 11 Aug 2021 12:42:28 +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 D432C60BF1; Wed, 11 Aug 2021 12:42:28 +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 A40204A700; Wed, 11 Aug 2021 12:42: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 17BCbjO1020076 for ; Wed, 11 Aug 2021 08:37:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73E6581F7B; Wed, 11 Aug 2021 12:37:45 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id F096A81F76 for ; Wed, 11 Aug 2021 12:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628685755; 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=I/oKVLMst+LOVPb5kbvmJuqtcTIK2pI9gdPQXZRGDDo=; b=RXreXaS0TetLjYGpXS12MuINaPiGFRvIC3PueKVXmJ+nzZuUGoP/tlHM9Y1nk7sEG0Qeq5 XJGmeIc94RUUW77ac6lNbHTIdkK0sTrqKTw5IeypkZrrhv42Tawq98GBpq2LzWrS71b2Ym lOQckt5qezLXw+iPFcRLqP2p8/8sOoo= X-MC-Unique: i2u0EmnzOA2CueMDLHaPjw-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 3/5] domain_conf: replace validation with variables passed to virXMLParse() Date: Wed, 11 Aug 2021 14:36:46 +0200 Message-Id: <2530a3fdfcc69c408f1292acdfa4fe2fc459c91c.1628684959.git.khanicov@redhat.com> 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 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.12 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) X-ZM-MESSAGEID: 1628685756745100001 Content-Type: text/plain; charset="utf-8" virXMLParse() now allows to validate xml against schema directly, eliminating the need to do it individually. Signed-off-by: Kristina Hanicova --- src/conf/domain_conf.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b996a0cc3c..492d5524ec 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19515,7 +19515,7 @@ virDomainDefControllersParse(virDomainDef *def, } =20 static virDomainDef * -virDomainDefParseXML(xmlDocPtr xml, +virDomainDefParseXML(xmlDocPtr xml G_GNUC_UNUSED, xmlXPathContextPtr ctxt, virDomainXMLOption *xmlopt, unsigned int flags) @@ -19529,18 +19529,6 @@ virDomainDefParseXML(xmlDocPtr xml, g_autofree xmlNodePtr *nodes =3D NULL; g_autofree char *tmp =3D NULL; =20 - if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { - g_autofree char *schema =3D NULL; - - schema =3D virFileFindResource("domain.rng", - abs_top_srcdir "/docs/schemas", - PKGDATADIR "/schemas"); - if (!schema) - return NULL; - if (virXMLValidateAgainstSchema(schema, xml) < 0) - return NULL; - } - if (!(def =3D virDomainDefNew())) return NULL; =20 @@ -20400,7 +20388,8 @@ virDomainDefParse(const char *xmlStr, virDomainDef *def =3D NULL; int keepBlanksDefault =3D xmlKeepBlanksDefault(0); xmlNodePtr root; - if (!(xml =3D virXMLParse(filename, xmlStr, _("(domain_definition)"), = NULL, false))) + if (!(xml =3D virXMLParse(filename, xmlStr, _("(domain_definition)"), = "domain.rng", + flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA))) goto cleanup; =20 root =3D xmlDocGetRootElement(xml); --=20 2.31.1