]>
git.proxmox.com Git - qemu-server.git/blob - PVE/CLI/qm.pm
f4bacd696121d94e973130ef67f3b2911906575c
6 # Note: disable '+' prefix for Getopt::Long (for resize command)
7 use Getopt
::Long
qw(:config no_getopt_compat);
15 use PVE
::Tools
qw(extract_param);
19 use PVE
::RPCEnvironment
;
20 use PVE
::Exception
qw(raise_param_exc);
23 use PVE
::QemuServer
::ImportDisk
;
24 use PVE
::QemuServer
::OVF
;
25 use PVE
::QemuServer
::Agent
qw(agent_available);
27 use PVE
::API2
::Qemu
::Agent
;
29 use PVE
::JSONSchema
qw(get_standard_option);
34 use base
qw(PVE::CLIHandler);
38 my $status = PVE
::Tools
::upid_read_status
($upid);
39 exit($status eq 'OK' ?
0 : -1);
42 my $nodename = PVE
::INotify
::nodename
();
44 sub setup_environment
{
45 PVE
::RPCEnvironment-
>setup_default_cli_env();
52 while ( ++$c < 10 && !-e
$path ) { sleep(1); }
54 my $s = IO
::Socket
::UNIX-
>new(Peer
=> $path, Timeout
=> 120);
56 die "unable to connect to socket '$path' - $!" if !$s;
58 my $select = new IO
::Select
;
60 $select->add(\
*STDIN
);
63 my $timeout = 60*15; # 15 minutes
66 while ($select->count &&
67 scalar(@handles = $select->can_read ($timeout))) {
68 foreach my $h (@handles) {
70 my $n = $h->sysread($buf, 4096);
80 syswrite(\
*STDOUT
, $buf);
90 sub print_recursive_hash
{
91 my ($prefix, $hash, $key) = @_;
93 if (ref($hash) eq 'HASH') {
95 print "$prefix$key:\n";
97 foreach my $itemkey (keys %$hash) {
98 print_recursive_hash
("\t$prefix", $hash->{$itemkey}, $itemkey);
100 } elsif (ref($hash) eq 'ARRAY') {
102 print "$prefix$key:\n";
104 foreach my $item (@$hash) {
105 print_recursive_hash
("\t$prefix", $item);
107 } elsif (!ref($hash) && defined($hash)) {
109 print "$prefix$key: $hash\n";
111 print "$prefix$hash\n";
116 __PACKAGE__-
>register_method ({
120 description
=> "Show command line which is used to start the VM (debug info).",
122 additionalProperties
=> 0,
124 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
126 description
=> "Puts each option on a new line to enhance human readability",
131 snapshot
=> get_standard_option
('pve-snapshot-name', {
132 description
=> "Fetch config values from given snapshot.",
135 my ($cmd, $pname, $cur, $args) = @_;
136 PVE
::QemuConfig-
>snapshot_list($args->[0]);
141 returns
=> { type
=> 'null'},
145 my $storecfg = PVE
::Storage
::config
();
146 my $cmdline = PVE
::QemuServer
::vm_commandline
($storecfg, $param->{vmid
}, $param->{snapshot
});
148 $cmdline =~ s/ -/ \\\n -/g if $param->{pretty
};
155 __PACKAGE__-
>register_method ({
159 description
=> "Show VM status.",
161 additionalProperties
=> 0,
163 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
165 description
=> "Verbose output format",
171 returns
=> { type
=> 'null'},
176 my $conf = PVE
::QemuConfig-
>load_config ($param->{vmid
});
178 my $vmstatus = PVE
::QemuServer
::vmstatus
($param->{vmid
}, 1);
179 my $stat = $vmstatus->{$param->{vmid
}};
180 if ($param->{verbose
}) {
181 foreach my $k (sort (keys %$stat)) {
182 next if $k eq 'cpu' || $k eq 'relcpu'; # always 0
184 print_recursive_hash
("", $v, $k);
187 my $status = $stat->{qmpstatus
} || 'unknown';
188 print "status: $status\n";
194 __PACKAGE__-
>register_method ({
198 description
=> "Proxy VM VNC traffic to stdin/stdout",
200 additionalProperties
=> 0,
202 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
205 returns
=> { type
=> 'null'},
209 my $vmid = $param->{vmid
};
210 my $vnc_socket = PVE
::QemuServer
::vnc_socket
($vmid);
212 if (my $ticket = $ENV{LC_PVE_TICKET
}) { # NOTE: ssh on debian only pass LC_* variables
213 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
214 PVE
::QemuServer
::vm_mon_cmd
($vmid, "set_password", protocol
=> 'vnc', password
=> $ticket);
215 PVE
::QemuServer
::vm_mon_cmd
($vmid, "expire_password", protocol
=> 'vnc', time => "+30");
217 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,x509,password");
220 run_vnc_proxy
($vnc_socket);
225 __PACKAGE__-
>register_method ({
229 description
=> "Unlock the VM.",
231 additionalProperties
=> 0,
233 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
236 returns
=> { type
=> 'null'},
240 my $vmid = $param->{vmid
};
242 PVE
::QemuConfig-
>lock_config ($vmid, sub {
243 my $conf = PVE
::QemuConfig-
>load_config($vmid);
244 delete $conf->{lock};
245 delete $conf->{pending
}->{lock} if $conf->{pending
}; # just to be sure
246 PVE
::QemuConfig-
>write_config($vmid, $conf);
252 __PACKAGE__-
>register_method ({
256 description
=> "Stop embedded nbd server.",
258 additionalProperties
=> 0,
260 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
263 returns
=> { type
=> 'null'},
267 my $vmid = $param->{vmid
};
269 PVE
::QemuServer
::nbd_stop
($vmid);
274 __PACKAGE__-
>register_method ({
278 description
=> "Used by qmigrate - do not use manually.",
280 additionalProperties
=> 0,
283 returns
=> { type
=> 'null'},
287 if (!PVE
::Cluster
::check_cfs_quorum
(1)) {
292 my $tunnel_write = sub {
299 $tunnel_write->("tunnel online");
300 $tunnel_write->("ver 1");
302 while (my $line = <STDIN
>) {
304 if ($line =~ /^quit$/) {
305 $tunnel_write->("OK");
307 } elsif ($line =~ /^resume (\d+)$/) {
309 if (PVE
::QemuServer
::check_running
($vmid, 1)) {
310 eval { PVE
::QemuServer
::vm_resume
($vmid, 1, 1); };
312 $tunnel_write->("ERR: resume failed - $@");
314 $tunnel_write->("OK");
317 $tunnel_write->("ERR: resume failed - VM $vmid not running");
325 __PACKAGE__-
>register_method ({
329 description
=> "Wait until the VM is stopped.",
331 additionalProperties
=> 0,
333 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
335 description
=> "Timeout in seconds. Default is to wait forever.",
342 returns
=> { type
=> 'null'},
346 my $vmid = $param->{vmid
};
347 my $timeout = $param->{timeout
};
349 my $pid = PVE
::QemuServer
::check_running
($vmid);
352 print "waiting until VM $vmid stopps (PID $pid)\n";
355 while ((!$timeout || ($count < $timeout)) && PVE
::QemuServer
::check_running
($vmid)) {
360 die "wait failed - got timeout\n" if PVE
::QemuServer
::check_running
($vmid);
365 __PACKAGE__-
>register_method ({
369 description
=> "Enter Qemu Monitor interface.",
371 additionalProperties
=> 0,
373 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
376 returns
=> { type
=> 'null'},
380 my $vmid = $param->{vmid
};
382 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
384 print "Entering Qemu Monitor for VM $vmid - type 'help' for help\n";
386 my $term = new Term
::ReadLine
('qm');
389 while (defined ($input = $term->readline('qm> '))) {
392 next if $input =~ m/^\s*$/;
394 last if $input =~ m/^\s*q(uit)?\s*$/;
397 print PVE
::QemuServer
::vm_human_monitor_command
($vmid, $input);
399 print "ERROR: $@" if $@;
406 __PACKAGE__-
>register_method ({
410 description
=> "Rescan all storages and update disk sizes and unused disk images.",
412 additionalProperties
=> 0,
414 vmid
=> get_standard_option
('pve-vmid', {
416 completion
=> \
&PVE
::QemuServer
::complete_vmid
,
422 description
=> 'Do not actually write changes out to VM config(s).',
426 returns
=> { type
=> 'null'},
430 my $dryrun = $param->{dryrun
};
432 print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
434 PVE
::QemuServer
::rescan
($param->{vmid
}, 0, $dryrun);
439 __PACKAGE__-
>register_method ({
440 name
=> 'importdisk',
441 path
=> 'importdisk',
443 description
=> "Import an external disk image as an unused disk in a VM. The
444 image format has to be supported by qemu-img(1).",
446 additionalProperties
=> 0,
448 vmid
=> get_standard_option
('pve-vmid', {completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
450 description
=> 'Path to the disk image to import',
454 storage
=> get_standard_option
('pve-storage-id', {
455 description
=> 'Target storage ID',
456 completion
=> \
&PVE
::QemuServer
::complete_storage
,
461 description
=> 'Target format',
462 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
467 returns
=> { type
=> 'null'},
471 my $vmid = extract_param
($param, 'vmid');
472 my $source = extract_param
($param, 'source');
473 my $storeid = extract_param
($param, 'storage');
474 my $format = extract_param
($param, 'format');
476 my $vm_conf = PVE
::QemuConfig-
>load_config($vmid);
477 PVE
::QemuConfig-
>check_lock($vm_conf);
478 die "$source: non-existent or non-regular file\n" if (! -f
$source);
480 my $storecfg = PVE
::Storage
::config
();
481 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
483 my $target_storage_config =
484 PVE
::Storage
::storage_config
($storecfg, $storeid);
485 die "storage $storeid does not support vm images\n"
486 if !$target_storage_config->{content
}->{images
};
488 PVE
::QemuServer
::ImportDisk
::do_import
($source, $vmid, $storeid, { format
=> $format });
493 __PACKAGE__-
>register_method ({
497 description
=> "Open a terminal using a serial device (The VM need to have a serial device configured, for example 'serial0: socket')",
499 additionalProperties
=> 0,
501 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
503 description
=> "Select the serial device. By default we simply use the first suitable device.",
506 enum
=> [qw(serial0 serial1 serial2 serial3)],
509 description
=> "Escape character.",
516 returns
=> { type
=> 'null'},
520 my $vmid = $param->{vmid
};
522 my $escape = $param->{escape
} // '^O';
523 if ($escape =~ /^\^([\x40-\x7a])$/) {
524 $escape = ord($1) & 0x1F;
525 } elsif ($escape =~ /^0x[0-9a-f]+$/i) {
526 $escape = hex($escape);
527 } elsif ($escape =~ /^[0-9]+$/) {
528 $escape = int($escape);
530 die "invalid escape character definition: $escape\n";
534 $escapemsg = sprintf(' (press Ctrl+%c to exit)', $escape+0x40);
535 $escape = sprintf(',escape=0x%x', $escape);
540 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
542 my $iface = $param->{iface
};
545 die "serial interface '$iface' is not configured\n" if !$conf->{$iface};
546 die "wrong serial type on interface '$iface'\n" if $conf->{$iface} ne 'socket';
548 foreach my $opt (qw(serial0 serial1 serial2 serial3)) {
549 if ($conf->{$opt} && ($conf->{$opt} eq 'socket')) {
554 die "unable to find a serial interface\n" if !$iface;
557 die "VM $vmid not running\n" if !PVE
::QemuServer
::check_running
($vmid);
559 my $socket = "/var/run/qemu-server/${vmid}.$iface";
561 my $cmd = "socat UNIX-CONNECT:$socket STDIO,raw,echo=0$escape";
563 print "starting serial terminal on interface ${iface}${escapemsg}\n";
570 __PACKAGE__-
>register_method ({
573 description
=> "Create a new VM using parameters read from an OVF manifest",
575 additionalProperties
=> 0,
577 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::Cluster
::complete_next_vmid
}),
580 description
=> 'path to the ovf file',
582 storage
=> get_standard_option
('pve-storage-id', {
583 description
=> 'Target storage ID',
584 completion
=> \
&PVE
::QemuServer
::complete_storage
,
589 description
=> 'Target format',
590 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
595 description
=> 'Print a parsed representation of the extracted OVF parameters, but do not create a VM',
600 returns
=> { type
=> 'null' },
604 my $vmid = PVE
::Tools
::extract_param
($param, 'vmid');
605 my $ovf_file = PVE
::Tools
::extract_param
($param, 'manifest');
606 my $storeid = PVE
::Tools
::extract_param
($param, 'storage');
607 my $format = PVE
::Tools
::extract_param
($param, 'format');
608 my $dryrun = PVE
::Tools
::extract_param
($param, 'dryrun');
610 die "$ovf_file: non-existent or non-regular file\n" if (! -f
$ovf_file);
611 my $storecfg = PVE
::Storage
::config
();
612 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
614 my $parsed = PVE
::QemuServer
::OVF
::parse_ovf
($ovf_file);
617 print to_json
($parsed, { pretty
=> 1, canonical
=> 1});
621 $param->{name
} = $parsed->{qm
}->{name
} if defined($parsed->{qm
}->{name
});
622 $param->{memory
} = $parsed->{qm
}->{memory
} if defined($parsed->{qm
}->{memory
});
623 $param->{cores
} = $parsed->{qm
}->{cores
} if defined($parsed->{qm
}->{cores
});
627 PVE
::Cluster
::check_vmid_unused
($vmid);
632 # order matters, as do_import() will load_config() internally
633 $conf->{vmgenid
} = PVE
::QemuServer
::generate_uuid
();
634 $conf->{smbios1
} = PVE
::QemuServer
::generate_smbios1_uuid
();
635 PVE
::QemuConfig-
>write_config($vmid, $conf);
637 foreach my $disk (@{ $parsed->{disks
} }) {
638 my ($file, $drive) = ($disk->{backing_file
}, $disk->{disk_address
});
639 PVE
::QemuServer
::ImportDisk
::do_import
($file, $vmid, $storeid,
640 { drive_name
=> $drive, format
=> $format });
643 # reload after disks entries have been created
644 $conf = PVE
::QemuConfig-
>load_config($vmid);
645 PVE
::QemuConfig-
>check_lock($conf);
646 my $firstdisk = PVE
::QemuServer
::resolve_first_disk
($conf);
647 $conf->{bootdisk
} = $firstdisk if $firstdisk;
648 PVE
::QemuConfig-
>write_config($vmid, $conf);
654 eval { PVE
::QemuServer
::vm_destroy
($storecfg, $vmid, $skiplock); };
655 die "import failed - $err";
659 my $wait_for_lock = 1;
660 PVE
::QemuConfig-
>lock_config_full($vmid, $wait_for_lock, $importfn);
667 __PACKAGE__-
>register_method({
672 description
=> "Executes the given command via the guest agent",
674 additionalProperties
=> 0,
676 node
=> get_standard_option
('pve-node'),
677 vmid
=> get_standard_option
('pve-vmid', {
678 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
683 description
=> "If set to off, returns the pid immediately instead of waiting for the commmand to finish or the timeout.",
687 description
=> "The maximum time to wait synchronously for the command to finish. If reached, the pid gets returned. Set to 0 to deactivate",
692 'extra-args' => get_standard_option
('extra-args'),
701 my $vmid = $param->{vmid
};
702 my $sync = $param->{synchronous
} // 1;
703 if (!$param->{'extra-args'} || !@{$param->{'extra-args'}}) {
704 raise_param_exc
( { 'extra-args' => "No command given" });
706 if (defined($param->{timeout
}) && !$sync) {
707 raise_param_exc
({ synchronous
=> "needs to be set for 'timeout'"});
710 my $res = PVE
::QemuServer
::Agent
::qemu_exec
($vmid, $param->{'extra-args'});
713 my $pid = $res->{pid
};
714 my $timeout = $param->{timeout
} // 30;
715 my $starttime = time();
717 while ($timeout == 0 || (time() - $starttime) < $timeout) {
718 my $out = PVE
::QemuServer
::Agent
::qemu_exec_status
($vmid, $pid);
719 if ($out->{exited
}) {
726 if (!$res->{exited
}) {
727 warn "timeout reached, returning pid\n";
731 return { result
=> $res };
734 __PACKAGE__-
>register_method({
739 description
=> "Cleans up resources like tap devices, vgpus, etc. Called after a vm shuts down, crashes, etc.",
741 additionalProperties
=> 0,
743 node
=> get_standard_option
('pve-node'),
744 vmid
=> get_standard_option
('pve-vmid', {
745 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
746 'clean-shutdown' => {
748 description
=> "Indicates if qemu shutdown cleanly.",
750 'guest-requested' => {
752 description
=> "Indicates if the shutdown was requested by the guest or via qmp.",
756 returns
=> { type
=> 'null', },
760 my $vmid = $param->{vmid
};
761 my $clean = $param->{'clean-shutdown'};
762 my $guest = $param->{'guest-requested'};
764 # return if we do not have the config anymore
765 return if !-f PVE
::QemuConfig-
>config_file($vmid);
767 my $storecfg = PVE
::Storage
::config
();
768 warn "Starting cleanup for $vmid\n";
770 PVE
::QemuConfig-
>lock_config($vmid, sub {
771 my $conf = PVE
::QemuConfig-
>load_config ($vmid);
772 my $pid = PVE
::QemuServer
::check_running
($vmid);
773 die "vm still running\n" if $pid;
776 # we have to cleanup the tap devices after a crash
778 foreach my $opt (keys %$conf) {
779 next if $opt !~ m/^net(\d)+$/;
781 PVE
::Network
::tap_unplug
("tap${vmid}i${interface}");
785 if (!$clean || $guest) {
786 # vm was shutdown from inside the guest or crashed, doing api cleanup
787 PVE
::QemuServer
::vm_stop_cleanup
($storecfg, $vmid, $conf, 0, 0);
791 warn "Finished cleanup for $vmid\n";
796 my $print_agent_result = sub {
799 my $result = $data->{result
} // $data;
800 return if !defined($result);
802 my $class = ref($result);
806 return if $result =~ m/^\s*$/;
811 if (($class eq 'HASH') && !scalar(keys %$result)) { # empty hash
815 print to_json
($result, { pretty
=> 1, canonical
=> 1});
821 my $ssh_key_map = ['sshkeys', sub {
822 return URI
::Escape
::uri_escape
(PVE
::Tools
::file_get_contents
($_[0]));
824 my $cipassword_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password', { name
=> 'cipassword' });
825 my $password_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password');
827 'update_vm' => [$ssh_key_map, $cipassword_map],
828 'create_vm' => [$ssh_key_map, $cipassword_map],
829 'set-user-password' => [$password_map],
832 return $mapping->{$name};
836 list
=> [ "PVE::API2::Qemu", 'vmlist', [],
837 { node
=> $nodename }, sub {
840 exit 0 if (!scalar(@$vmlist));
842 printf "%10s %-20s %-10s %-10s %12s %-10s\n",
843 qw(VMID NAME STATUS MEM(MB) BOOTDISK
(GB
) PID
);
845 foreach my $rec (sort { $a->{vmid
} <=> $b->{vmid
} } @$vmlist) {
846 printf "%10s %-20s %-10s %-10s %12.2f %-10s\n", $rec->{vmid
}, $rec->{name
},
847 $rec->{qmpstatus
} || $rec->{status
},
848 ($rec->{maxmem
} || 0)/(1024*1024),
849 ($rec->{maxdisk
} || 0)/(1024*1024*1024),
856 create
=> [ "PVE::API2::Qemu", 'create_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
858 destroy
=> [ "PVE::API2::Qemu", 'destroy_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
860 clone
=> [ "PVE::API2::Qemu", 'clone_vm', ['vmid', 'newid'], { node
=> $nodename }, $upid_exit ],
862 migrate
=> [ "PVE::API2::Qemu", 'migrate_vm', ['vmid', 'target'], { node
=> $nodename }, $upid_exit ],
864 set
=> [ "PVE::API2::Qemu", 'update_vm', ['vmid'], { node
=> $nodename } ],
866 resize
=> [ "PVE::API2::Qemu", 'resize_vm', ['vmid', 'disk', 'size'], { node
=> $nodename } ],
868 move_disk
=> [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node
=> $nodename }, $upid_exit ],
870 unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid'], { node
=> $nodename } ],
872 config
=> [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
873 { node
=> $nodename }, sub {
875 foreach my $k (sort (keys %$config)) {
876 next if $k eq 'digest';
877 my $v = $config->{$k};
878 if ($k eq 'description') {
879 $v = PVE
::Tools
::encode_text
($v);
885 pending
=> [ "PVE::API2::Qemu", 'vm_pending', ['vmid'],
886 { node
=> $nodename }, sub {
888 foreach my $item (sort { $a->{key
} cmp $b->{key
}} @$data) {
889 my $k = $item->{key
};
890 next if $k eq 'digest';
891 my $v = $item->{value
};
892 my $p = $item->{pending
};
893 if ($k eq 'description') {
894 $v = PVE
::Tools
::encode_text
($v) if defined($v);
895 $p = PVE
::Tools
::encode_text
($p) if defined($p);
898 if ($item->{delete}) {
899 print "del $k: $v\n";
900 } elsif (defined($p)) {
901 print "cur $k: $v\n";
902 print "new $k: $p\n";
904 print "cur $k: $v\n";
906 } elsif (defined($p)) {
907 print "new $k: $p\n";
912 showcmd
=> [ __PACKAGE__
, 'showcmd', ['vmid']],
914 status
=> [ __PACKAGE__
, 'status', ['vmid']],
916 snapshot
=> [ "PVE::API2::Qemu", 'snapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
918 delsnapshot
=> [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
920 listsnapshot
=> [ "PVE::API2::Qemu", 'snapshot_list', ['vmid'], { node
=> $nodename },
923 foreach my $e (@$res) {
924 my $headline = $e->{description
} || 'no-description';
925 $headline =~ s/\n.*//sg;
926 my $parent = $e->{parent
} // 'no-parent';
927 printf("%-20s %-20s %s\n", $e->{name
}, $parent, $headline);
931 rollback
=> [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
933 template
=> [ "PVE::API2::Qemu", 'template', ['vmid'], { node
=> $nodename }],
935 start
=> [ "PVE::API2::Qemu", 'vm_start', ['vmid'], { node
=> $nodename } , $upid_exit ],
937 stop
=> [ "PVE::API2::Qemu", 'vm_stop', ['vmid'], { node
=> $nodename }, $upid_exit ],
939 reset => [ "PVE::API2::Qemu", 'vm_reset', ['vmid'], { node
=> $nodename }, $upid_exit ],
941 shutdown => [ "PVE::API2::Qemu", 'vm_shutdown', ['vmid'], { node
=> $nodename }, $upid_exit ],
943 suspend
=> [ "PVE::API2::Qemu", 'vm_suspend', ['vmid'], { node
=> $nodename }, $upid_exit ],
945 resume
=> [ "PVE::API2::Qemu", 'vm_resume', ['vmid'], { node
=> $nodename }, $upid_exit ],
947 sendkey
=> [ "PVE::API2::Qemu", 'vm_sendkey', ['vmid', 'key'], { node
=> $nodename } ],
949 vncproxy
=> [ __PACKAGE__
, 'vncproxy', ['vmid']],
951 wait => [ __PACKAGE__
, 'wait', ['vmid']],
953 unlock
=> [ __PACKAGE__
, 'unlock', ['vmid']],
955 rescan
=> [ __PACKAGE__
, 'rescan', []],
957 monitor
=> [ __PACKAGE__
, 'monitor', ['vmid']],
959 agent
=> { alias
=> 'guest cmd' },
962 cmd
=> [ "PVE::API2::Qemu::Agent", 'agent', ['vmid', 'command'], { node
=> $nodename }, $print_agent_result ],
963 passwd
=> [ "PVE::API2::Qemu::Agent", 'set-user-password', [ 'vmid', 'username' ], { node
=> $nodename }],
964 exec => [ __PACKAGE__
, 'exec', [ 'vmid', 'extra-args' ], { node
=> $nodename }, $print_agent_result],
965 'exec-status' => [ "PVE::API2::Qemu::Agent", 'exec-status', [ 'vmid', 'pid' ], { node
=> $nodename }, $print_agent_result],
968 mtunnel
=> [ __PACKAGE__
, 'mtunnel', []],
970 nbdstop
=> [ __PACKAGE__
, 'nbdstop', ['vmid']],
972 terminal
=> [ __PACKAGE__
, 'terminal', ['vmid']],
974 importdisk
=> [ __PACKAGE__
, 'importdisk', ['vmid', 'source', 'storage']],
976 importovf
=> [ __PACKAGE__
, 'importovf', ['vmid', 'manifest', 'storage']],
978 cleanup
=> [ __PACKAGE__
, 'cleanup', ['vmid', 'clean-shutdown', 'guest-requested'], { node
=> $nodename }],