]> git.proxmox.com Git - pve-cluster.git/commitdiff
corosync: allow to set link priorities
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 28 May 2019 16:13:22 +0000 (18:13 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 13 Jun 2019 08:21:30 +0000 (10:21 +0200)
For now in passive mode, a link with a higher value has a lower
priority. If the current active link fails the one with the next
higher priority will take over. Use 255 as maximum, as internally
kronosnet uses an uin8_t variable for this, and while there can be
"only" 8 links currently it may be still nice to use different values
that ]0..1[ for them, e.g., when re-shuffling link priorities it's
useful to have space between them.

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

index 15c19bea833f0998877860786ec95f70ef49ff5a..e3eba1deaf14ac308c54156f97e7798f55a69383 100644 (file)
@@ -1861,6 +1861,14 @@ my $corosync_link_format = {
        format_description => 'IP',
        description => "Hostname (or IP) of this corosync link address.",
     },
+    priority => {
+       optional => 1,
+       type => 'integer',
+       minimum => 0,
+       maximum => 255,
+       default => 0,
+       description => "The priority for the link when knet is used in 'passive' mode. Lower value means higher priority.",
+    },
 };
 my $corosync_link_desc = {
     type => 'string', format => $corosync_link_format,
index 0d2a85f7dda7d31771461a89bf267725049bdfac..e73e51da2de3504b20e342539b98ab84c7c856e8 100644 (file)
@@ -237,14 +237,19 @@ sub create_conf {
            debug => 'off',
        },
     };
+    my $totem = $conf->{totem};
 
-    my $link1 = PVE::Cluster::parse_corosync_link($param{link1});
+    $totem->{interface}->{0}->{knet_link_priority} = $link0->{priority}
+       if defined($link0->{priority});
 
+    my $link1 = PVE::Cluster::parse_corosync_link($param{link1});
     if ($link1->{address}) {
        $conf->{totem}->{interface}->{1} = {
            linknumber => 1,
        };
-       $conf->{totem}->{link_mode} = 'passive';
+       $totem->{link_mode} = 'passive';
+       $totem->{interface}->{1}->{knet_link_priority} = $link1->{priority}
+           if defined($link1->{priority});
        $conf->{nodelist}->{node}->{$nodename}->{ring1_addr} = $link1->{address};
     }