[pve-devel] [PATCH cluster 3/3] pvecm add: re-allow using hostnames for #1369 ringX_addr

Thomas Lamprecht t.lamprecht at proxmox.com
Thu May 4 08:18:18 CEST 2017


As the regression hit our pve-cluster git repo before stable-4 was 
branched of,
this needs also being applied there.

For  a fix at least the common patch and this one (cluster 3/3) needs to 
get applied.
But I do not object in applying all four patches, just FYI.

cheers,
Thomas

On 05/02/2017 11:51 AM, Thomas Lamprecht wrote:
> If an user passed a hostname as ring0_addr or ring1_addr the check_ip
> checked failed as it implicitly assumed IPs even if we allowed a
> general address (i.e. IP or hostname) as a format for those
> properties.
>
> Fixes: #1369
> Reported here: https://forum.proxmox.com/threads/34342/
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>   data/PVE/CLI/pvecm.pm | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
> index 4366066..e33a311 100755
> --- a/data/PVE/CLI/pvecm.pm
> +++ b/data/PVE/CLI/pvecm.pm
> @@ -540,6 +540,15 @@ __PACKAGE__->register_method ({
>   	my $check_ip = sub {
>   	    my $ip = shift;
>   	    if (defined($ip)) {
> +		if (!PVE::JSONSchema::pve_verify_ip($ip, 1)) {
> +		    my $host = $ip;
> +		    eval { $ip = PVE::Network::get_ip_from_hostname($host); };
> +		    if ($@) {
> +			&$error("cannot use '$host': $@\n") ;
> +			return;
> +		    }
> +		}
> +
>   		my $cidr = (Net::IP::ip_is_ipv6($ip)) ? "$ip/128" : "$ip/32";
>   		my $configured_ips = PVE::Network::get_local_ip_from_cidr($cidr);
>   





More information about the pve-devel mailing list