From nobody Mon Feb 9 06:27:58 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=1629816716; cv=none; d=zohomail.com; s=zohoarc; b=NBIAp0yLSDNNwvAajhOs1pOsaHBdgvy/QLtFttIL7a+Q38Iasnp0jH2KVSvu4LjGLCI4lKQ45vM0HgVkI8A8oVWtEEp0rI1OHpVqBzPMVnVV3PtFrdZ7F6tLbmYjj91npv+Wu1aOqJv8oBKpDfvypwt1/HonGPiINz301Zfw49c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816716; 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=EkobCs7/3Nnx4EziO5KYoaMWIFX33vGFL+sQCm2+/uI=; b=BoKv5LDSo4BbrKiRnNLBCpDAZtM5NsQ7eTbLlit9WBCSSwEXfQetReCGT33hdLx3JhfJb5JmxfuIBQkxwoeGOC0x5mCqQ0i+Gj3E0edZqWdhky223KaekJNBXtLLd8vvno+cuw1I7PhDTHzI4fHlkQHDWcbg5wQzymsJiQqx+BQ= 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 1629816716196656.7963195842809; Tue, 24 Aug 2021 07:51:56 -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-106-oR4qhJziPeCO5Hz3gweSiQ-1; Tue, 24 Aug 2021 10:51:53 -0400 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 EC106760C5; Tue, 24 Aug 2021 14:51:47 +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 CD3D867899; Tue, 24 Aug 2021 14:51:47 +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 962785003E; Tue, 24 Aug 2021 14:51:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEpYGR007254 for ; Tue, 24 Aug 2021 10:51:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68E3C60C82; Tue, 24 Aug 2021 14:51:34 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id E665260C0F for ; Tue, 24 Aug 2021 14:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816715; 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=EkobCs7/3Nnx4EziO5KYoaMWIFX33vGFL+sQCm2+/uI=; b=An7/XeqCjWClHlC1WrRL1HwontbIr7nfeLI6PSsxxSOcEiDjc8H+HVLzcy1G5QtkA6/+VZ vxCfeCCc3Xyz6rWIINbHlFvw2w7LrP0O6IGZeWHrHWfHnqCoVGJ/AoS99sn/BIwJExXWkp xp3Tvy5IhY6y+FiQOGtaWGDrxsJJsKQ= X-MC-Unique: oR4qhJziPeCO5Hz3gweSiQ-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 4/4] virsh: add support for '--validate' option in define storage pool Date: Tue, 24 Aug 2021 16:51:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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) X-ZM-MESSAGEID: 1629816717482100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kristina Hanicova --- docs/manpages/virsh.rst | 4 +++- tools/virsh-pool.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 850a862fd9..2204bed3bb 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5958,10 +5958,12 @@ pool-define =20 :: =20 - pool-define file + pool-define file [--validate] =20 Define an inactive persistent storage pool or modify an existing persisten= t one from the XML *file*. +Optionally, the format of the input XML file can be validated against an +internal RNG schema with *--validate*. =20 =20 pool-define-as diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index f0ee95bdf8..1a2ab8cc53 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -520,7 +520,10 @@ static const vshCmdInfo info_pool_define[] =3D { =20 static const vshCmdOptDef opts_pool_define[] =3D { VIRSH_COMMON_OPT_FILE(N_("file containing an XML pool description")), - + {.name =3D "validate", + .type =3D VSH_OT_BOOL, + .help =3D N_("validate the XML against the schema") + }, {.name =3D NULL} }; =20 @@ -531,15 +534,19 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd) const char *from =3D NULL; bool ret =3D true; g_autofree char *buffer =3D NULL; + unsigned int flags =3D 0; virshControl *priv =3D ctl->privData; =20 if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0) return false; =20 + if (vshCommandOptBool(cmd, "validate")) + flags |=3D VIR_STORAGE_POOL_DEFINE_VALIDATE; + if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) return false; =20 - pool =3D virStoragePoolDefineXML(priv->conn, buffer, 0); + pool =3D virStoragePoolDefineXML(priv->conn, buffer, flags); =20 if (pool !=3D NULL) { vshPrintExtra(ctl, _("Pool %s defined from %s\n"), --=20 2.31.1