remove the noerr flag so that we error out when we get multiple IPs from a CIDR or none at all, the user has to guarantee that his CIDR matches just one IP on each local host.
Catch an possible error and die on it, if simply no migration ip is given as a parameter and also not set in datacenter.cfg just print out 'no ip' and return as previously. Signed-off-by: Thomas Lamprecht <[email protected]> --- data/PVE/CLI/pvecm.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm index 65a063d..04c7462 100755 --- a/data/PVE/CLI/pvecm.pm +++ b/data/PVE/CLI/pvecm.pm @@ -867,10 +867,17 @@ __PACKAGE__->register_method ({ if ($param->{get_migration_ip}) { my $network = $param->{migration_network}; - if (my $ip = PVE::Cluster::get_local_migration_ip($network, 1)) { + + my $ip; + eval { $ip = PVE::Cluster::get_local_migration_ip($network); }; + my $err = $@; + + if ($err) { + die "could not get migration ip: $err\n"; + } elsif (defined($ip)) { print "ip: '$ip'\n"; } else { - print "no ip\n" + print "no ip\n"; } # do not keep tunnel open when asked for migration ip return undef; -- 2.1.4 _______________________________________________ pve-devel mailing list [email protected] http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
