]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #2787: properly parse 'vga' for vncproxy
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 17 Jun 2020 08:41:16 +0000 (10:41 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Jun 2020 12:04:26 +0000 (14:04 +0200)
'vga' is a property string, we can't just assume it starts with the
default key's value.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/Qemu.pm

index 974ee3b1e0b41259a5b605c15c060217d317df3e..9cfaa29fdaa0ee393227ffa45d839c2916e47fd7 100644 (file)
@@ -1634,7 +1634,12 @@ __PACKAGE__->register_method({
        my $websocket = $param->{websocket};
 
        my $conf = PVE::QemuConfig->load_config($vmid, $node); # check if VM exists
-       my $use_serial = ($conf->{vga} && ($conf->{vga} =~ m/^serial\d+$/));
+       
+       my $serial;
+       if ($conf->{vga}) {
+           my $vga = PVE::QemuServer::parse_vga($conf->{vga});
+           $serial = $vga->{type} if $vga->{type} =~ m/^serial\d+$/;
+       }
 
        my $authpath = "/vms/$vmid";
 
@@ -1650,7 +1655,7 @@ __PACKAGE__->register_method({
            (undef, $family) = PVE::Cluster::remote_node_ip($node);
            my $sshinfo = PVE::SSHInfo::get_ssh_info($node);
            # NOTE: kvm VNC traffic is already TLS encrypted or is known unsecure
-           $remcmd = PVE::SSHInfo::ssh_info_to_command($sshinfo, $use_serial ? '-t' : '-T');
+           $remcmd = PVE::SSHInfo::ssh_info_to_command($sshinfo, defined($serial) ? '-t' : '-T');
        } else {
            $family = PVE::Tools::get_host_address_family($node);
        }
@@ -1666,9 +1671,9 @@ __PACKAGE__->register_method({
 
            my $cmd;
 
-           if ($use_serial) {
+           if (defined($serial)) {
 
-               my $termcmd = [ '/usr/sbin/qm', 'terminal', $vmid, '-iface', $conf->{vga}, '-escape', '0' ];
+               my $termcmd = [ '/usr/sbin/qm', 'terminal', $vmid, '-iface', $serial, '-escape', '0' ];
 
                $cmd = ['/usr/bin/vncterm', '-rfbport', $port,
                        '-timeout', $timeout, '-authpath', $authpath,