[pve-devel] [PATCH common v2] use the pvecm mtunnel command to get remote migration ip

Dietmar Maurer dietmar at proxmox.com
Thu Nov 3 12:18:20 CET 2016


additional comment inline:

> +sub get_remote_migration_ip {
> +    my ($self) = @_;
> +
> +    my $ip;
> +
> +    my $cmd = [@{$self->{rem_ssh}}, 'pvecm', 'mtunnel',
> '--get_migration_ip'];
> +
> +    push @$cmd, '--migration_network', $self->{opts}->{migration_network}
> +      if defined($self->{opts}->{migration_network});
> +
> +    PVE::Tools::run_command($cmd, outfunc => sub {
> +	my $line = shift;
> +
> +	# use non-restrictive regex for ip, its already checked by the remote side
> +	if ($line =~ m/^ip: '(\S+)'$/) {

Please can we use a better regex here ($PVE::Tools::IPRE)? It does not
harm and is easy to implement.

> +	   $ip = $1;
> +	}
> +    });
> +
> +    return $ip;
> +}
> +




More information about the pve-devel mailing list