[pve-devel] [RFC cluster 2/6] add new corosync-link format

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed May 29 10:43:03 CEST 2019


On Tue, May 28, 2019 at 06:33:09PM +0200, Thomas Lamprecht wrote:
> use a format string this time, so we can drop the parameter count a
> bit. With address as default_key we can still use it conveniently
> from CLI. bindnet defaults to it, which is correct most of the time.
> 
> There'll be the link priority flag added in a future patch.
> 
> Note that passing bindnet makes only sense on creation to not confuse
> API users.

I'd argue that bindnet can be skipped altogether:
- it's not used for knet (the only transport we allow for creating new
clusters)
- it's ignored entirely when joining existing clusters anyway

> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
> 
> the "desc" already mentions "priority", even if that gets added only
> later, this is left over from patch re-order/commit cycle and could be fixed up
> if deemed important..
> 
>  data/PVE/Cluster.pm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
> index 7f9b88e..ddb6d2d 100644
> --- a/data/PVE/Cluster.pm
> +++ b/data/PVE/Cluster.pm
> @@ -1839,6 +1839,36 @@ sub ssh_info_to_command {
>      return $cmd;
>  }
>  
> +my $corosync_link_format = {
> +    address => {
> +	default_key => 1,
> +	type => 'string', format => 'address',
> +	format_description => 'IP',
> +	description => "Hostname (or IP) of this corosync link address.",
> +    },
> +    bindnet => {
> +	type => 'string', format => 'address',
> +	description => "This specifies the network address the corosync executive should bind to. Ignored for node addition.",
> +	optional => 1,
> +	format_description => 'IP',
> +	default => 'same as address',
> +    },
> +};
> +my $corosync_link_desc = {
> +    type => 'string', format => $corosync_link_format,
> +    description => "Address and priority information of a single corosync link.",
> +    optional => 1,
> +};
> +PVE::JSONSchema::register_standard_option("corosync-link", $corosync_link_desc);
> +
> +sub parse_corosync_link {
> +    my ($value) = @_;
> +
> +    return undef if !defined($value);
> +
> +    return PVE::JSONSchema::parse_property_string($corosync_link_format, $value);
> +}
> +
>  sub assert_joinable {
>      my ($local_addr, $ring0_addr, $ring1_addr, $force) = @_;
>  
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list