]>
git.proxmox.com Git - pve-cluster.git/blob - data/PVE/SSHInfo.pm
10 my ($node, $network_cidr) = @_;
13 if (defined($network_cidr)) {
14 # Use mtunnel via to get the remote node's ip inside $network_cidr.
15 # This goes over the regular network (iow. uses get_ssh_info() with
16 # $network_cidr undefined.
17 # FIXME: Use the REST API client for this after creating an API entry
18 # for get_migration_ip.
19 my $default_remote = get_ssh_info
($node, undef);
20 my $default_ssh = ssh_info_to_command
($default_remote);
21 my $cmd =[@$default_ssh, 'pvecm', 'mtunnel',
22 '-migration_network', $network_cidr,
25 PVE
::Tools
::run_command
($cmd, outfunc
=> sub {
28 die "internal error: unexpected output from mtunnel\n"
30 if ($line =~ /^ip: '(.*)'$/) {
33 die "internal error: bad output from mtunnel\n"
37 die "failed to get ip for node '$node' in network '$network_cidr'\n"
40 $ip = PVE
::Cluster
::remote_node_ip
($node);
46 network
=> $network_cidr,
50 sub ssh_info_to_command_base
{
51 my ($info, @extra_options) = @_;
55 '-o', 'BatchMode=yes',
56 '-o', 'HostKeyAlias='.$info->{name
},
61 sub ssh_info_to_command
{
62 my ($info, @extra_options) = @_;
63 my $cmd = ssh_info_to_command_base
($info, @extra_options);
64 push @$cmd, "root\@$info->{ip}";