[pve-devel] r5127 - in qemu-server/pve2: . PVE/API2
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon Sep 13 13:53:21 CEST 2010
Author: dietmar
Date: 2010-09-13 11:53:21 +0000 (Mon, 13 Sep 2010)
New Revision: 5127
Modified:
qemu-server/pve2/ChangeLog
qemu-server/pve2/PVE/API2/QemuServerStatus.pm
qemu-server/pve2/QemuServer.pm
qemu-server/pve2/nqm
qemu-server/pve2/qm
Log:
* nqm: implement vncticket
Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog 2010-09-13 11:46:56 UTC (rev 5126)
+++ qemu-server/pve2/ChangeLog 2010-09-13 11:53:21 UTC (rev 5127)
@@ -1,5 +1,7 @@
2010-09-13 Proxmox Support Team <support at proxmox.com>
+ * nqm: implement vncticket
+
* PVE/API2/QemuServer.pm: implement destroy_vm()
* PVE/API2/QemuServerStatus.pm: implement vm_command()
Modified: qemu-server/pve2/PVE/API2/QemuServerStatus.pm
===================================================================
--- qemu-server/pve2/PVE/API2/QemuServerStatus.pm 2010-09-13 11:46:56 UTC (rev 5126)
+++ qemu-server/pve2/PVE/API2/QemuServerStatus.pm 2010-09-13 11:53:21 UTC (rev 5127)
@@ -61,7 +61,18 @@
type => 'boolean',
optional => 1,
},
- command => { type => 'string' },
+ command => {
+ type => 'string',
+ enum => [qw(start stop reset shutdown cad suspend resume vncticket) ],
+ },
+ ticket => {
+ description => "Secret VNC ticket (required by vncticket command).",
+ type => 'string',
+ optional => 1,
+ minLength => 8, # just to improve security
+ pattern => '[A-Za-z0-9\+\/\=]+', # base64 characters
+
+ },
}),
},
returns => { type => 'null'},
@@ -102,6 +113,9 @@
PVE::QemuServer::vm_resume($vmid, $skiplock);
} elsif ($command eq 'cad') {
PVE::QemuServer::vm_cad($vmid, $skiplock);
+ } elsif ($command eq 'vncticket') {
+ my $ticket = $param->{ticket};
+ PVE::QemuServer::vm_monitor_command ($vmid, "change vnc ticket $ticket", 1);
} else {
raise_param_exc({ command => "unknown command '$command'" })
}
Modified: qemu-server/pve2/QemuServer.pm
===================================================================
--- qemu-server/pve2/QemuServer.pm 2010-09-13 11:46:56 UTC (rev 5126)
+++ qemu-server/pve2/QemuServer.pm 2010-09-13 11:53:21 UTC (rev 5127)
@@ -2243,7 +2243,7 @@
}
sub vm_vncticket {
- my ($self, $vmid, $ticket) = @_;
+ my ($vmid, $ticket) = @_;
# generate ticket, olny first 8 character used by vnc
$ticket = Digest::SHA1::sha1_base64 (rand(), time()) if !$ticket;
Modified: qemu-server/pve2/nqm
===================================================================
--- qemu-server/pve2/nqm 2010-09-13 11:46:56 UTC (rev 5126)
+++ qemu-server/pve2/nqm 2010-09-13 11:53:21 UTC (rev 5127)
@@ -83,6 +83,29 @@
}});
__PACKAGE__->register_method ({
+ name => 'vncticket',
+ path => 'vncticket',
+ method => 'PUT',
+ description => "Create and set a VNC authentication ticket.",
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ vmid => get_standard_option('pve-vmid'),
+ },
+ },
+ returns => { type => 'null'},
+ code => sub {
+ my ($param) = @_;
+
+ my $vmid = $param->{vmid};
+
+ my $ticket = PVE::QemuServer::vm_vncticket ($vmid);
+ print "TICKET:$ticket\n";
+
+ return undef;
+ }});
+
+__PACKAGE__->register_method ({
name => 'unlock',
path => 'unlock',
method => 'PUT',
@@ -245,7 +268,6 @@
}});
# fixme: unlink
-# fixme: vncticket
# fixme: cdrom
# fixme: vncproxy, vnc
@@ -288,6 +310,8 @@
status => [ __PACKAGE__, 'status', ['vmid']],
+ vncticket => [ __PACKAGE__, 'vncticket', ['vmid']],
+
wait => [ __PACKAGE__, 'wait', ['vmid']],
unlock => [ __PACKAGE__, 'unlock', ['vmid']],
Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm 2010-09-13 11:46:56 UTC (rev 5126)
+++ qemu-server/pve2/qm 2010-09-13 11:53:21 UTC (rev 5127)
@@ -579,7 +579,7 @@
exit (-1);
}
- my $ticket = $qm->vm_vncticket ($vmid);
+ my $ticket = PVE::QemuServer::vm_vncticket ($vmid);
print "TICKET:$ticket\n";
} elsif ($cmd eq 'cdrom') {
More information about the pve-devel
mailing list