From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 1/3] rbd: extend get_rbd_(dev_)path helpers with $snap parameter
Date: Wed, 23 Apr 2025 15:59:02 +0200 [thread overview]
Message-ID: <20250423135904.716443-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20250423135904.716443-1-f.gruenbichler@proxmox.com>
this helper effectively converts a storage config entry and a
volume/image name into an RBD image-spec as specified in rbd(8):
image-spec is [pool-name/[namespace-name/]]image-name
by extending it with an optional $snap parameter it can also convert to
a snap-spec:
snap-spec is [pool-name/[namespace-name/]]image-name@snap-name
this is a needed preparatory step for dropping the (mostly) deprecated
`--pool ..`, `--namespace ..` and `--snap ..` parameters when invoking
the `rbd` CLI tool.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/PVE/Storage/RBDPlugin.pm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index 73bc97e..8c67a37 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -42,15 +42,16 @@ my $librados_connect = sub {
};
my sub get_rbd_path {
- my ($scfg, $volume) = @_;
+ my ($scfg, $volume, $snap) = @_;
my $path = $scfg->{pool} ? $scfg->{pool} : 'rbd';
$path .= "/$scfg->{namespace}" if defined($scfg->{namespace});
$path .= "/$volume" if defined($volume);
+ $path .= "\@$snap" if defined($snap);
return $path;
};
my sub get_rbd_dev_path {
- my ($scfg, $storeid, $volume) = @_;
+ my ($scfg, $storeid, $volume, $snap) = @_;
my $cluster_id = '';
if ($scfg->{fsid}) {
@@ -70,7 +71,7 @@ my sub get_rbd_dev_path {
die "cluster fsid has invalid format\n";
}
- my $rbd_path = get_rbd_path($scfg, $volume);
+ my $rbd_path = get_rbd_path($scfg, $volume, $snap);
my $pve_path = "/dev/rbd-pve/${cluster_id}/${rbd_path}";
my $path = "/dev/rbd/${rbd_path}";
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-04-23 13:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 13:59 [pve-devel] [RFC storage 0/3] rbd: use image-/snap-spec instead of --pool/ Fabian Grünbichler
2025-04-23 13:59 ` Fabian Grünbichler [this message]
2025-04-23 13:59 ` [pve-devel] [PATCH storage 2/3] fix #6338: rbd: use image-/snap-spec consistently Fabian Grünbichler
2025-05-05 14:24 ` Fiona Ebner
2025-04-23 13:59 ` [pve-devel] [PATCH storage 3/3] rbd: add protect/unprotect helpers Fabian Grünbichler
2025-05-05 14:24 ` Fiona Ebner
2025-05-06 11:07 ` Fabian Grünbichler
2025-05-06 11:40 ` Fiona Ebner
2025-04-30 15:51 ` [pve-devel] [RFC storage 0/3] rbd: use image-/snap-spec instead of --pool/ Aaron Lauterer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250423135904.716443-2-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal