From: Wolfgang Bumiller Date: Tue, 12 May 2015 10:14:03 +0000 (+0200) Subject: pass port family to next_*_port() calls X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=af0eba7e359d8516b076182cf40e3e91fc2ed0ad;p=qemu-server.git pass port family to next_*_port() calls --- diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index c0a6bc31..fae28720 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1299,17 +1299,19 @@ __PACKAGE__->register_method({ $sslcert = PVE::Tools::file_get_contents("/etc/pve/pve-root-ca.pem", 8192) if !$sslcert; - my $port = PVE::Tools::next_vnc_port(); - - my $remip; + my ($remip, $family); my $remcmd = []; if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) { - $remip = PVE::Cluster::remote_node_ip($node); + ($remip, $family) = PVE::Cluster::remote_node_ip($node); # NOTE: kvm VNC traffic is already TLS encrypted or is known unsecure $remcmd = ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes', $remip]; + } else { + $family = PVE::Tools::get_host_address_family($node); } + my $port = PVE::Tools::next_vnc_port($family); + my $timeout = 10; my $realcmd = sub { diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index f6eb3f51..5eb488f5 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -354,7 +354,8 @@ sub phase2 { ## create tunnel to remote port $self->log('info', "starting ssh migration tunnel"); - my $lport = ($raddr eq "localhost") ? PVE::Tools::next_migrate_port() : undef; + my $pfamily = PVE::Tools::get_host_address_family($nodename); + my $lport = ($raddr eq "localhost") ? PVE::Tools::next_migrate_port($pfamily) : undef; $self->{tunnel} = $self->fork_tunnel($self->{nodeip}, $lport, $rport); my $start = time(); diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 08be8ba1..3ac0eae4 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -3020,7 +3020,9 @@ sub config_to_command { my $pciaddr = print_pci_addr("spice", $bridges); - $spice_port = PVE::Tools::next_spice_port(); + my $nodename = PVE::INotify::nodename(); + my $pfamily = PVE::Tools::get_host_address_family($nodename); + $spice_port = PVE::Tools::next_spice_port($pfamily); push @$devices, '-spice', "tls-port=${spice_port},addr=127.0.0.1,tls-ciphers=DES-CBC3-SHA,seamless-migration=on"; @@ -4194,11 +4196,12 @@ sub vm_start { if ($statefile eq 'tcp') { my $localip = "localhost"; my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); + my $nodename = PVE::INotify::nodename(); if ($datacenterconf->{migration_unsecure}) { - my $nodename = PVE::INotify::nodename(); $localip = PVE::Cluster::remote_node_ip($nodename, 1); } - $migrate_port = PVE::Tools::next_migrate_port(); + my $pfamily = PVE::Tools::get_host_address_family($nodename); + $migrate_port = PVE::Tools::next_migrate_port($pfamily); $migrate_uri = "tcp:${localip}:${migrate_port}"; push @$cmd, '-incoming', $migrate_uri; push @$cmd, '-S';