mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-06-06 04:11:11 +00:00
ceph: add ceph-volume helper
those will be needed for creation/destruction of nautilus osds Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
da92b5fcce
commit
48e8a06de1
@ -6,8 +6,10 @@ use warnings;
|
|||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use IO::File;
|
use IO::File;
|
||||||
|
use JSON;
|
||||||
|
|
||||||
use PVE::Tools qw(run_command dir_glob_foreach);
|
use PVE::Tools qw(run_command dir_glob_foreach);
|
||||||
|
use PVE::Cluster qw(cfs_read_file);
|
||||||
use PVE::RADOS;
|
use PVE::RADOS;
|
||||||
|
|
||||||
my $ccname = 'ceph'; # ceph cluster name
|
my $ccname = 'ceph'; # ceph cluster name
|
||||||
@ -27,6 +29,7 @@ my $ceph_service = {
|
|||||||
ceph_mgr => "/usr/bin/ceph-mgr",
|
ceph_mgr => "/usr/bin/ceph-mgr",
|
||||||
ceph_osd => "/usr/bin/ceph-osd",
|
ceph_osd => "/usr/bin/ceph-osd",
|
||||||
ceph_mds => "/usr/bin/ceph-mds",
|
ceph_mds => "/usr/bin/ceph-mds",
|
||||||
|
ceph_volume => '/usr/sbin/ceph-volume',
|
||||||
};
|
};
|
||||||
|
|
||||||
my $config_hash = {
|
my $config_hash = {
|
||||||
@ -240,4 +243,34 @@ sub wipe_disks {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# get ceph-volume managed osds
|
||||||
|
sub ceph_volume_list {
|
||||||
|
my $result = {};
|
||||||
|
my $output = '';
|
||||||
|
|
||||||
|
if (!check_ceph_installed('ceph_volume', 1)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $cmd = [$ceph_service->{ceph_volume}, 'lvm', 'list', '--format', 'json'];
|
||||||
|
run_command($cmd, outfunc => sub {
|
||||||
|
$output .= shift;
|
||||||
|
});
|
||||||
|
|
||||||
|
$result = eval { decode_json($output) };
|
||||||
|
warn $@ if $@;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ceph_volume_zap {
|
||||||
|
my ($osdid, $destroy) = @_;
|
||||||
|
|
||||||
|
die "no osdid given\n" if !defined($osdid);
|
||||||
|
|
||||||
|
my $cmd = [$ceph_service->{ceph_volume}, 'lvm', 'zap', '--osd-id', $osdid];
|
||||||
|
push @$cmd, '--destroy' if $destroy;
|
||||||
|
|
||||||
|
run_command($cmd);
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user