From: Thomas Lamprecht Date: Tue, 28 May 2019 16:13:22 +0000 (+0200) Subject: corosync: allow to set link priorities X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=e7f9c8cc7f9986c1c30d309ad2826a6f33b14b3f;p=pve-cluster.git corosync: allow to set link priorities 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 --- diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm index 15c19be..e3eba1d 100644 --- a/data/PVE/Cluster.pm +++ b/data/PVE/Cluster.pm @@ -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, 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}; - 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}; }