From: Friedrich Weber <f.weber@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 1/2] fix #5779: rbd: allow to pass custom krbd map options
Date: Fri, 25 Oct 2024 13:13:03 +0200 [thread overview]
Message-ID: <20241025111304.99680-2-f.weber@proxmox.com> (raw)
In-Reply-To: <20241025111304.99680-1-f.weber@proxmox.com>
When KRBD is enabled for an RBD storage, the storage plugin calls out
to `rbd map` to map an RBD image as a block device on the host.
Sometimes it might be necessary to pass custom options to `rbd map`.
For instance, in some setups with Windows VMs, KRBD logs `bad
crc/signature` and VMs performance is degraded unless the `rxbounce`
option is enabled, as reported in the forum [1].
To allow users to specify custom options for KRBD, introduce a
corresponding `krbd-map-options` property to the RBD plugin. The
property is designed to only accept a supported set of map options.
For now, this is only the `rxbounce` map option, but the supported set
can be extended in the future.
The reasoning for constraining the supported set of map options
instead of allowing to pass a free-form option string is as follows:
If `rxbounce` turns out to be a sensible default, accepting a
free-form option string now will make it hard to switch over the
default to `rxbounce` while still allowing users to disable `rxbounce`
if needed. This would require scanning the free-form string for a
`norxbounce` or similar, which is cumbersome.
If users need to set a map option that `krbd-map-options` does not
support (yet), they can alternatively set the RBD config option
`rbd_default_map_options` [2].
[1] https://forum.proxmox.com/threads/155741/
[2] https://github.com/ceph/ceph/blob/b2a4bd840/src/common/options/rbd.yaml.in#L507
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
src/PVE/Storage/Plugin.pm | 10 ++++++++++
src/PVE/Storage/RBDPlugin.pm | 14 +++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 8cc693c..02be257 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -394,6 +394,16 @@ sub verify_dir_override {
die "invalid override '$value'\n";
}
+PVE::JSONSchema::register_format('pve-storage-krbd-map-option', \&verify_krbd_map_option);
+sub verify_krbd_map_option {
+ my ($option, $noerr) = @_;
+
+ return $option if $option eq 'rxbounce';
+
+ return undef if $noerr;
+ die "invalid krbd map option '$option'\n";
+}
+
sub private {
return $defaultData;
}
diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index f45ad3f..8110cff 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -394,6 +394,12 @@ sub properties {
description => "Client keyring contents (for external clusters).",
type => 'string',
},
+ 'krbd-map-options' => {
+ description => "Additional map options (only for krbd). Supported:"
+ ." rxbounce.",
+ type => 'string',
+ format => 'pve-storage-krbd-map-option-list',
+ },
};
}
@@ -410,6 +416,7 @@ sub options {
krbd => { optional => 1 },
keyring => { optional => 1 },
bwlimit => { optional => 1 },
+ 'krbd-map-options' => { optional => 1 },
};
}
@@ -726,7 +733,12 @@ sub map_volume {
# features can only be enabled/disabled for image, not for snapshot!
$krbd_feature_update->($scfg, $storeid, $img_name);
- my $cmd = $rbd_cmd->($scfg, $storeid, 'map', $name);
+ my @additional_options = ();
+ if ($scfg->{'krbd-map-options'}) {
+ @additional_options = ('--options', $scfg->{'krbd-map-options'});
+ }
+
+ my $cmd = $rbd_cmd->($scfg, $storeid, 'map', $name, @additional_options);
run_rbd_command($cmd, errmsg => "can't map rbd volume $name");
return $kerneldev;
--
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:[~2024-10-25 11:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 11:13 [pve-devel] [PATCH storage/docs 0/2] fix #5779: storage: rbd: allow setting custom KRBD map option(s) Friedrich Weber
2024-10-25 11:13 ` Friedrich Weber [this message]
2024-10-29 13:58 ` [pve-devel] [PATCH storage 1/2] fix #5779: rbd: allow to pass custom krbd map options Aaron Lauterer
2024-10-29 17:01 ` Friedrich Weber
2024-10-30 8:41 ` Thomas Lamprecht
2024-10-30 13:29 ` Fabian Grünbichler
2024-10-30 16:49 ` Friedrich Weber
2024-10-25 11:13 ` [pve-devel] [PATCH docs 2/2] storage: rbd: document KRBD map options property 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=20241025111304.99680-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox