]> git.proxmox.com Git - pve-manager-legacy.git/commitdiff
isert section when writing ceph.conf
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 15 Nov 2013 07:15:39 +0000 (08:15 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 15 Nov 2013 07:15:39 +0000 (08:15 +0100)
PVE/API2/Ceph.pm

index 17e77f24b4514433bf51bf1150a49ad236ae9943..684c97c39c796481e13710098ca47b89731e2e2c 100644 (file)
@@ -205,13 +205,25 @@ my $write_ceph_config = sub {
     my ($cfg) = @_;
 
     my $out = '';
-    foreach my $section (keys %$cfg) {
-       $out .= "[$section]\n";
-       foreach my $key (sort keys %{$cfg->{$section}}) {
-           $out .= "\t $key = $cfg->{$section}->{$key}\n";
+
+    my $cond_write_sec = sub {
+       my $re = shift;
+
+       foreach my $section (keys %$cfg) {
+           next if $section !~ m/^$re$/;
+           $out .= "[$section]\n";
+           foreach my $key (sort keys %{$cfg->{$section}}) {
+               $out .= "\t $key = $cfg->{$section}->{$key}\n";
+           }
+           $out .= "\n";
        }
-       $out .= "\n";
-    }
+    };
+
+    &$cond_write_sec('global');
+    &$cond_write_sec('mon');
+    &$cond_write_sec('osd');
+    &$cond_write_sec('mon\..*');
+    &$cond_write_sec('osd\..*');
 
     PVE::Tools::file_set_contents($pve_ceph_cfgpath, $out);
 };