[pve-devel] [PATCH v2 manager 09/14] api: ceph: mon: fix handling of IPv6 addresses in find_mon_ip
Fabian Ebner
f.ebner at proxmox.com
Mon May 10 14:18:21 CEST 2021
by comparing their canonical forms.
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
New in v2.
Dependency bump for pve-common needed.
PVE/API2/Ceph/MON.pm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm
index 24318a36..f7af3c37 100644
--- a/PVE/API2/Ceph/MON.pm
+++ b/PVE/API2/Ceph/MON.pm
@@ -38,16 +38,20 @@ my $find_mon_ip = sub {
}
my $allowed_ips = PVE::Network::get_local_ip_from_cidr($pubnet);
+ $allowed_ips = PVE::Network::unique_ips($allowed_ips);
+
die "No active IP found for the requested ceph public network '$pubnet' on node '$node'\n"
if scalar(@$allowed_ips) < 1;
if (!$overwrite_ip) {
- if (scalar(@$allowed_ips) == 1 || !grep { $_ ne $allowed_ips->[0] } @$allowed_ips) {
+ if (scalar(@$allowed_ips) == 1) {
return $allowed_ips->[0];
}
die "Multiple IPs for ceph public network '$pubnet' detected on $node:\n".
join("\n", @$allowed_ips) ."\nuse 'mon-address' to specify one of them.\n";
} else {
+ $overwrite_ip = PVE::Network::canonical_ip($overwrite_ip);
+
if (grep { $_ eq $overwrite_ip } @$allowed_ips) {
return $overwrite_ip;
}
--
2.20.1
More information about the pve-devel
mailing list