mostly relevant to prepare support for IPv4/IPv6 dual stack mode as a special case of the planned support for mutliple public networks.
As before, only set the false value when we are dealing with the first address, but also be explicit about the IPv4 case as the defaults might change in the future. Then, when an address of a different type comes along later, set the relevant bind option to true. Signed-off-by: Fabian Ebner <f.eb...@proxmox.com> --- PVE/API2/Ceph/MON.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm index 8f2d5bc4..618d3f06 100644 --- a/PVE/API2/Ceph/MON.pm +++ b/PVE/API2/Ceph/MON.pm @@ -259,6 +259,15 @@ __PACKAGE__->register_method ({ run_command(['chown', 'ceph:ceph', $mondir]); + my $is_first_address = !defined($rados); + if (Net::IP::ip_is_ipv6($ip)) { + $cfg->{global}->{ms_bind_ipv6} = 'true'; + $cfg->{global}->{ms_bind_ipv4} = 'false' if $is_first_address; + } else { + $cfg->{global}->{ms_bind_ipv4} = 'true'; + $cfg->{global}->{ms_bind_ipv6} = 'false' if $is_first_address; + } + if (defined($rados)) { # we can only have a RADOS object if we have a monitor my $mapdata = $rados->mon_command({ prefix => 'mon getmap', format => 'plain' }); file_set_contents($monmap, $mapdata); @@ -266,8 +275,6 @@ __PACKAGE__->register_method ({ my $monaddr = $ip; if (Net::IP::ip_is_ipv6($ip)) { $monaddr = "[$ip]"; - $cfg->{global}->{ms_bind_ipv6} = 'true'; - $cfg->{global}->{ms_bind_ipv4} = 'false'; } run_command([ 'monmaptool', -- 2.20.1 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel