From nobody Sun Dec 14 02:17:06 2025 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=1750867292; cv=none; d=zohomail.com; s=zohoarc; b=Kx1NY37i/azyCGthGpPxFi5kq+2NI7vdizTH2z0gRmUSfHb1UAOgjn62nseHSK34+MK1goMSUmiTRp8InleHvw1xp9ZQc8xKViT+LWwtZ5zYOf0eZ7/egAhUWdkwpZY1iGl2BGu6tn7fTXSg2hxVDg1VGdkRI+ECJUKtgsUWPB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750867292; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=kQFys4e/VLZxALDoaFe2OSW1F7ZwPNwJOfM+tXe+XF8=; b=UH76BCU9ubhDmi49SvuQIQRHoln4mvbcc79RBzXlBgDYAW+PaVoqXYxwKWXcRhVQNr+Jvs6LgO2tuTrvGrAjVPPcbwCZddK4doKVvA+5n2DxPhp0ByfFDrMY68d6nnXy3qowXy5scL4A1fPWIBDjY/2c9yHv6WweApTUa3X9ZQc= 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 1750867292619155.76983506122997; Wed, 25 Jun 2025 09:01:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B03BD151E; Wed, 25 Jun 2025 12:01:31 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 846251527; Wed, 25 Jun 2025 11:57:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E427814DD; Wed, 25 Jun 2025 11:57:19 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 80843118 for ; Wed, 25 Jun 2025 11:57:15 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-jkwoqASgMni0yrWocJ1WYQ-1; Wed, 25 Jun 2025 11:57:10 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0171F193D2A0; Wed, 25 Jun 2025 15:56:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B72FA18003FC; Wed, 25 Jun 2025 15:56:42 +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=1750867035; 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: in-reply-to:in-reply-to:references:references; bh=AsZtldfaH9gpqEIkNZbrRkzq5oGEF2ePeffK3ZeEDvo=; b=bUR/gLzfn7os2bZjz78hkBPpNjaUUuZ8KXer6Tx7WKAcllf086rZxcwvn03ktZUfUoP6a6 s1sGhH6zOoz3N15sYZx53lbPUAY/w4k/dhD+Ouw9Gh7Ag+ymr6m0g3n3IhrGv7UKOMBsLj QCKsXr72Fz/p7EDAgUMfsDyk0Gl7xnU= X-MC-Unique: jkwoqASgMni0yrWocJ1WYQ-1 X-Mimecast-MFC-AGG-ID: jkwoqASgMni0yrWocJ1WYQ_1750867029 To: devel@lists.libvirt.org Subject: [PATCH 1/4] conf: Turn 'protocol' field of virStorageSource into proper enum type Date: Wed, 25 Jun 2025 17:56:34 +0200 Message-ID: <9656a6567b7aaf14519083b0dbbbca9d88936092.1750866876.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: SvgN9l8hCnXC2D-_kcSX9odauzC40PZLAb9TqTf-4qk_1750867029 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MJOJ23HI66ME7SMBN2UVL7TOK6GBAV4C X-Message-ID-Hash: MJOJ23HI66ME7SMBN2UVL7TOK6GBAV4C X-MailFrom: pkrempa@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: Rodrigo Prieto , Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750867383553116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Convert the member to the appropriate type, fix few offending parse calls and remove explicit typecasts in switch(). Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 5 +---- src/conf/domain_validate.c | 2 +- src/conf/storage_source_conf.h | 2 +- src/libxl/libxl_conf.c | 2 +- src/libxl/xen_xl.c | 2 +- src/qemu/qemu_block.c | 7 +++---- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_snapshot.c | 4 ++-- .../storage_source_backingstore.c | 21 ++++++++++++------- 9 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1e24e41a48..f1057b406c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7368,15 +7368,12 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, virStorageSource *src, unsigned int flags) { - virStorageNetProtocol protocol; xmlNodePtr tmpnode; if (virXMLPropEnum(node, "protocol", virStorageNetProtocolTypeFromStri= ng, - VIR_XML_PROP_REQUIRED, &protocol) < 0) + VIR_XML_PROP_REQUIRED, &src->protocol) < 0) return -1; - src->protocol =3D protocol; - if (!(src->path =3D virXMLPropString(node, "name")) && src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_NBD) { virReportError(VIR_ERR_XML_ERROR, "%s", diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b28af7fa56..87fbefe4f1 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -494,7 +494,7 @@ virDomainDiskDefValidateSourceChainOne(const virStorage= Source *src) return -1; } - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_ISCSI: case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index ebddf28cd6..362897f058 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -301,7 +301,7 @@ struct _virStorageSource { virStorageType type; char *path; char *fdgroup; /* name of group of file descriptors the user wishes to= use instead of 'path' */ - int protocol; /* virStorageNetProtocol */ + virStorageNetProtocol protocol; char *volume; /* volume name for remote storage */ char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index bdd30dd65a..36fba4a555 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1068,7 +1068,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSource *src, g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; size_t i; - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NBD: case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index ec8de30c01..b83ed45c46 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1448,7 +1448,7 @@ xenFormatXLDiskSrcNet(virStorageSource *src) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; size_t i; - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NBD: case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 32568d4ae6..a59c0a0a03 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1046,14 +1046,13 @@ qemuBlockStorageSourceGetBackendProps(virStorageSou= rce *src, break; } - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_GLUSTER: driver =3D "gluster"; if (!(fileprops =3D qemuBlockStorageSourceGetGlusterProps(src,= onlytarget))) return NULL; break; - case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: case VIR_STORAGE_NET_PROTOCOL_FTP: @@ -1969,7 +1968,7 @@ qemuBlockGetBackingStoreString(virStorageSource *src, src->readahead =3D=3D 0 && src->reconnectDelay =3D=3D 0) { - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NBD: case VIR_STORAGE_NET_PROTOCOL_HTTP: case VIR_STORAGE_NET_PROTOCOL_HTTPS: @@ -2352,7 +2351,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorag= eSource *src, break; case VIR_STORAGE_TYPE_NETWORK: - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_GLUSTER: driver =3D "gluster"; if (!(location =3D qemuBlockStorageSourceGetGlusterProps(src, = false))) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0d2548d8d4..cf5083de34 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8943,7 +8943,7 @@ qemuDomainPrepareStorageSourceTLS(virStorageSource *s= rc, if (virStorageSourceGetActualType(src) !=3D VIR_STORAGE_TYPE_NETWORK) return 0; - switch ((virStorageNetProtocol) src->protocol) { + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_VXHS: /* vxhs is no longer supported */ break; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8128154749..764aafda4d 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -658,7 +658,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapsh= otDiskDef *snapdisk, break; case VIR_STORAGE_TYPE_NETWORK: - switch ((virStorageNetProtocol) domdisk->src->protocol) { + switch (domdisk->src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NONE: case VIR_STORAGE_NET_PROTOCOL_NBD: case VIR_STORAGE_NET_PROTOCOL_RBD: @@ -883,7 +883,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDef *disk, return 0; case VIR_STORAGE_TYPE_NETWORK: - switch ((virStorageNetProtocol) disk->src->protocol) { + switch (disk->src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NONE: case VIR_STORAGE_NET_PROTOCOL_NBD: case VIR_STORAGE_NET_PROTOCOL_RBD: diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_f= ile/storage_source_backingstore.c index 80681924ea..4a273fe46c 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -44,6 +44,7 @@ virStorageSourceParseBackingURI(virStorageSource *src, const char *path =3D NULL; int transport =3D 0; g_auto(GStrv) scheme =3D NULL; + int protocol; if (!(uri =3D virURIParse(uristr))) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -59,12 +60,13 @@ virStorageSourceParseBackingURI(virStorageSource *src, return -1; if (!scheme[0] || - (src->protocol =3D virStorageNetProtocolTypeFromString(scheme[0]))= < 0) { + (protocol =3D virStorageNetProtocolTypeFromString(scheme[0])) < 0)= { virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid backing protocol '%1$s'"), NULLSTR(scheme[0])); return -1; } + src->protocol =3D protocol; if (scheme[1]) { if ((transport =3D virStorageNetHostTransportTypeFromString(scheme= [1])) < 0) { @@ -370,7 +372,8 @@ virStorageSourceParseBackingColon(virStorageSource *src, const char *path) { const char *p; - g_autofree char *protocol =3D NULL; + g_autofree char *protocol_str =3D NULL; + int protocol; if (!(p =3D strchr(path, ':'))) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -379,16 +382,18 @@ virStorageSourceParseBackingColon(virStorageSource *s= rc, return -1; } - protocol =3D g_strndup(path, p - path); + protocol_str =3D g_strndup(path, p - path); - if ((src->protocol =3D virStorageNetProtocolTypeFromString(protocol)) = < 0) { + if ((protocol =3D virStorageNetProtocolTypeFromString(protocol_str)) <= 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid backing protocol '%1$s'"), - protocol); + protocol_str); return -1; } - switch ((virStorageNetProtocol) src->protocol) { + src->protocol =3D protocol; + + switch (src->protocol) { case VIR_STORAGE_NET_PROTOCOL_NBD: if (virStorageSourceParseNBDColonString(path, src) < 0) return -1; @@ -404,7 +409,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, case VIR_STORAGE_NET_PROTOCOL_NONE: virReportError(VIR_ERR_INTERNAL_ERROR, _("backing store parser is not implemented for prot= ocol %1$s"), - protocol); + protocol_str); return -1; case VIR_STORAGE_NET_PROTOCOL_HTTP: @@ -419,7 +424,7 @@ virStorageSourceParseBackingColon(virStorageSource *src, case VIR_STORAGE_NET_PROTOCOL_NFS: virReportError(VIR_ERR_INTERNAL_ERROR, _("malformed backing store path for protocol %1$s"), - protocol); + protocol_str); return -1; } --=20 2.49.0 From nobody Sun Dec 14 02:17:06 2025 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=1750867519; cv=none; d=zohomail.com; s=zohoarc; b=hLPH2xFcQ+5bSBxqg2oPhv/Ye/I8llwkbnTNNx/tGuImKrLxf8S527CbredLIwh6M5W86vWbUbpQpaxJvK6rboEz98idLg5oJWgpf2D6mxlipSvS5IveWD6BNadM2XVyXCNv2SwDfdBoXb35fc7KCdA7/bOm7Q3d2J6PDdpN7w0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750867519; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=bspEkDm6Kkx2hEo8bjMaUZjr9FKKzkUK7DMlffVV6DE=; b=d/y55+ckxgUjMhfi/QIC2AVrUhveexmUkYVby8B0jYRY51Bc29qvgfpN3tM3KTd038bYh/XemOHdd6fL4F+XMGVP5pCx07HgBrF2rEmdp6nV32S3A8F06CCOZEz+rTeKBiszabk+XdJNBb2j6iGUPpDPdH1uAHy4CfEqygrRtjU= 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 1750867519785341.6989402085868; Wed, 25 Jun 2025 09:05:19 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D82B481D; Wed, 25 Jun 2025 12:05:18 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9CA3F14DC; Wed, 25 Jun 2025 11:58:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E8A4A1499; Wed, 25 Jun 2025 11:58:15 -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 EE68914DC for ; Wed, 25 Jun 2025 11:57:19 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-5SwMZJDKMImYE10WHFErOg-1; Wed, 25 Jun 2025 11:57:16 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68BF718680E6; Wed, 25 Jun 2025 15:56:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 89D7F18002B0; Wed, 25 Jun 2025 15:56:44 +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=1750867039; 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: in-reply-to:in-reply-to:references:references; bh=hwcoSdvqTBboAUmXhIKn3040XUrr4IyYuqAChV82Rxw=; b=LdsMp3YkvOhEMGCsNXxjxXHBSi1Wqi0CfDxeXwM+S6jUmwAciQv4D2gcYEkNGJIqt6e6O0 qqtlrleSD6BC8NgtmPwhBsByHXLkD6zzc5g/Hvfrd1HlcXjsRKs+ZcxGf+6Ab8lsBYEeIV bcfSf4rARmgDHqq/XgFSK8BHmnya0PA= X-MC-Unique: 5SwMZJDKMImYE10WHFErOg-1 X-Mimecast-MFC-AGG-ID: 5SwMZJDKMImYE10WHFErOg_1750867035 To: devel@lists.libvirt.org Subject: [PATCH 2/4] virStorageFileBackendGlusterInit: Refactor cleanup Date: Wed, 25 Jun 2025 17:56:35 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: cwJyWqWIBf1kZDF2gNxd3vMhwIFxIQZczF_exLvQhJE_1750867035 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: XFS2XUPE3TWJ6W3N4CL4JWLVVGERY26J X-Message-ID-Hash: XFS2XUPE3TWJ6W3N4CL4JWLVVGERY26J X-MailFrom: pkrempa@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: Rodrigo Prieto , Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750867521382116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Automatically free 'priv' and call 'glfs_fini()' directly from the two error paths. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- .../storage_file_backend_gluster.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/storage_file/storage_file_backend_gluster.c b/src/storage_= file/storage_file_backend_gluster.c index df4df0f128..abb1c47309 100644 --- a/src/storage_file/storage_file_backend_gluster.c +++ b/src/storage_file/storage_file_backend_gluster.c @@ -97,7 +97,7 @@ static int virStorageFileBackendGlusterInit(virStorageSource *src) { virStorageDriverData *drv =3D src->drv; - virStorageFileBackendGlusterPriv *priv =3D NULL; + g_autofree virStorageFileBackendGlusterPriv *priv =3D NULL; size_t i; if (!src->volume) { @@ -117,31 +117,27 @@ virStorageFileBackendGlusterInit(virStorageSource *sr= c) if (!(priv->vol =3D glfs_new(src->volume))) { virReportError(VIR_ERR_OPERATION_FAILED, _("failed to create glfs object for '%1$s'"), src->= volume); - goto error; + return -1; } for (i =3D 0; i < src->nhosts; i++) { - if (virStorageFileBackendGlusterInitServer(priv, src->hosts + i) <= 0) - goto error; + if (virStorageFileBackendGlusterInitServer(priv, src->hosts + i) <= 0) { + glfs_fini(priv->vol); + return -1; + } } if (glfs_init(priv->vol) < 0) { virReportSystemError(errno, _("failed to initialize gluster connection (s= rc=3D%1$p priv=3D%2$p)"), src, priv); - goto error; + glfs_fini(priv->vol); + return -1; } - drv->priv =3D priv; + drv->priv =3D g_steal_pointer(&priv); return 0; - - error: - if (priv->vol) - glfs_fini(priv->vol); - VIR_FREE(priv); - - return -1; } --=20 2.49.0 From nobody Sun Dec 14 02:17:06 2025 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=1750867491; cv=none; d=zohomail.com; s=zohoarc; b=GD6gjqm+oilwxjBmPnF/NvZsrRbNR/qP78fHYOc93vwloT/bCtiZDySFVm5UfyNg07hkj7uLTxW5p+pjSF6m1M2f7iRS+HvT4jfq9iXSdO3coPecN/UJMBwUvgMFQdTjsk6TkrQFOAlkGSJevvrQ2PVujfJYQTK7wnytADbFaTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750867491; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=uB2MH8Y2ahir/eB+fie0vZgJ5qCe9O7dzZgF46omQIc=; b=cL0ZbiMr2GPxJLm0NNNtiAZCD8O+O1CzrFsj4OpPpLaM/32vW2fcmGUtKJkPQNFtGz2mlY+xH5qUyCAmehtgcqqDl2TiXNIELlfPaKxWZvc9aUArDXYEdA1e1wFR7AuHL86WOROq5ngJRhW6AsRVUbPewLO3PYzwj4LS36fI8oc= 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 1750867491222706.0178945482851; Wed, 25 Jun 2025 09:04:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3BB6114A8; Wed, 25 Jun 2025 12:04:50 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2D992154D; Wed, 25 Jun 2025 11:57:25 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BCC041528; Wed, 25 Jun 2025 11:57:22 -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 C610A81D for ; Wed, 25 Jun 2025 11:57:17 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-FrC_TiksO4C1Kko3aHeK7A-1; Wed, 25 Jun 2025 11:57:13 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3230C1808984; Wed, 25 Jun 2025 15:56:48 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DE98B18002B0; Wed, 25 Jun 2025 15:56:46 +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=1750867037; 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: in-reply-to:in-reply-to:references:references; bh=mVlLdSxrP5JN1UsdQ6Z578cjOAb3amyXi6K8NUz2uYQ=; b=YQlkUZgZzBgO+gJS4aQ60zPH1YYRWI0Fg0mSO8rD846N11k2aEpKKKsMqH9erNBbF0roLg WaP/m3+RzXWIYQti2daTKpYqB+m3kWwecNIG4/xbcKmf9B1HoeLZJtszQYi5I3P9TCkKNj jGok6J6DbCPzcU3H3Gg7Req5elj23U8= X-MC-Unique: FrC_TiksO4C1Kko3aHeK7A-1 X-Mimecast-MFC-AGG-ID: FrC_TiksO4C1Kko3aHeK7A_1750867033 To: devel@lists.libvirt.org Subject: [PATCH 3/4] virStorageSource: Eliminate 'volume' field Date: Wed, 25 Jun 2025 17:56:36 +0200 Message-ID: <442c42b1662a5d7c9ddd3976dd7ba9e10fbab8ea.1750866876.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 041-GoV6QQCyM7_vHuEgxL1JB9ixaRDtaBFiSnO2k_E_1750867033 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: MYRRCYHNPK2ZGBI45VYF53QRZ5PGGSS5 X-Message-ID-Hash: MYRRCYHNPK2ZGBI45VYF53QRZ5PGGSS5 X-MailFrom: pkrempa@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: Rodrigo Prieto , Peter Krempa 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750867497332116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa While historically we've stored the 'pool' and 'image' properties of RBD and gluster images in separate fields but they are presented in a single field in the XML. This creates multiple points where they need to be separated and combined. Introduce helper 'virStorageSourceNetworkProtocolPathSplit' which will do that at the point of use rather than everywhere in the code. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 30 ++-------- src/conf/storage_source_conf.c | 56 ++++++++++++++++++- src/conf/storage_source_conf.h | 7 ++- src/libvirt_private.syms | 1 + src/libxl/libxl_conf.c | 2 +- src/libxl/xen_xl.c | 2 +- src/qemu/qemu_block.c | 32 +++++++---- .../storage_file_backend_gluster.c | 41 +++++++------- src/storage_file/storage_source.c | 2 - .../storage_source_backingstore.c | 35 ++---------- 10 files changed, 113 insertions(+), 95 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f1057b406c..c7bad53ae6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7381,6 +7381,9 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, return -1; } + if (virStorageSourceNetworkProtocolPathSplit(src->path, src->protocol,= NULL, NULL) < 0) + return -1; + if (virXMLPropTristateBool(node, "tls", VIR_XML_PROP_NONE, &src->haveTLS) < 0) return -1; @@ -7404,27 +7407,6 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, } } - /* for historical reasons we store the volume and image name in one XML - * element although it complicates thing when attempting to access the= m. */ - if (src->path && - (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER || - src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD)) { - char *tmp; - if (!(tmp =3D strchr(src->path, '/')) || - tmp =3D=3D src->path) { - virReportError(VIR_ERR_XML_ERROR, - _("can't split path '%1$s' into pool name and i= mage name"), - src->path); - return -1; - } - - src->volume =3D src->path; - - src->path =3D g_strdup(tmp + 1); - - tmp[0] =3D '\0'; - } - /* snapshot currently works only for remote disks */ src->snapshot =3D virXPathString("string(./snapshot/@name)", ctxt); @@ -23172,15 +23154,11 @@ virDomainDiskSourceFormatNetwork(virBuffer *attrB= uf, unsigned int flags) { size_t n; - g_autofree char *path =3D NULL; virBufferAsprintf(attrBuf, " protocol=3D'%s'", virStorageNetProtocolTypeToString(src->protocol)); - if (src->volume) - path =3D g_strdup_printf("%s/%s", src->volume, src->path); - - virBufferEscapeString(attrBuf, " name=3D'%s'", path ? path : src->path= ); + virBufferEscapeString(attrBuf, " name=3D'%s'", src->path); virBufferEscapeString(attrBuf, " query=3D'%s'", src->query); if (src->haveTLS !=3D VIR_TRISTATE_BOOL_ABSENT && diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 8a063be244..9014fa37e6 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -820,7 +820,6 @@ virStorageSourceCopy(const virStorageSource *src, def->path =3D g_strdup(src->path); def->fdgroup =3D g_strdup(src->fdgroup); - def->volume =3D g_strdup(src->volume); def->relPath =3D g_strdup(src->relPath); def->backingStoreRaw =3D g_strdup(src->backingStoreRaw); def->backingStoreRawFormat =3D src->backingStoreRawFormat; @@ -945,7 +944,6 @@ virStorageSourceIsSameLocation(virStorageSource *a, return false; if (STRNEQ_NULLABLE(a->path, b->path) || - STRNEQ_NULLABLE(a->volume, b->volume) || STRNEQ_NULLABLE(a->snapshot, b->snapshot)) return false; @@ -1152,7 +1150,6 @@ virStorageSourceClear(virStorageSource *def) VIR_FREE(def->path); VIR_FREE(def->fdgroup); - VIR_FREE(def->volume); VIR_FREE(def->vdpadev); VIR_FREE(def->snapshot); VIR_FREE(def->configFile); @@ -1445,3 +1442,56 @@ virStorageSourceFDTupleNew(void) { return g_object_new(vir_storage_source_fd_tuple_get_type(), NULL); } + + +/** + * virStorageSourceNetworkProtocolPathSplit: + * @path: path to split + * @protocol: protocol + * @pool: filled with pool name (may be NULL) + * @image: filled with image name (may be NULL) + * + * Historically libvirt accepted the specification of Gluster's volume and + * RBD's pool as part of the 'path' field, but internally many places requ= ire + * individual components. + * + * This helper validates and splits the path as appropriate for given prot= ocol. + * It's useful for 'gluster' and 'rbd' protocol but for validation can be = called + * with any protocol. + */ +int +virStorageSourceNetworkProtocolPathSplit(const char *path, + virStorageNetProtocol protocol, + char **pool, + char **image) +{ + + g_autofree char *pathcopy =3D g_strdup(path); + char *tmp; + + if (protocol !=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && + protocol !=3D VIR_STORAGE_NET_PROTOCOL_RBD) { + + if (image) + *image =3D g_steal_pointer(&pathcopy); + + return 0; + } + + if (!(tmp =3D strchr(pathcopy, '/')) || tmp =3D=3D pathcopy) { + virReportError(VIR_ERR_XML_ERROR, + _("can't split path '%1$s' into pool name and image= name"), + pathcopy); + return -1; + } + + tmp[0] =3D '\0'; + + if (pool) + *pool =3D g_steal_pointer(&pathcopy); + + if (image) + *image =3D g_strdup(tmp + 1); + + return 0; +} diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 362897f058..798ca20ac4 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -302,7 +302,6 @@ struct _virStorageSource { char *path; char *fdgroup; /* name of group of file descriptors the user wishes to= use instead of 'path' */ virStorageNetProtocol protocol; - char *volume; /* volume name for remote storage */ char *snapshot; /* for storage systems supporting internal snapshots */ char *configFile; /* some storage systems use config file as part of the source definition */ @@ -597,3 +596,9 @@ void virStorageSourceInitiatorClear(virStorageSourceInitiatorDef *initiator); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageAuthDef, virStorageAuthDefFree); + +int +virStorageSourceNetworkProtocolPathSplit(const char *path, + virStorageNetProtocol protocol, + char **pool, + char **image); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a8ebf9efd8..01a13048c5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1186,6 +1186,7 @@ virStorageSourceIsRelative; virStorageSourceIsSameLocation; virStorageSourceNetCookiesValidate; virStorageSourceNetworkAssignDefaultPorts; +virStorageSourceNetworkProtocolPathSplit; virStorageSourceNew; virStorageSourceNVMeDefFree; virStorageSourcePoolDefFree; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 36fba4a555..9d8301169b 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1096,7 +1096,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSource *src, return NULL; } - virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL); + virBufferStrcat(&buf, "rbd:", src->path, NULL); if (username) { virBufferEscape(&buf, '\\', ":", ":id=3D%s", username); diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index b83ed45c46..b2ff0edcf2 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1476,7 +1476,7 @@ xenFormatXLDiskSrcNet(virStorageSource *src) return NULL; } - virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL); + virBufferStrcat(&buf, "rbd:", src->path, NULL); virBufferAddLit(&buf, ":auth_supported=3Dnone"); diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index a59c0a0a03..9b370d4c7c 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -213,13 +213,9 @@ qemuBlockStorageSourceGetURI(virStorageSource *src) } if (src->path) { - if (src->volume) { - uri->path =3D g_strdup_printf("/%s/%s", src->volume, src->path= ); - } else { - uri->path =3D g_strdup_printf("%s%s", - g_path_is_absolute(src->path) ? ""= : "/", - src->path); - } + uri->path =3D g_strdup_printf("%s%s", + g_path_is_absolute(src->path) ? "" : "= /", + src->path); } uri->query =3D g_strdup(src->query); @@ -401,10 +397,17 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSourc= e *src, { g_autoptr(virJSONValue) servers =3D NULL; g_autoptr(virJSONValue) props =3D NULL; + g_autofree char *volume =3D NULL; + g_autofree char *path =3D NULL; if (!(servers =3D qemuBlockStorageSourceBuildHostsJSONSocketAddress(sr= c))) return NULL; + if (virStorageSourceNetworkProtocolPathSplit(src->path, + VIR_STORAGE_NET_PROTOCOL_= GLUSTER, + &volume, &path) < 0) + return NULL; + /* { driver:"gluster", * volume:"testvol", * path:"/a.img", @@ -412,8 +415,8 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSource = *src, * {type:"unix", socket:"/tmp/glusterd.socket"}, ...]} */ if (virJSONValueObjectAdd(&props, - "s:volume", src->volume, - "s:path", src->path, + "s:volume", volume, + "s:path", path, "a:server", &servers, NULL) < 0) return NULL; @@ -662,6 +665,13 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *sr= c, const char *username =3D NULL; g_autoptr(virJSONValue) authmodes =3D NULL; const char *keysecret =3D NULL; + g_autofree char *pool =3D NULL; + g_autofree char *image =3D NULL; + + if (virStorageSourceNetworkProtocolPathSplit(src->path, + VIR_STORAGE_NET_PROTOCOL_= RBD, + &pool, &image) < 0) + return NULL; if (src->nhosts > 0 && !(servers =3D qemuBlockStorageSourceBuildHostsJSONInetSocketAddres= s(src))) @@ -715,8 +725,8 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src, } if (virJSONValueObjectAdd(&ret, - "s:pool", src->volume, - "s:image", src->path, + "s:pool", pool, + "s:image", image, "S:snapshot", src->snapshot, "S:conf", src->configFile, "A:server", &servers, diff --git a/src/storage_file/storage_file_backend_gluster.c b/src/storage_= file/storage_file_backend_gluster.c index abb1c47309..8778995b6c 100644 --- a/src/storage_file/storage_file_backend_gluster.c +++ b/src/storage_file/storage_file_backend_gluster.c @@ -37,6 +37,7 @@ VIR_LOG_INIT("storage.storage_file_gluster"); typedef struct _virStorageFileBackendGlusterPriv virStorageFileBackendGlus= terPriv; struct _virStorageFileBackendGlusterPriv { glfs_t *vol; + char *image; }; static void @@ -45,12 +46,13 @@ virStorageFileBackendGlusterDeinit(virStorageSource *sr= c) virStorageDriverData *drv =3D src->drv; virStorageFileBackendGlusterPriv *priv =3D drv->priv; - VIR_DEBUG("deinitializing gluster storage file %p (gluster://%s:%u/%s%= s)", - src, src->hosts->name, src->hosts->port, src->volume, src->p= ath); + VIR_DEBUG("deinitializing gluster storage file %p (gluster://%s:%u/%s)= ", + src, src->hosts->name, src->hosts->port, src->path); if (priv->vol) glfs_fini(priv->vol); + VIR_FREE(priv->image); VIR_FREE(priv); drv->priv =3D NULL; } @@ -98,25 +100,25 @@ virStorageFileBackendGlusterInit(virStorageSource *src) { virStorageDriverData *drv =3D src->drv; g_autofree virStorageFileBackendGlusterPriv *priv =3D NULL; + g_autofree char *volume =3D NULL; + g_autofree char *image =3D NULL; size_t i; - if (!src->volume) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing gluster volume name for path '%1$s'"), - src->path); + if (virStorageSourceNetworkProtocolPathSplit(src->path, + VIR_STORAGE_NET_PROTOCOL_= GLUSTER, + &volume, &image) < 0) return -1; - } priv =3D g_new0(virStorageFileBackendGlusterPriv, 1); VIR_DEBUG("initializing gluster storage file %p " "(priv=3D'%p' volume=3D'%s' path=3D'%s') as [%u:%u]", - src, priv, src->volume, src->path, + src, priv, volume, image, (unsigned int)drv->uid, (unsigned int)drv->gid); - if (!(priv->vol =3D glfs_new(src->volume))) { + if (!(priv->vol =3D glfs_new(volume))) { virReportError(VIR_ERR_OPERATION_FAILED, - _("failed to create glfs object for '%1$s'"), src->= volume); + _("failed to create glfs object for '%1$s'"), volum= e); return -1; } @@ -135,6 +137,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src) return -1; } + priv->image =3D g_steal_pointer(&image); drv->priv =3D g_steal_pointer(&priv); return 0; @@ -148,7 +151,7 @@ virStorageFileBackendGlusterCreate(virStorageSource *sr= c) virStorageFileBackendGlusterPriv *priv =3D drv->priv; glfs_fd_t *fd =3D NULL; - if (!(fd =3D glfs_creat(priv->vol, src->path, + if (!(fd =3D glfs_creat(priv->vol, priv->image, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)= )) return -1; @@ -163,7 +166,7 @@ virStorageFileBackendGlusterUnlink(virStorageSource *sr= c) virStorageDriverData *drv =3D src->drv; virStorageFileBackendGlusterPriv *priv =3D drv->priv; - return glfs_unlink(priv->vol, src->path); + return glfs_unlink(priv->vol, priv->image); } @@ -174,7 +177,7 @@ virStorageFileBackendGlusterStat(virStorageSource *src, virStorageDriverData *drv =3D src->drv; virStorageFileBackendGlusterPriv *priv =3D drv->priv; - return glfs_stat(priv->vol, src->path, st); + return glfs_stat(priv->vol, priv->image, st); } @@ -193,15 +196,15 @@ virStorageFileBackendGlusterRead(virStorageSource *sr= c, *buf =3D NULL; - if (!(fd =3D glfs_open(priv->vol, src->path, O_RDONLY))) { + if (!(fd =3D glfs_open(priv->vol, priv->image, O_RDONLY))) { virReportSystemError(errno, _("Failed to open file '%1$s'"), - src->path); + priv->image); return -1; } if (offset > 0) { if (glfs_lseek(fd, offset, SEEK_SET) =3D=3D (off_t) -1) { - virReportSystemError(errno, _("cannot seek into '%1$s'"), src-= >path); + virReportSystemError(errno, _("cannot seek into '%1$s'"), priv= ->image); goto cleanup; } } @@ -216,7 +219,7 @@ virStorageFileBackendGlusterRead(virStorageSource *src, continue; if (r < 0) { VIR_FREE(*buf); - virReportSystemError(errno, _("unable to read '%1$s'"), src->p= ath); + virReportSystemError(errno, _("unable to read '%1$s'"), priv->= image); return r; } if (r =3D=3D 0) @@ -243,7 +246,7 @@ virStorageFileBackendGlusterAccess(virStorageSource *sr= c, virStorageDriverData *drv =3D src->drv; virStorageFileBackendGlusterPriv *priv =3D drv->priv; - return glfs_access(priv->vol, src->path, mode); + return glfs_access(priv->vol, priv->image, mode); } static int @@ -254,7 +257,7 @@ virStorageFileBackendGlusterChown(const virStorageSourc= e *src, virStorageDriverData *drv =3D src->drv; virStorageFileBackendGlusterPriv *priv =3D drv->priv; - return glfs_chown(priv->vol, src->path, uid, gid); + return glfs_chown(priv->vol, priv->image, uid, gid); } diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index fa59949cf2..843910a0d8 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -392,8 +392,6 @@ virStorageSourceNewFromBackingRelative(virStorageSource= *parent, def->nhosts =3D parent->nhosts; } - - def->volume =3D g_strdup(parent->volume); } else { /* set the type to _FILE, the caller shall update it to the actual= type */ def->type =3D VIR_STORAGE_TYPE_FILE; diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_f= ile/storage_source_backingstore.c index 4a273fe46c..700a2f5dcb 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -108,27 +108,9 @@ virStorageSourceParseBackingURI(virStorageSource *src, src->path =3D g_strdup(path); if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { - char *tmp; - - if (!src->path) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("missing volume name and path for gluster vol= ume")); - return -1; - } - - if (!(tmp =3D strchr(src->path, '/')) || - tmp =3D=3D src->path) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("missing volume name or file name in gluster = source path '%1$s'"), - src->path); + if (virStorageSourceNetworkProtocolPathSplit(src->path, src->proto= col, + NULL, NULL) < 0) return -1; - } - - src->volume =3D src->path; - - src->path =3D g_strdup(tmp + 1); - - tmp[0] =3D '\0'; } src->hosts->port =3D uri->port; @@ -211,13 +193,6 @@ virStorageSourceParseRBDColonString(const char *rbdstr, *p =3D '\0'; } - /* pool vs. image name */ - if ((p =3D strchr(src->path, '/'))) { - src->volume =3D g_steal_pointer(&src->path); - src->path =3D g_strdup(p + 1); - *p =3D '\0'; - } - /* options */ if (!options) return 0; /* all done */ @@ -703,8 +678,7 @@ virStorageSourceParseBackingJSONGluster(virStorageSourc= e *src, src->type =3D VIR_STORAGE_TYPE_NETWORK; src->protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER; - src->volume =3D g_strdup(volume); - src->path =3D g_strdup(path); + src->path =3D g_strdup_printf("%s/%s", volume, path); nservers =3D virJSONValueArraySize(server); if (nservers =3D=3D 0) { @@ -959,8 +933,7 @@ virStorageSourceParseBackingJSONRBD(virStorageSource *s= rc, return -1; } - src->volume =3D g_strdup(pool); - src->path =3D g_strdup(image); + src->path =3D g_strdup_printf("%s/%s", pool, image); src->snapshot =3D g_strdup(snapshot); src->configFile =3D g_strdup(conf); --=20 2.49.0 From nobody Sun Dec 14 02:17:06 2025 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=1750867408; cv=none; d=zohomail.com; s=zohoarc; b=chy6xEPocnhPEsOXLuMSBM7sv+65IoxymfDWtV9YPF01yFh9wulSWh5jukFzQOCE6n5EH214sM0qZwavCFh4bBXep5kjyK645K8Jjln21LaZ1N39+e3+9JUFEQcEXvdrAN81lcIPXA65fEhevOR1onlEJDlPiojYPYHhL6Gfr3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750867408; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=6IpBQ1NCgSJnLbl0yE6GtByKzkXnyq2Kd8WHCteh6Xs=; b=IW6jJVVSENfNZPEW1bNlIuS5rY9Fb8nPJPnnvzVtUBklCsd64f+kNbHf0pW3ohONPbTFUutCqYWH56g3hshHzRZ0qgA7taUrbNLG+oNiZ70qe3QhriKnI145u3FzPqNbcPccLh31ruReKoAxvGkKgYtb95ctOb8pK/i3WRh2XMk= 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 175086740849879.30898167549469; Wed, 25 Jun 2025 09:03:28 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7450F13D9; Wed, 25 Jun 2025 12:03:27 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C71C61531; Wed, 25 Jun 2025 11:57:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 82E6A864; Wed, 25 Jun 2025 11:57:21 -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 AA137864 for ; Wed, 25 Jun 2025 11:57:17 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-eoRmyB4kMxyDWPxu3VV8Wg-1; Wed, 25 Jun 2025 11:57:15 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4A56718C10B1; Wed, 25 Jun 2025 15:56:51 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ABC3918003FC; Wed, 25 Jun 2025 15:56:48 +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=1750867037; 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: in-reply-to:in-reply-to:references:references; bh=M3My8gUfwPOelRyqBU28b+KdtlQ3nVBjGMTZoDEIe4k=; b=Q/KYAqcOhklQUBcLE93omXEFjPnvcsKrHmBFdr2Dq9HmWuub62a5C+prL3sc1u4BHre90K UJjH8DQ7rP/M6gjmqYzCdqKWf7nj2K6mws9DB3IvAmPWHOgua5RtasaEdEkSJg6zFdxKOx DOhXF7iSf6EtxNcdM8crjDr/91m1p2A= X-MC-Unique: eoRmyB4kMxyDWPxu3VV8Wg-1 X-Mimecast-MFC-AGG-ID: eoRmyB4kMxyDWPxu3VV8Wg_1750867035 To: devel@lists.libvirt.org Subject: [PATCH 4/4] qemu: Add support for RBD namespace. Date: Wed, 25 Jun 2025 17:56:37 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Yc9q92DxFVBA9KtVaI_bP4EihWA2jUfaWZ6wTslB8Qo_1750867035 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZFAOMT724KZKILONR2QWOCBPEIT373M4 X-Message-ID-Hash: ZFAOMT724KZKILONR2QWOCBPEIT373M4 X-MailFrom: pkrempa@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: Rodrigo Prieto , Peter Krempa , Han Han 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: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750867442996116600 Content-Type: text/plain; charset="utf-8" From: Han Han Since Nautilus ceph supports separate image namespaces within a pool for tenant isolation and QEMU adds it as a rbd blockdev options from 5.0.0. The source name with format "//" could be used to access a rbd image with namespace. Add unit tests for this attribute. https://bugzilla.redhat.com/show_bug.cgi?id=3D1816909 Closes: https://gitlab.com/libvirt/libvirt/-/issues/405 Signed-off-by: Han Han Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 6 +++ src/conf/domain_conf.c | 3 +- src/conf/storage_source_conf.c | 47 ++++++++++++++----- src/conf/storage_source_conf.h | 1 + src/qemu/qemu_block.c | 6 ++- .../storage_file_backend_gluster.c | 2 +- .../storage_source_backingstore.c | 2 +- .../disk-network-rbd.x86_64-latest.args | 4 +- .../disk-network-rbd.x86_64-latest.xml | 4 +- tests/qemuxmlconfdata/disk-network-rbd.xml | 4 +- 10 files changed, 56 insertions(+), 23 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 9a2f065590..e8022e502d 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2958,6 +2958,12 @@ paravirtualized driver is specified via the ``disk``= element. the optional attribute ``tlsHostname`` can be used to override the expected host name of the NBD server used for TLS certificate verifi= cation. + For "rbd", the ``name`` attribute could be two formats: the format of + ``pool_name/image_name`` includes the rbd pool name and image name w= ith + default rbd pool namespace; for the customized namespace, the format= is + ``pool_name/namespace/image_name`` ( :since:`Since 11.6.0 and QEMU 5= .0` ). + The pool name, namespace and image are separated by slash. + For protocols ``http`` and ``https`` an optional attribute ``query`` specifies the query string. ( :since:`Since 6.2.0` ) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c7bad53ae6..7a8713771c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7381,7 +7381,8 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, return -1; } - if (virStorageSourceNetworkProtocolPathSplit(src->path, src->protocol,= NULL, NULL) < 0) + if (virStorageSourceNetworkProtocolPathSplit(src->path, src->protocol, + NULL, NULL, NULL) < 0) return -1; if (virXMLPropTristateBool(node, "tls", VIR_XML_PROP_NONE, diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index 9014fa37e6..dd46ea695b 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -1449,6 +1449,7 @@ virStorageSourceFDTupleNew(void) * @path: path to split * @protocol: protocol * @pool: filled with pool name (may be NULL) + * @namespace: filed with namespace (may be NULL) * @image: filled with image name (may be NULL) * * Historically libvirt accepted the specification of Gluster's volume and @@ -1463,35 +1464,57 @@ int virStorageSourceNetworkProtocolPathSplit(const char *path, virStorageNetProtocol protocol, char **pool, + char **namespace, char **image) { - - g_autofree char *pathcopy =3D g_strdup(path); - char *tmp; + g_auto(GStrv) tokens =3D NULL; + int components_max =3D 2; + size_t ncomponents =3D 0; + size_t i; if (protocol !=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER && protocol !=3D VIR_STORAGE_NET_PROTOCOL_RBD) { if (image) - *image =3D g_steal_pointer(&pathcopy); + *image =3D g_strdup(path); return 0; } - if (!(tmp =3D strchr(pathcopy, '/')) || tmp =3D=3D pathcopy) { - virReportError(VIR_ERR_XML_ERROR, - _("can't split path '%1$s' into pool name and image= name"), - pathcopy); - return -1; + if (protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_RBD) { + /* the name of rbd can be / or // */ + components_max =3D 3; } - tmp[0] =3D '\0'; + if ((tokens =3D g_strsplit(path, "/", components_max))) + ncomponents =3D g_strv_length(tokens); + + if (ncomponents < 2) + goto error; + + for (i =3D 0; i < ncomponents; i++) { + if (*tokens[i] =3D=3D '\0') + goto error; + } if (pool) - *pool =3D g_steal_pointer(&pathcopy); + *pool =3D g_strdup(tokens[0]); + + if (namespace) { + if (ncomponents =3D=3D 3) + *namespace =3D g_strdup(tokens[1]); + else + *namespace =3D NULL; + } if (image) - *image =3D g_strdup(tmp + 1); + *image =3D g_strdup(tokens[ncomponents - 1]); return 0; + + error: + virReportError(VIR_ERR_XML_ERROR, + _("failed to split path '%1$s' into 'pool/image' or 'po= ol/namespace/image' components"), + path); + return -1; } diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 798ca20ac4..aa4efda9ad 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -601,4 +601,5 @@ int virStorageSourceNetworkProtocolPathSplit(const char *path, virStorageNetProtocol protocol, char **pool, + char **namespace, char **image); diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9b370d4c7c..daefeb2f45 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -405,7 +405,7 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSource = *src, if (virStorageSourceNetworkProtocolPathSplit(src->path, VIR_STORAGE_NET_PROTOCOL_= GLUSTER, - &volume, &path) < 0) + &volume, NULL, &path) < 0) return NULL; /* { driver:"gluster", @@ -666,11 +666,12 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *s= rc, g_autoptr(virJSONValue) authmodes =3D NULL; const char *keysecret =3D NULL; g_autofree char *pool =3D NULL; + g_autofree char *namespace =3D NULL; g_autofree char *image =3D NULL; if (virStorageSourceNetworkProtocolPathSplit(src->path, VIR_STORAGE_NET_PROTOCOL_= RBD, - &pool, &image) < 0) + &pool, &namespace, &image= ) < 0) return NULL; if (src->nhosts > 0 && @@ -726,6 +727,7 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src, if (virJSONValueObjectAdd(&ret, "s:pool", pool, + "S:namespace", namespace, "s:image", image, "S:snapshot", src->snapshot, "S:conf", src->configFile, diff --git a/src/storage_file/storage_file_backend_gluster.c b/src/storage_= file/storage_file_backend_gluster.c index 8778995b6c..4682b85903 100644 --- a/src/storage_file/storage_file_backend_gluster.c +++ b/src/storage_file/storage_file_backend_gluster.c @@ -106,7 +106,7 @@ virStorageFileBackendGlusterInit(virStorageSource *src) if (virStorageSourceNetworkProtocolPathSplit(src->path, VIR_STORAGE_NET_PROTOCOL_= GLUSTER, - &volume, &image) < 0) + &volume, NULL, &image) < = 0) return -1; priv =3D g_new0(virStorageFileBackendGlusterPriv, 1); diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_f= ile/storage_source_backingstore.c index 700a2f5dcb..821378883c 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -109,7 +109,7 @@ virStorageSourceParseBackingURI(virStorageSource *src, if (src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLUSTER) { if (virStorageSourceNetworkProtocolPathSplit(src->path, src->proto= col, - NULL, NULL) < 0) + NULL, NULL, NULL) < 0) return -1; } diff --git a/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.args b/te= sts/qemuxmlconfdata/disk-network-rbd.x86_64-latest.args index f344b57371..a15263c884 100644 --- a/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.args +++ b/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.args @@ -36,9 +36,9 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st1/.config \ -blockdev '{"driver":"rbd","pool":"pool","image":"image","snapshot":"foo",= "conf":"/blah/test.conf","node-name":"libvirt-3-storage","read-only":false}= ' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"li= bvirt-3-storage","id":"virtio-disk3"}' \ -object '{"qom-type":"secret","id":"libvirt-2-storage-auth-secret0","data"= :"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid"= :"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw=3D=3D","format":"base64"}' \ --blockdev '{"driver":"rbd","pool":"pool","image":"image","server":[{"host"= :"mon1.example.org","port":"6321"},{"host":"mon2.example.org","port":"6322"= },{"host":"mon3.example.org","port":"6322"}],"user":"myname","auth-client-r= equired":["cephx","none"],"key-secret":"libvirt-2-storage-auth-secret0","no= de-name":"libvirt-2-storage","read-only":false}' \ +-blockdev '{"driver":"rbd","pool":"pool","namespace":"namespace","image":"= image","server":[{"host":"mon1.example.org","port":"6321"},{"host":"mon2.ex= ample.org","port":"6322"},{"host":"mon3.example.org","port":"6322"}],"user"= :"myname","auth-client-required":["cephx","none"],"key-secret":"libvirt-2-s= torage-auth-secret0","node-name":"libvirt-2-storage","read-only":false}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"li= bvirt-2-storage","id":"virtio-disk4"}' \ --blockdev '{"driver":"rbd","pool":"pool","image":"image","server":[{"host"= :"::1","port":"6321"},{"host":"example.org","port":"6789"},{"host":"ffff:12= 34:567:abc::0f","port":"6322"},{"host":"2001:db8::ff00:42:8329","port":"632= 2"}],"node-name":"libvirt-1-storage","read-only":false}' \ +-blockdev '{"driver":"rbd","pool":"pool","namespace":"namespace","image":"= image","server":[{"host":"::1","port":"6321"},{"host":"example.org","port":= "6789"},{"host":"ffff:1234:567:abc::0f","port":"6322"},{"host":"2001:db8::f= f00:42:8329","port":"6322"}],"node-name":"libvirt-1-storage","read-only":fa= lse}' \ -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"li= bvirt-1-storage","id":"virtio-disk5"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ diff --git a/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.xml b/tes= ts/qemuxmlconfdata/disk-network-rbd.x86_64-latest.xml index 6da7185d18..cfb10a701c 100644 --- a/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.xml +++ b/tests/qemuxmlconfdata/disk-network-rbd.x86_64-latest.xml @@ -60,7 +60,7 @@ - + @@ -70,7 +70,7 @@ - + diff --git a/tests/qemuxmlconfdata/disk-network-rbd.xml b/tests/qemuxmlconf= data/disk-network-rbd.xml index c427fbea83..0973f50ecc 100644 --- a/tests/qemuxmlconfdata/disk-network-rbd.xml +++ b/tests/qemuxmlconfdata/disk-network-rbd.xml @@ -53,7 +53,7 @@ - + @@ -62,7 +62,7 @@ - + --=20 2.49.0