[pve-devel] [PATCH manager v2 2/3] pveceph: add createmgr/destroymgr commands
Alwin Antreich
a.antreich at proxmox.com
Mon Aug 14 11:06:03 CEST 2017
From: Dominik Csapak <d.csapak at proxmox.com>
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 at proxmox.com>
(cherry picked from commit ad9411c9480aa8f9b5fdbf677e0fb4a1e6997cb7)
---
PVE/API2/Ceph.pm | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
PVE/CLI/pveceph.pm | 2 ++
2 files changed, 89 insertions(+)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index c36f31ff..11035e5b 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -1097,6 +1097,93 @@ __PACKAGE__->register_method ({
}});
__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',
method => 'POST',
diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
index 4bec9899..b4f9110e 100755
--- a/PVE/CLI/pveceph.pm
+++ b/PVE/CLI/pveceph.pm
@@ -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', [] ],
--
2.11.0
More information about the pve-devel
mailing list