to keep storage.cfg consistent with changes to the
pveceph-managed cluster. only storages with the 'pveceph'
flag are updated.

Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---
 PVE/API2/Ceph.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 1134587b..fe0e6031 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1204,6 +1204,17 @@ __PACKAGE__->register_method ({
                my $rados = PVE::RADOS->new(timeout => 
PVE::CephTools::get_config('long_rados_timeout'));
                $create_mgr->($rados, $monid);
            }
+
+           if ($rpcenv->check($authuser, '/storage', ['Datastore.Allocate'], 
1)) {
+               my $monhosts = $map_monhash_monhosts->($get_monitor_hash->());
+               my $storages = $get_storages->();
+               foreach my $storeid (keys %$storages) {
+                   eval { $update_storage->($storeid, $monhosts); };
+                   warn "failed to update storage '$storeid': $@\n" if $@;
+               }
+           } else {
+               warn "missing permission to update storage.cfg with changed 
monitor information\n";
+           }
        };
 
        return $rpcenv->fork_worker('cephcreatemon', $monsection, $authuser, 
$worker);
@@ -1285,6 +1296,17 @@ __PACKAGE__->register_method ({
                eval { $destroy_mgr->($monid); };
                warn $@ if $@;
            }
+
+           if ($rpcenv->check($authuser, '/storage', ['Datastore.Allocate'], 
1)) {
+               my $monhosts = $map_monhash_monhosts->($get_monitor_hash->());
+               my $storages = $get_storages->();
+               foreach my $storeid (keys %$storages) {
+                   eval { $update_storage->($storeid, $monhosts); };
+                   warn "failed to update storage '$storeid': $@\n" if $@;
+               }
+           } else {
+               warn "missing permission to update storage.cfg with changed 
monitor information\n";
+           }
        };
 
        return $rpcenv->fork_worker('cephdestroymon', $monsection,  $authuser, 
$worker);
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to