[pve-devel] [RFC cluster 1/6] corosync config: support 'linknumber' property

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


On Tue, May 28, 2019 at 06:33:08PM +0200, Thomas Lamprecht wrote:
> Corosync has moved it's rings a layer up, i.e., abstracted away from

s/it's/its

> the network layer below. That what early were called rings are now
> links, knet can have up to 8 all others 1, for now.
> 
> Let our parser understand this change in the totem section of the
> config, but keep backwards compatibillity and accept 'ringnumber'

s/compatibillity/compatibility/

> also.
> 
> While we are at it, try to write out the two map operations used in a
> bit more readable way.
> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

I wonder whether it makes sense to refactor this already in preparation
for up to 8 links - i.e., have an abstract $add_link_to_conf and use
that for 0 and 1 already ;)

> ---
>  data/PVE/Corosync.pm | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/data/PVE/Corosync.pm b/data/PVE/Corosync.pm
> index e46a119..fea7258 100644
> --- a/data/PVE/Corosync.pm
> +++ b/data/PVE/Corosync.pm
> @@ -73,8 +73,17 @@ sub parse_conf {
>  
>      # make working with the config way easier
>      my ($totem, $nodelist) = $conf->{main}->@{"totem", "nodelist"};
> -    $nodelist->{node} = { map { $_->{name} // $_->{ring0_addr} => $_ } @{$nodelist->{node}} };
> -    $totem->{interface} = { map { $_->{ringnumber} => $_ } @{$totem->{interface}} };
> +
> +    $nodelist->{node} = {
> +	map {
> +	    $_->{name} // $_->{ring0_addr} => $_
> +	} @{$nodelist->{node}}
> +    };
> +    $totem->{interface} = {
> +	map {
> +	    $_->{linknumber} // $_->{ringnumber} => $_
> +	} @{$totem->{interface}}
> +    };
>  
>      $conf->{digest} = $digest;
>  
> @@ -210,7 +219,7 @@ sub create_conf {
>  	    interface => {
>  		0 => {
>  		    bindnetaddr => $bindnet0_addr,

bindnetaddr is udp only - so should not be needed for knet / default
creation?

> -		    ringnumber => 0,
> +		    linknumber => 0,
>  		},
>  	    },
>  	},
> @@ -246,7 +255,7 @@ sub create_conf {
>  
>  	$conf->{totem}->{interface}->{1} = {
>  	    bindnetaddr => $bindnet1_addr,

same as above

> -	    ringnumber => 1,
> +	    linknumber => 1,
>  	};
>  	$conf->{totem}->{rrp_mode} = 'passive';
>  	$conf->{nodelist}->{node}->{$nodename}->{ring1_addr} = $ring1_addr;
> -- 
> 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