From nobody Sun Feb 8 10:32:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1744028950; cv=none; d=zohomail.com; s=zohoarc; b=ZyHx2i78tmT+GrP5pbChNL4hBJl9JLIMJGP0ypzY26lbEIgnQ4ZeY4wKoY+Ehp/U0g7fBkBdSFHeoVrZRIeMcnh/mSt2NHTNO0cYhkwKbXRnrfPgDIZ7NM0FpHQ4tqea774Ro+MPR9QCZNpZlXyP2lo6ushkK1oRofBog/XChQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744028950; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=1ExBlAJ1Oybvlm3m4lkHQrha7FE82DBjJylRdsO4ZDo=; b=gpAaGy6RNSY5FXoqRmPHkD1C+iRlAcDVDkKUhy5w4IT/rXcqVLDlj3WxSJbhstsRbDHpL1uPHABPKbEP4xlhgIgZ+SuILdFfVNkF94LfG/lxrv1ywW8jOpt5DiOwFOzn8Xd0XPgc/B6prALtXJYDfZmE5kCT0OBtRKybouMbIyk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17440289503891004.4118303811807; Mon, 7 Apr 2025 05:29:10 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id AA8D6158A; Mon, 7 Apr 2025 08:29:09 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E847614D3; Mon, 7 Apr 2025 08:28:47 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7859214D3; Mon, 7 Apr 2025 08:28:45 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D308814C8 for ; Mon, 7 Apr 2025 08:28:44 -0400 (EDT) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-442-Vc1t0hmwO6-9XCOmTTVNyg-1; Mon, 07 Apr 2025 08:28:41 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7868119560B4 for ; Mon, 7 Apr 2025 12:28:40 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.com (unknown [10.43.2.246]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E2BD19560AD; Mon, 7 Apr 2025 12:28:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744028924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dz3eqxjdy/9gN0Bva/2yklq7Fy1fDfJtfsNfrJkfxJ4=; b=GHiDn1h2SYbuxC5HilCYFbHA+kZ+hnED4h/cJwb6UUwwkaVqA8qTM+iZCbXQX/JA8y5a7R TpAktbhpMx2b+zu+S6s4pZofAScsRRMjFgOTQAyLcP2j9Mk3K7y/nhwbO5fNug1rcNfFfK XNiFwyC/c11VyaSmlS3aV52rYg8dWKQ= X-MC-Unique: Vc1t0hmwO6-9XCOmTTVNyg-1 X-Mimecast-MFC-AGG-ID: Vc1t0hmwO6-9XCOmTTVNyg_1744028920 To: devel@lists.libvirt.org Subject: [PATCH] storage: virStorageVolDefParse and storageVolCreateXML flags fix Date: Mon, 7 Apr 2025 14:25:43 +0200 Message-ID: <20250407122816.278358-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iVxrUsYQEdLbthe-YSf1hkryFMbJvU3H60LwjbLOpGk_1744028920 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5QEBRKTRFDJEAAKFDE53HEN75L7GYJWV X-Message-ID-Hash: 5QEBRKTRFDJEAAKFDE53HEN75L7GYJWV X-MailFrom: kshcheti@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Kirill Shchetiniuk X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1744028951893019000 Content-Type: text/plain; charset="utf-8"; x-default="true" When the new storage was created using virsh with --validate option following errors occurred: # virsh vol-create default --file vol-def.xml --validate error: Failed to create vol from vol-def.xml error: unsupported flags (0x4) in function virStorageVolDefParseXML and after virStorageVolDefParse fix: # virsh vol-create default --file vol-def.xml --validate error: Failed to create vol from vol-def.xml error: unsupported flags (0x4) in function storageBackendCreateQemuImg Clear the VIR_STORAGE_VOL_CREATE_VALIDATE flag before virStorageVolDefParseXML and backend->buildVol (traces down to storageBackendCreateQemuImg) calls, as the XML schema validation is already complete within previous steps and there is no validation later. Signed-off-by: Kirill Shchetiniuk --- NEWS.rst | 5 +++++ src/conf/storage_conf.c | 2 ++ src/storage/storage_driver.c | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS.rst b/NEWS.rst index e2dc4e508b..dd345bad7b 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -28,6 +28,11 @@ v11.3.0 (unreleased) =20 * **Bug fixes** =20 + * storage: Fix new volume creation + + No more errors occur when new storage volume is being created + using ``vol-create`` with ``--validate`` option. + =20 v11.2.0 (2025-04-01) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 68842004b7..f6d804bb39 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1409,6 +1409,8 @@ virStorageVolDefParse(virStoragePoolDef *pool, "volume", &ctxt, "storagevol.rng", validate))) return NULL; =20 + flags &=3D ~(VIR_STORAGE_VOL_CREATE_VALIDATE); + return virStorageVolDefParseXML(pool, ctxt, flags); } =20 diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 86c03762d2..2f5a26bbef 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1877,6 +1877,7 @@ storageVolCreateXML(virStoragePoolPtr pool, virStorageVolPtr vol =3D NULL, newvol =3D NULL; g_autoptr(virStorageVolDef) voldef =3D NULL; unsigned int parseFlags =3D VIR_VOL_XML_PARSE_OPT_CAPACITY; + unsigned int buildFlags =3D flags; =20 virCheckFlags(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA | VIR_STORAGE_VOL_CREATE_VALIDATE, NULL); @@ -1953,8 +1954,8 @@ storageVolCreateXML(virStoragePoolPtr pool, voldef->building =3D true; virObjectUnlock(obj); =20 - buildret =3D backend->buildVol(obj, buildvoldef, flags); + buildFlags &=3D ~(VIR_STORAGE_VOL_CREATE_VALIDATE); + buildret =3D backend->buildVol(obj, buildvoldef, buildFlags); =20 VIR_FREE(buildvoldef); =20 -- 2.48.1