mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-04-28 15:26:36 +00:00
pveceph: add createmgr/destroymgr commands
this patch adds the create-/destroymgr commands to the api and pveceph, so that advanced users can split monitor and manager daemons Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> (cherry picked from commit ad9411c9480aa8f9b5fdbf677e0fb4a1e6997cb7)
This commit is contained in:
parent
5e33f7cea8
commit
100800ee37
@ -1096,6 +1096,93 @@ __PACKAGE__->register_method ({
|
||||
return $rpcenv->fork_worker('cephdestroymon', $monsection, $authuser, $worker);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'createmgr',
|
||||
path => 'mgr',
|
||||
method => 'POST',
|
||||
description => "Create Ceph Manager",
|
||||
proxyto => 'node',
|
||||
protected => 1,
|
||||
permissions => {
|
||||
check => ['perm', '/', [ 'Sys.Modify' ]],
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
id => {
|
||||
type => 'string',
|
||||
optional => 1,
|
||||
pattern => '[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?',
|
||||
description => "The ID for the manager, when omitted the same as the nodename",
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'string' },
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
PVE::CephTools::check_ceph_inited();
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
my $mgrid = $param->{id} // $param->{node};
|
||||
|
||||
my $worker = sub {
|
||||
my $upid = shift;
|
||||
|
||||
my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
|
||||
|
||||
$create_mgr->($rados, $mgrid);
|
||||
};
|
||||
|
||||
return $rpcenv->fork_worker('cephcreatemgr', "mgr.$mgrid", $authuser, $worker);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'destroymgr',
|
||||
path => 'mgr/{id}',
|
||||
method => 'DELETE',
|
||||
description => "Destroy Ceph Manager.",
|
||||
proxyto => 'node',
|
||||
protected => 1,
|
||||
permissions => {
|
||||
check => ['perm', '/', [ 'Sys.Modify' ]],
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
node => get_standard_option('pve-node'),
|
||||
id => {
|
||||
description => 'The ID of the manager',
|
||||
type => 'string',
|
||||
pattern => '[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?',
|
||||
},
|
||||
},
|
||||
},
|
||||
returns => { type => 'string' },
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
PVE::CephTools::check_ceph_inited();
|
||||
|
||||
my $mgrid = $param->{id};
|
||||
|
||||
my $worker = sub {
|
||||
my $upid = shift;
|
||||
|
||||
$destroy_mgr->($mgrid);
|
||||
};
|
||||
|
||||
return $rpcenv->fork_worker('cephdestroymgr', "mgr.$mgrid", $authuser, $worker);
|
||||
}});
|
||||
|
||||
__PACKAGE__->register_method ({
|
||||
name => 'stop',
|
||||
path => 'stop',
|
||||
|
@ -165,6 +165,8 @@ our $cmddef = {
|
||||
destroyosd => [ 'PVE::API2::CephOSD', 'destroyosd', ['osdid'], { node => $nodename }, $upid_exit],
|
||||
createmon => [ 'PVE::API2::Ceph', 'createmon', [], { node => $nodename }, $upid_exit],
|
||||
destroymon => [ 'PVE::API2::Ceph', 'destroymon', ['monid'], { node => $nodename }, $upid_exit],
|
||||
createmgr => [ 'PVE::API2::Ceph', 'createmgr', [], { node => $nodename }, $upid_exit],
|
||||
destroymgr => [ 'PVE::API2::Ceph', 'destroymgr', ['id'], { node => $nodename }, $upid_exit],
|
||||
start => [ 'PVE::API2::Ceph', 'start', ['service'], { node => $nodename }, $upid_exit],
|
||||
stop => [ 'PVE::API2::Ceph', 'stop', ['service'], { node => $nodename }, $upid_exit],
|
||||
install => [ __PACKAGE__, 'install', [] ],
|
||||
|
Loading…
Reference in New Issue
Block a user