5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2024-12-22 13:34:16 +03:00

cephconfig: allow writing arbitrary sections

This adds support for writing arbitrary sections to 'ceph.conf' while
ensuring that already written sections are not duplicated.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
This commit is contained in:
Max Carrara 2024-04-02 16:55:16 +02:00 committed by Fabian Grünbichler
parent 094f3f901f
commit 8777f4a600

View File

@ -60,6 +60,7 @@ my $parse_ceph_file = sub {
sub write_ceph_config {
my ($filename, $cfg) = @_;
my $written_sections = {};
my $out = '';
my $cond_write_sec = sub {
@ -67,12 +68,15 @@ sub write_ceph_config {
for my $section (sort keys $cfg->%*) {
next if $section !~ m/^$re$/;
next if exists($written_sections->{$section});
$out .= "[$section]\n";
for my $key (sort keys $cfg->{$section}->%*) {
$out .= "\t $key = $cfg->{$section}->{$key}\n";
}
$out .= "\n";
$written_sections->{$section} = 1;
}
};
@ -89,6 +93,8 @@ sub write_ceph_config {
qr/mon\..*/,
qr/osd\..*/,
qr/mgr\..*/,
qr/.*/,
);
for my $re (@rexprs) {