use File::Path;
use IO::Socket::UNIX;
use IO::Select;
+use URI::Escape;
use PVE::Tools qw(extract_param);
use PVE::Cluster;
use PVE::QemuServer::ImportDisk;
use PVE::QemuServer::OVF;
use PVE::API2::Qemu;
+use PVE::API2::Qemu::Agent;
use JSON;
use PVE::JSONSchema qw(get_standard_option);
use Term::ReadLine;
$tunnel_write->("tunnel online");
$tunnel_write->("ver 1");
- while (my $line = <>) {
+ while (my $line = <STDIN>) {
chomp $line;
if ($line =~ /^quit$/) {
$tunnel_write->("OK");
print to_json($result, { pretty => 1, canonical => 1});
};
+sub param_mapping {
+ my ($name) = @_;
+
+ my $ssh_key_map = ['sshkeys', sub {
+ return URI::Escape::uri_escape(PVE::Tools::file_get_contents($_[0]));
+ }];
+ my $mapping = {
+ 'update_vm' => [$ssh_key_map],
+ 'create_vm' => [$ssh_key_map],
+ };
+
+ return $mapping->{$name};
+}
+
our $cmddef = {
list => [ "PVE::API2::Qemu", 'vmlist', [],
{ node => $nodename }, sub {
monitor => [ __PACKAGE__, 'monitor', ['vmid']],
- agent => [ "PVE::API2::Qemu", 'agent', ['vmid', 'command'],
+ agent => [ "PVE::API2::Qemu::Agent", 'agent', ['vmid', 'command'],
{ node => $nodename }, $print_agent_result ],
mtunnel => [ __PACKAGE__, 'mtunnel', []],