[pve-devel] [PATCH manager 02/20] ceph: get_local_services: also check /var/lib/ceph/$type

Dominik Csapak d.csapak at proxmox.com
Tue Jun 4 14:47:41 CEST 2019


so we do not miss disabled services

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Ceph/Services.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm
index 08a47773..3206e323 100644
--- a/PVE/Ceph/Services.pm
+++ b/PVE/Ceph/Services.pm
@@ -10,6 +10,7 @@ use PVE::RADOS;
 use File::Path;
 
 # checks /etc/systemd/system/ceph-* to list all services, even if not running
+# also checks /var/lib/ceph/$type
 sub get_local_services {
     my $res = {};
 
@@ -20,9 +21,14 @@ sub get_local_services {
 	my $regex = "ceph-$type\@(.*)\.service";
 	PVE::Tools::dir_glob_foreach($path, $regex, sub {
 	    my (undef, $id) = @_;
-	    $res->{$type}->{$id} = {
-		service => 1,
-	    }
+	    $res->{$type}->{$id}->{service} = 1;
+	});
+
+	$path = "/var/lib/ceph/$type";
+	$regex = "([^-]+)-(.*)";
+	PVE::Tools::dir_glob_foreach($path, $regex, sub {
+	    my (undef, $clustername, $id) = @_;
+	    $res->{$type}->{$id}->{direxists} = 1;
 	});
     }
     return $res;
-- 
2.11.0





More information about the pve-devel mailing list