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' },
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 => {
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,
},
},
name => $nodename,
nodeid => $nodeid,
quorum_votes => $votes,
- ring0_addr => $ring0_addr,
+ ring0_addr => $link0->{address},
},
},
},
},
};
- 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 };