[pve-devel] [PATCH manager 01/15] add get_local_services for ceph

Thomas Lamprecht t.lamprecht at proxmox.com
Mon May 27 14:30:41 CEST 2019


On 5/27/19 2:13 PM, Dominik Csapak wrote:
> this returns a hash of existing service links for
> mds/mgr/mons so that we know which services exists

hmm, I have a slight feeling I talked with you already about this,
but would it make sense to scan /var/lib/ceph/mon and friends too?
As a heuristic for existing but (temporarily) disabled services?

looks OK, besides this.

> 
> this is necessary since ceph itself does not save if a service is
> defined somewhere, only when it runs
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/Ceph/Services.pm | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/PVE/Ceph/Services.pm b/PVE/Ceph/Services.pm
> index 739df266..a0203f9c 100644
> --- a/PVE/Ceph/Services.pm
> +++ b/PVE/Ceph/Services.pm
> @@ -9,6 +9,24 @@ use PVE::RADOS;
>  
>  use File::Path;
>  
> +# checks links in /etc/systemd/system/ceph-* to list all services, even
> +# those not running
> +sub get_local_services {
> +    my $res = {};
> +    for my $type (qw(mds mgr mon)) {
> +	$res->{$type} = {};
> +	my $path = "/etc/systemd/system/ceph-$type.target.wants";
> +	my $regex = "ceph-$type\@(.*)\.service";
> +	PVE::Tools::dir_glob_foreach($path, $regex, sub {
> +	    my (undef, $id) = @_;
> +	    $res->{$type}->{$id} = {
> +		service => 1,
> +	    }
> +	});
> +    }
> +    return $res;
> +}
> +
>  sub ceph_service_cmd {
>      my ($action, $service) = @_;
>  
> 





More information about the pve-devel mailing list