From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 4/5] plugin: rbd: factor out subroutine to obtain RBD ID
Date: Fri, 31 Oct 2025 11:36:11 +0100 [thread overview]
Message-ID: <20251031103709.60233-5-f.weber@proxmox.com> (raw)
In-Reply-To: <20251031103709.60233-1-f.weber@proxmox.com>
This allows the subroutine to be reused.
No functional change intended.
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
src/PVE/Storage/RBDPlugin.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index cf371c7..69957d2 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -49,6 +49,13 @@ my sub get_rbd_path {
return $path;
}
+my sub get_rbd_id {
+ my ($path) = @_;
+ my $real_dev = abs_path($path);
+ my ($rbd_id) = ($real_dev =~ m|/dev/rbd([0-9]+)$|);
+ return $rbd_id;
+}
+
my sub get_rbd_dev_path {
my ($scfg, $storeid, $volume) = @_;
@@ -76,8 +83,7 @@ my sub get_rbd_dev_path {
if (!-e $pve_path && -e $path) {
# possibly mapped before rbd-pve rule existed
- my $real_dev = abs_path($path);
- my ($rbd_id) = ($real_dev =~ m|/dev/rbd([0-9]+)$|);
+ my $rbd_id = get_rbd_id($path);
my $dev_cluster_id = file_read_firstline("/sys/devices/rbd/${rbd_id}/cluster_fsid");
return $path if $cluster_id eq $dev_cluster_id;
}
--
2.47.3
_______________________________________________
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-10-31 10:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 10:36 [pve-devel] [PATCH qemu-server/storage 0/6] fix #5779: introduce guest hints to pass rxbounce flag to KRBD Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 1/5] plugin: introduce hints for activating and mapping volumes Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 2/5] plugin api: bump api version and age Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH storage 3/5] storage: activate/map volumes: verify and pass hints to plugin Friedrich Weber
2025-10-31 10:36 ` Friedrich Weber [this message]
2025-10-31 10:36 ` [pve-devel] [PATCH storage 5/5] plugin: rbd: pass rxbounce when mapping Windows VM guest volumes Friedrich Weber
2025-10-31 10:36 ` [pve-devel] [PATCH qemu-server 1/1] fix #5779: vm start: pass storage hints when activating " Friedrich Weber
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=20251031103709.60233-5-f.weber@proxmox.com \
--to=f.weber@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.