[pve-devel] [RFC cluster 4/6] corosync: allow to set link priorities
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue May 28 18:33:11 CEST 2019
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.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
data/PVE/Cluster.pm | 7 +++++++
data/PVE/Corosync.pm | 11 +++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index ddb6d2d..8e611d9 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1853,6 +1853,13 @@ my $corosync_link_format = {
format_description => 'IP',
default => 'same as address',
},
+ priority => {
+ optional => 1,
+ type => 'integer',
+ minimum => 0,
+ 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,
diff --git a/data/PVE/Corosync.pm b/data/PVE/Corosync.pm
index 8752c64..64f0f7c 100644
--- a/data/PVE/Corosync.pm
+++ b/data/PVE/Corosync.pm
@@ -247,16 +247,23 @@ sub create_conf {
my $link1 = PVE::Cluster::parse_corosync_link($param{link1});
$link1->{bindnet} //= $link1->{address};
+ my $totem = $conf->{totem};
+
+ $totem->{interface}->{0}->{knet_link_priority} = $link0->{priority}
+ if defined($link0->{priority});
+
if ($link1->{bindnet}) {
die "link 1 addresses must be from same IP family as link 0!\n"
if $use_ipv6 != ip_is_ipv6($link1->{address}) ||
$use_ipv6 != ip_is_ipv6($link1->{bindnet});
- $conf->{totem}->{interface}->{1} = {
+ $totem->{interface}->{1} = {
bindnetaddr => $link1->{bindnet},
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};
}
--
2.20.1
More information about the pve-devel
mailing list