[pve-devel] [PATCH cluster v2 1/8] corosync config: support 'linknumber' property
    Thomas Lamprecht 
    t.lamprecht at proxmox.com
       
    Tue Jun 11 19:36:26 CEST 2019
    
    
  
Corosync has moved its rings a layer up, i.e., abstracted away from
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 compatibility and accept 'ringnumber'
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>
---
changes v1 (RFC) -> v2:
* fix commit message typos
 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,
-		    ringnumber => 0,
+		    linknumber => 0,
 		},
 	    },
 	},
@@ -246,7 +255,7 @@ sub create_conf {
 
 	$conf->{totem}->{interface}->{1} = {
 	    bindnetaddr => $bindnet1_addr,
-	    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