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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 29 11:08:04 CEST 2019


On 5/29/19 10:42 AM, Fabian Grünbichler wrote:
> On Tue, May 28, 2019 at 06:33:08PM +0200, Thomas Lamprecht wrote:
> 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 ;)

Hmm, link0 will probably always handled a bit differently by us,
as it's the required one (albeit optional from outside, as we fallback
to node, so we /could/ handle it all the same), but I did not want to
add such things now to keep the code architecture very similar, if we
allow all the links we can do it for all in a single patch, and then
have better separation if a bug, strange behavior got introduced, so
I didn't want to mix this.

> 
>> ---
>>  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?

yes, can do, but it also does not harms... I have the feeling that if
multicast for knet comes, we can need this again, but hey, can
re-add it then and doing things out of future-guess-work seldom turns
out to help, I'll drop them for v2.

> 
>> -		    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







More information about the pve-devel mailing list