-#!/usr/bin/perl -w
+#!/usr/bin/perl
use strict;
+use warnings;
use Getopt::Long;
use Fcntl ':flock';
use File::Path;
my $nodename = PVE::INotify::nodename();
sub run_vnc_proxy {
- my ($vmid) = @_;
-
- my $path = PVE::QemuServer::vnc_socket($vmid);
+ my ($path) = @_;
my $c;
while ( ++$c < 10 && !-e $path ) { sleep(1); }
my ($param) = @_;
my $vmid = $param->{vmid};
+ my $vnc_socket = PVE::QemuServer::vnc_socket($vmid);
+
+ if (my $ticket = $ENV{LC_PVE_TICKET}) { # NOTE: ssh on debian only pass LC_* variables
+ PVE::QemuServer::vm_mon_cmd($vmid, "change", device => 'vnc', target => "unix:$vnc_socket,password");
+ PVE::QemuServer::vm_mon_cmd($vmid, "set_password", protocol => 'vnc', password => $ticket);
+ PVE::QemuServer::vm_mon_cmd($vmid, "expire_password", protocol => 'vnc', time => "+30");
+ } else {
+ PVE::QemuServer::vm_mon_cmd($vmid, "change", device => 'vnc', target => "unix:$vnc_socket,x509,password");
+ }
- run_vnc_proxy ($vmid);
+ run_vnc_proxy($vnc_socket);
return undef;
}});
properties => {
vmid => get_standard_option('pve-vmid'),
iface => {
+ description => "Select the serial device. By default we simply use the first suitable device.",
type => 'string',
optional => 1,
enum => [qw(serial0 serial1 serial2 serial3)],
move_disk => [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node => $nodename }, $upid_exit ],
- unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid', 'idlist'], { node => $nodename } ],
+ unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid'], { node => $nodename } ],
config => [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
{ node => $nodename }, sub {