[pve-devel] [PATCH cluster v2 4/8] corosync: allow to set link priorities
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Jun 11 19:36:29 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. 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 at proxmox.com>
---
changes v1 (RFC) -> v2:
* adapt to dropped bindnet
* set priority maxmium to 255, as knet uses internally a byte for this
data/PVE/Cluster.pm | 8 ++++++++
data/PVE/Corosync.pm | 9 +++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index 82533fa..c06b0bf 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1846,6 +1846,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,
diff --git a/data/PVE/Corosync.pm b/data/PVE/Corosync.pm
index 0d2a85f..e73e51d 100644
--- a/data/PVE/Corosync.pm
+++ b/data/PVE/Corosync.pm
@@ -237,14 +237,19 @@ sub create_conf {
debug => 'off',
},
};
+ my $totem = $conf->{totem};
+
+ $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};
}
--
2.20.1
More information about the pve-devel
mailing list