[pve-devel] [PATCH cluster v5] api/cluster: add endpoint to GET cluster join information

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Jan 18 13:47:03 CET 2018


On 1/18/18 1:41 PM, Fabian Grünbichler wrote:
> On Thu, Jan 18, 2018 at 01:29:33PM +0100, Thomas Lamprecht wrote:
>> Returns all relevant information for joining this cluster over the
>> current connected node securely over the API: wrapped in the corosync
>> nodelist are address and fingerprint of the node, further totem
>> config section and (not directly needed but possibly useful) cluster
>> configuration digest are passed.
>>
>> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
>> ---
>>
>> changes v4 -> v5:
>> * return the information of all known cluster nodes
>> * thus use array as return type, this allows to still verify the
>>   returned data
>> * pass the preferred node, if explicitly pass
>> * add checks, i.e., is a cluster configured and is the passed node a
>>   known member
>>
>>  data/PVE/API2/ClusterConfig.pm | 69 ++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 69 insertions(+)
>>
>> diff --git a/data/PVE/API2/ClusterConfig.pm b/data/PVE/API2/ClusterConfig.pm
>> index 8c88a17..9c1a038 100644
>> --- a/data/PVE/API2/ClusterConfig.pm
>> +++ b/data/PVE/API2/ClusterConfig.pm
>> @@ -396,6 +396,74 @@ __PACKAGE__->register_method ({
>>      }});
>>  
>>  __PACKAGE__->register_method ({
>> +    name => 'join_info',
>> +    path => 'join',
>> +    method => 'GET',
>> +    description => "Get information needed to join this cluster over the connected node.",
>> +    parameters => {
>> +	additionalProperties => 0,
>> +	properties => {
>> +	    node => get_standard_option('pve-node', {
>> +		description => "The node for which the joinee gets the nodeinfo. ",
>> +		default => "current connected node",
>> +		optional => 1,
>> +	    }),
>> +	},
>> +    },
>> +    returns => {
>> +	type => 'object',
>> +	additionalProperties => 0,
>> +	properties => {
>> +	    nodelist => {
>> +		type => 'array',
>> +		items => {
>> +		    type => "object",
>> +		    additionalProperties => 1,
>> +		    properties => {
>> +			pve_addr => { type => 'string', format => 'ip' },
>> +			pve_fp => get_standard_option('fingerprint-sha256'),
>> +		    },
> 
> are there other properties we could add here with a schema as well?
> seems like all/most of them are already defined in some way for
> create/... anyway?

ring{1,2}_addr could be added, where ring1_addr is optional.
name could be added as optional (old cluster may not yet have it)
nodeid and quorum_votes could be added too, yes.

Maybe some of them could be pulled out in a hash and then reused.

> 
>> +		},
>> +	    },
>> +	    prefered_node => get_standard_option('pve-node'),
> 
> s/prefered/preferred/
> 

yeah, saw it too just now, that's what you get for botching around in
send-email... Waiting for the rest of your comments and address it with
next version.






More information about the pve-devel mailing list