[pve-devel] [RFC cluster v2 03/10] return cluster config and authkey in addnode API call

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 4 12:11:10 CET 2017


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/API2/ClusterConfig.pm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/data/PVE/API2/ClusterConfig.pm b/data/PVE/API2/ClusterConfig.pm
index fa01022..c38feb2 100644
--- a/data/PVE/API2/ClusterConfig.pm
+++ b/data/PVE/API2/ClusterConfig.pm
@@ -136,7 +136,17 @@ __PACKAGE__->register_method ({
 	    },
 	},
     },
-    returns => { type => 'null' },
+    returns => {
+	type => "object",
+	properties => {
+	    corosync_authkey => {
+		type => 'string',
+	    },
+	    corosync_conf => {
+		type => 'string',
+	    }
+	},
+    },
     code => sub {
 	my ($param) = @_;
 
@@ -222,7 +232,15 @@ __PACKAGE__->register_method ({
 	$config_change_lock->($code);
 	die $@ if $@;
 
-	return undef;
+	my $clusterconf = "/etc/pve/corosync.conf";
+	my $authfile = "/etc/corosync/authkey";
+
+	my $res = {
+	    corosync_authkey => PVE::Tools::file_get_contents($authfile),
+	    corosync_conf => PVE::Tools::file_get_contents($clusterconf),
+	};
+
+	return $res;
     }});
 
 
-- 
2.11.0





More information about the pve-devel mailing list