]> git.proxmox.com Git - pve-cluster.git/commitdiff
cluster create: use new corosync-link format for totem interfaces
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 28 May 2019 16:07:05 +0000 (18:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 13 Jun 2019 08:21:03 +0000 (10:21 +0200)
Preparation for enhanced compatibility with new corosync 3/knet
transport. Pretty straight forward switch from ringX_addr to links,
*but*, for configuration backward compatibility corosync still uses
"ringX_addr" as "link address", this will surely add confusion...

We drop all the "all IP versions must match" checking code, as
1. it could not cope with unresolved hostname's anyway
2. links can be on different IP versions with kronosnet

This makes it a bit easier and shorter, we can re-add some (saner)
checking always later on, if people misconfigure this often..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/PVE/API2/ClusterConfig.pm
data/PVE/Corosync.pm

index e7142b5455835efb1abadad3e27531b95f66b7ea..8b1fdbeb518531c1b052e64f4dd08c2afbfb3271 100644 (file)
@@ -95,20 +95,8 @@ __PACKAGE__->register_method ({
                minimum => 1,
                optional => 1,
            },
-           bindnet0_addr => {
-               type => 'string', format => 'ip',
-               description => "This specifies the network address the corosync ring 0".
-                   " executive should bind to and defaults to the local IP address of the node.",
-               optional => 1,
-           },
-           ring0_addr => get_standard_option('corosync-ring0-addr'),
-           bindnet1_addr => {
-               type => 'string', format => 'ip',
-               description => "This specifies the network address the corosync ring 1".
-                   " executive should bind to and is optional.",
-               optional => 1,
-           },
-           ring1_addr => get_standard_option('corosync-ring1-addr'),
+           link0 => get_standard_option('corosync-link'),
+           link1 => get_standard_option('corosync-link'),
        },
     },
     returns => { type => 'string' },
index fea72584032acd16d18e4beae92f5ee43b2b1cf2..0d2a85f7dda7d31771461a89bf267725049bdfac 100644 (file)
@@ -202,12 +202,9 @@ sub create_conf {
     my $votes = $param{votes} || 1;
 
     my $local_ip_address = PVE::Cluster::remote_node_ip($nodename);
-    my $ring0_addr = $param{ring0_addr} // $local_ip_address;
-    my $bindnet0_addr = $param{bindnet0_addr} // $ring0_addr;
 
-    my $use_ipv6 = ip_is_ipv6($ring0_addr);
-    die "ring 0 addresses must be from same IP family!\n"
-       if $use_ipv6 != ip_is_ipv6($bindnet0_addr);
+    my $link0 = PVE::Cluster::parse_corosync_link($param{link0});
+    $link0->{address} //= $local_ip_address;
 
     my $conf = {
        totem => {
@@ -215,10 +212,9 @@ sub create_conf {
            secauth => 'on',
            cluster_name => $clustername,
            config_version => 0,
-           ip_version => $use_ipv6 ? 'ipv6' : 'ipv4',
+           ip_version => 'ipv4-6',
            interface => {
                0 => {
-                   bindnetaddr => $bindnet0_addr,
                    linknumber => 0,
                },
            },
@@ -229,7 +225,7 @@ sub create_conf {
                    name => $nodename,
                    nodeid => $nodeid,
                    quorum_votes => $votes,
-                   ring0_addr => $ring0_addr,
+                   ring0_addr => $link0->{address},
                },
            },
        },
@@ -242,23 +238,14 @@ sub create_conf {
        },
     };
 
-    die "Param bindnet1_addr set but ring1_addr not specified!\n"
-       if (defined($param{bindnet1_addr}) && !defined($param{ring1_addr}));
-
-    my $ring1_addr = $param{ring1_addr};
-    my $bindnet1_addr = $param{bindnet1_addr} // $param{ring1_addr};
-
-    if ($bindnet1_addr) {
-       die "ring 1 addresses must be from same IP family as ring 0!\n"
-           if $use_ipv6 != ip_is_ipv6($bindnet1_addr) ||
-              $use_ipv6 != ip_is_ipv6($ring1_addr);
+    my $link1 = PVE::Cluster::parse_corosync_link($param{link1});
 
+    if ($link1->{address}) {
        $conf->{totem}->{interface}->{1} = {
-           bindnetaddr => $bindnet1_addr,
            linknumber => 1,
        };
-       $conf->{totem}->{rrp_mode} = 'passive';
-       $conf->{nodelist}->{node}->{$nodename}->{ring1_addr} = $ring1_addr;
+       $conf->{totem}->{link_mode} = 'passive';
+       $conf->{nodelist}->{node}->{$nodename}->{ring1_addr} = $link1->{address};
     }
 
     return { main => $conf };