]>
git.proxmox.com Git - qemu-server.git/blob - PVE/CLI/qm.pm
6 # Note: disable '+' prefix for Getopt::Long (for resize command)
7 use Getopt
::Long
qw(:config no_getopt_compat);
14 use POSIX
qw(strftime);
19 use PVE
::Exception
qw(raise_param_exc);
20 use PVE
::GuestHelpers
;
22 use PVE
::JSONSchema
qw(get_standard_option);
24 use PVE
::RPCEnvironment
;
26 use PVE
::Tools
qw(extract_param);
28 use PVE
::API2
::Qemu
::Agent
;
30 use PVE
::QemuServer
::Agent
qw(agent_available);
31 use PVE
::QemuServer
::ImportDisk
;
32 use PVE
::QemuServer
::OVF
;
36 use base
qw(PVE::CLIHandler);
40 my $status = PVE
::Tools
::upid_read_status
($upid);
41 exit($status eq 'OK' ?
0 : -1);
44 my $nodename = PVE
::INotify
::nodename
();
46 sub setup_environment
{
47 PVE
::RPCEnvironment-
>setup_default_cli_env();
54 while ( ++$c < 10 && !-e
$path ) { sleep(1); }
56 my $s = IO
::Socket
::UNIX-
>new(Peer
=> $path, Timeout
=> 120);
58 die "unable to connect to socket '$path' - $!" if !$s;
60 my $select = new IO
::Select
;
62 $select->add(\
*STDIN
);
65 my $timeout = 60*15; # 15 minutes
68 while ($select->count &&
69 scalar(@handles = $select->can_read ($timeout))) {
70 foreach my $h (@handles) {
72 my $n = $h->sysread($buf, 4096);
82 syswrite(\
*STDOUT
, $buf);
92 sub print_recursive_hash
{
93 my ($prefix, $hash, $key) = @_;
95 if (ref($hash) eq 'HASH') {
97 print "$prefix$key:\n";
99 foreach my $itemkey (keys %$hash) {
100 print_recursive_hash
("\t$prefix", $hash->{$itemkey}, $itemkey);
102 } elsif (ref($hash) eq 'ARRAY') {
104 print "$prefix$key:\n";
106 foreach my $item (@$hash) {
107 print_recursive_hash
("\t$prefix", $item);
109 } elsif (!ref($hash) && defined($hash)) {
111 print "$prefix$key: $hash\n";
113 print "$prefix$hash\n";
118 __PACKAGE__-
>register_method ({
122 description
=> "Show command line which is used to start the VM (debug info).",
124 additionalProperties
=> 0,
126 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
128 description
=> "Puts each option on a new line to enhance human readability",
133 snapshot
=> get_standard_option
('pve-snapshot-name', {
134 description
=> "Fetch config values from given snapshot.",
137 my ($cmd, $pname, $cur, $args) = @_;
138 PVE
::QemuConfig-
>snapshot_list($args->[0]);
143 returns
=> { type
=> 'null'},
147 my $storecfg = PVE
::Storage
::config
();
148 my $cmdline = PVE
::QemuServer
::vm_commandline
($storecfg, $param->{vmid
}, $param->{snapshot
});
150 $cmdline =~ s/ -/ \\\n -/g if $param->{pretty
};
157 __PACKAGE__-
>register_method ({
161 description
=> "Show VM status.",
163 additionalProperties
=> 0,
165 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
167 description
=> "Verbose output format",
173 returns
=> { type
=> 'null'},
178 my $conf = PVE
::QemuConfig-
>load_config ($param->{vmid
});
180 my $vmstatus = PVE
::QemuServer
::vmstatus
($param->{vmid
}, 1);
181 my $stat = $vmstatus->{$param->{vmid
}};
182 if ($param->{verbose
}) {
183 foreach my $k (sort (keys %$stat)) {
184 next if $k eq 'cpu' || $k eq 'relcpu'; # always 0
186 print_recursive_hash
("", $v, $k);
189 my $status = $stat->{qmpstatus
} || 'unknown';
190 print "status: $status\n";
196 __PACKAGE__-
>register_method ({
200 description
=> "Proxy VM VNC traffic to stdin/stdout",
202 additionalProperties
=> 0,
204 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
207 returns
=> { type
=> 'null'},
211 my $vmid = $param->{vmid
};
212 my $vnc_socket = PVE
::QemuServer
::vnc_socket
($vmid);
214 if (my $ticket = $ENV{LC_PVE_TICKET
}) { # NOTE: ssh on debian only pass LC_* variables
215 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
216 PVE
::QemuServer
::vm_mon_cmd
($vmid, "set_password", protocol
=> 'vnc', password
=> $ticket);
217 PVE
::QemuServer
::vm_mon_cmd
($vmid, "expire_password", protocol
=> 'vnc', time => "+30");
219 # FIXME: remove or allow to add tls-creds object, as x509 vnc param is removed with qemu 4??
220 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
223 run_vnc_proxy
($vnc_socket);
228 __PACKAGE__-
>register_method ({
232 description
=> "Unlock the VM.",
234 additionalProperties
=> 0,
236 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
239 returns
=> { type
=> 'null'},
243 my $vmid = $param->{vmid
};
245 PVE
::QemuConfig-
>lock_config ($vmid, sub {
246 my $conf = PVE
::QemuConfig-
>load_config($vmid);
247 delete $conf->{lock};
248 delete $conf->{pending
}->{lock} if $conf->{pending
}; # just to be sure
249 PVE
::QemuConfig-
>write_config($vmid, $conf);
255 __PACKAGE__-
>register_method ({
259 description
=> "Stop embedded nbd server.",
261 additionalProperties
=> 0,
263 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
266 returns
=> { type
=> 'null'},
270 my $vmid = $param->{vmid
};
272 PVE
::QemuServer
::nbd_stop
($vmid);
277 __PACKAGE__-
>register_method ({
281 description
=> "Used by qmigrate - do not use manually.",
283 additionalProperties
=> 0,
286 returns
=> { type
=> 'null'},
290 if (!PVE
::Cluster
::check_cfs_quorum
(1)) {
295 my $tunnel_write = sub {
302 $tunnel_write->("tunnel online");
303 $tunnel_write->("ver 1");
305 while (my $line = <STDIN
>) {
307 if ($line =~ /^quit$/) {
308 $tunnel_write->("OK");
310 } elsif ($line =~ /^resume (\d+)$/) {
312 if (PVE
::QemuServer
::check_running
($vmid, 1)) {
313 eval { PVE
::QemuServer
::vm_resume
($vmid, 1, 1); };
315 $tunnel_write->("ERR: resume failed - $@");
317 $tunnel_write->("OK");
320 $tunnel_write->("ERR: resume failed - VM $vmid not running");
328 __PACKAGE__-
>register_method ({
332 description
=> "Wait until the VM is stopped.",
334 additionalProperties
=> 0,
336 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
338 description
=> "Timeout in seconds. Default is to wait forever.",
345 returns
=> { type
=> 'null'},
349 my $vmid = $param->{vmid
};
350 my $timeout = $param->{timeout
};
352 my $pid = PVE
::QemuServer
::check_running
($vmid);
355 print "waiting until VM $vmid stopps (PID $pid)\n";
358 while ((!$timeout || ($count < $timeout)) && PVE
::QemuServer
::check_running
($vmid)) {
363 die "wait failed - got timeout\n" if PVE
::QemuServer
::check_running
($vmid);
368 __PACKAGE__-
>register_method ({
372 description
=> "Enter Qemu Monitor interface.",
374 additionalProperties
=> 0,
376 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
379 returns
=> { type
=> 'null'},
383 my $vmid = $param->{vmid
};
385 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
387 print "Entering Qemu Monitor for VM $vmid - type 'help' for help\n";
389 my $term = new Term
::ReadLine
('qm');
392 while (defined ($input = $term->readline('qm> '))) {
395 next if $input =~ m/^\s*$/;
397 last if $input =~ m/^\s*q(uit)?\s*$/;
400 print PVE
::QemuServer
::vm_human_monitor_command
($vmid, $input);
402 print "ERROR: $@" if $@;
409 __PACKAGE__-
>register_method ({
413 description
=> "Rescan all storages and update disk sizes and unused disk images.",
415 additionalProperties
=> 0,
417 vmid
=> get_standard_option
('pve-vmid', {
419 completion
=> \
&PVE
::QemuServer
::complete_vmid
,
425 description
=> 'Do not actually write changes out to VM config(s).',
429 returns
=> { type
=> 'null'},
433 my $dryrun = $param->{dryrun
};
435 print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
437 PVE
::QemuServer
::rescan
($param->{vmid
}, 0, $dryrun);
442 __PACKAGE__-
>register_method ({
443 name
=> 'importdisk',
444 path
=> 'importdisk',
446 description
=> "Import an external disk image as an unused disk in a VM. The
447 image format has to be supported by qemu-img(1).",
449 additionalProperties
=> 0,
451 vmid
=> get_standard_option
('pve-vmid', {completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
453 description
=> 'Path to the disk image to import',
457 storage
=> get_standard_option
('pve-storage-id', {
458 description
=> 'Target storage ID',
459 completion
=> \
&PVE
::QemuServer
::complete_storage
,
464 description
=> 'Target format',
465 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
470 returns
=> { type
=> 'null'},
474 my $vmid = extract_param
($param, 'vmid');
475 my $source = extract_param
($param, 'source');
476 my $storeid = extract_param
($param, 'storage');
477 my $format = extract_param
($param, 'format');
479 my $vm_conf = PVE
::QemuConfig-
>load_config($vmid);
480 PVE
::QemuConfig-
>check_lock($vm_conf);
481 die "$source: non-existent or non-regular file\n" if (! -f
$source);
483 my $storecfg = PVE
::Storage
::config
();
484 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
486 my $target_storage_config = PVE
::Storage
::storage_config
($storecfg, $storeid);
487 die "storage $storeid does not support vm images\n"
488 if !$target_storage_config->{content
}->{images
};
490 print "importing disk '$source' to VM $vmid ...\n";
491 my ($drive_id, $volid) = PVE
::QemuServer
::ImportDisk
::do_import
($source, $vmid, $storeid, { format
=> $format });
492 print "Successfully imported disk as '$drive_id:$volid'\n";
497 __PACKAGE__-
>register_method ({
501 description
=> "Open a terminal using a serial device (The VM need to have a serial device configured, for example 'serial0: socket')",
503 additionalProperties
=> 0,
505 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
507 description
=> "Select the serial device. By default we simply use the first suitable device.",
510 enum
=> [qw(serial0 serial1 serial2 serial3)],
513 description
=> "Escape character.",
520 returns
=> { type
=> 'null'},
524 my $vmid = $param->{vmid
};
526 my $escape = $param->{escape
} // '^O';
527 if ($escape =~ /^\^([\x40-\x7a])$/) {
528 $escape = ord($1) & 0x1F;
529 } elsif ($escape =~ /^0x[0-9a-f]+$/i) {
530 $escape = hex($escape);
531 } elsif ($escape =~ /^[0-9]+$/) {
532 $escape = int($escape);
534 die "invalid escape character definition: $escape\n";
538 $escapemsg = sprintf(' (press Ctrl+%c to exit)', $escape+0x40);
539 $escape = sprintf(',escape=0x%x', $escape);
544 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
546 my $iface = $param->{iface
};
549 die "serial interface '$iface' is not configured\n" if !$conf->{$iface};
550 die "wrong serial type on interface '$iface'\n" if $conf->{$iface} ne 'socket';
552 foreach my $opt (qw(serial0 serial1 serial2 serial3)) {
553 if ($conf->{$opt} && ($conf->{$opt} eq 'socket')) {
558 die "unable to find a serial interface\n" if !$iface;
561 die "VM $vmid not running\n" if !PVE
::QemuServer
::check_running
($vmid);
563 my $socket = "/var/run/qemu-server/${vmid}.$iface";
565 my $cmd = "socat UNIX-CONNECT:$socket STDIO,raw,echo=0$escape";
567 print "starting serial terminal on interface ${iface}${escapemsg}\n";
574 __PACKAGE__-
>register_method ({
577 description
=> "Create a new VM using parameters read from an OVF manifest",
579 additionalProperties
=> 0,
581 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::Cluster
::complete_next_vmid
}),
584 description
=> 'path to the ovf file',
586 storage
=> get_standard_option
('pve-storage-id', {
587 description
=> 'Target storage ID',
588 completion
=> \
&PVE
::QemuServer
::complete_storage
,
593 description
=> 'Target format',
594 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
599 description
=> 'Print a parsed representation of the extracted OVF parameters, but do not create a VM',
604 returns
=> { type
=> 'null' },
608 my $vmid = PVE
::Tools
::extract_param
($param, 'vmid');
609 my $ovf_file = PVE
::Tools
::extract_param
($param, 'manifest');
610 my $storeid = PVE
::Tools
::extract_param
($param, 'storage');
611 my $format = PVE
::Tools
::extract_param
($param, 'format');
612 my $dryrun = PVE
::Tools
::extract_param
($param, 'dryrun');
614 die "$ovf_file: non-existent or non-regular file\n" if (! -f
$ovf_file);
615 my $storecfg = PVE
::Storage
::config
();
616 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
618 my $parsed = PVE
::QemuServer
::OVF
::parse_ovf
($ovf_file);
621 print to_json
($parsed, { pretty
=> 1, canonical
=> 1});
625 eval { PVE
::QemuConfig-
>create_and_lock_config($vmid) };
626 die "Reserving empty config for OVF import to VM $vmid failed: $@" if $@;
628 my $conf = PVE
::QemuConfig-
>load_config($vmid);
629 die "Internal error: Expected 'create' lock in config of VM $vmid!"
630 if !PVE
::QemuConfig-
>has_lock($conf, "create");
632 $conf->{name
} = $parsed->{qm
}->{name
} if defined($parsed->{qm
}->{name
});
633 $conf->{memory
} = $parsed->{qm
}->{memory
} if defined($parsed->{qm
}->{memory
});
634 $conf->{cores
} = $parsed->{qm
}->{cores
} if defined($parsed->{qm
}->{cores
});
637 # order matters, as do_import() will load_config() internally
638 $conf->{vmgenid
} = PVE
::QemuServer
::generate_uuid
();
639 $conf->{smbios1
} = PVE
::QemuServer
::generate_smbios1_uuid
();
640 PVE
::QemuConfig-
>write_config($vmid, $conf);
642 foreach my $disk (@{ $parsed->{disks
} }) {
643 my ($file, $drive) = ($disk->{backing_file
}, $disk->{disk_address
});
644 PVE
::QemuServer
::ImportDisk
::do_import
($file, $vmid, $storeid, {
645 drive_name
=> $drive,
651 # reload after disks entries have been created
652 $conf = PVE
::QemuConfig-
>load_config($vmid);
653 my $firstdisk = PVE
::QemuServer
::resolve_first_disk
($conf);
654 $conf->{bootdisk
} = $firstdisk if $firstdisk;
655 PVE
::QemuConfig-
>write_config($vmid, $conf);
661 # eval for additional safety in error path
662 eval { PVE
::QemuServer
::destroy_vm
($storecfg, $vmid, $skiplock) };
663 warn "Could not destroy VM $vmid: $@" if "$@";
664 die "import failed - $err";
667 PVE
::QemuConfig-
>remove_lock($vmid, "create");
674 __PACKAGE__-
>register_method({
679 description
=> "Executes the given command via the guest agent",
681 additionalProperties
=> 0,
683 node
=> get_standard_option
('pve-node'),
684 vmid
=> get_standard_option
('pve-vmid', {
685 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
690 description
=> "If set to off, returns the pid immediately instead of waiting for the commmand to finish or the timeout.",
694 description
=> "The maximum time to wait synchronously for the command to finish. If reached, the pid gets returned. Set to 0 to deactivate",
699 'extra-args' => get_standard_option
('extra-args'),
708 my $vmid = $param->{vmid
};
709 my $sync = $param->{synchronous
} // 1;
710 if (!$param->{'extra-args'} || !@{$param->{'extra-args'}}) {
711 raise_param_exc
( { 'extra-args' => "No command given" });
713 if (defined($param->{timeout
}) && !$sync) {
714 raise_param_exc
({ synchronous
=> "needs to be set for 'timeout'"});
717 my $res = PVE
::QemuServer
::Agent
::qemu_exec
($vmid, $param->{'extra-args'});
720 my $pid = $res->{pid
};
721 my $timeout = $param->{timeout
} // 30;
722 my $starttime = time();
724 while ($timeout == 0 || (time() - $starttime) < $timeout) {
725 my $out = PVE
::QemuServer
::Agent
::qemu_exec_status
($vmid, $pid);
726 if ($out->{exited
}) {
733 if (!$res->{exited
}) {
734 warn "timeout reached, returning pid\n";
738 return { result
=> $res };
741 __PACKAGE__-
>register_method({
746 description
=> "Cleans up resources like tap devices, vgpus, etc. Called after a vm shuts down, crashes, etc.",
748 additionalProperties
=> 0,
750 node
=> get_standard_option
('pve-node'),
751 vmid
=> get_standard_option
('pve-vmid', {
752 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
753 'clean-shutdown' => {
755 description
=> "Indicates if qemu shutdown cleanly.",
757 'guest-requested' => {
759 description
=> "Indicates if the shutdown was requested by the guest or via qmp.",
763 returns
=> { type
=> 'null', },
767 my $vmid = $param->{vmid
};
768 my $clean = $param->{'clean-shutdown'};
769 my $guest = $param->{'guest-requested'};
772 # return if we do not have the config anymore
773 return if !-f PVE
::QemuConfig-
>config_file($vmid);
775 my $storecfg = PVE
::Storage
::config
();
776 warn "Starting cleanup for $vmid\n";
778 PVE
::QemuConfig-
>lock_config($vmid, sub {
779 my $conf = PVE
::QemuConfig-
>load_config ($vmid);
780 my $pid = PVE
::QemuServer
::check_running
($vmid);
781 die "vm still running\n" if $pid;
784 # we have to cleanup the tap devices after a crash
786 foreach my $opt (keys %$conf) {
787 next if $opt !~ m/^net(\d)+$/;
789 PVE
::Network
::tap_unplug
("tap${vmid}i${interface}");
793 if (!$clean || $guest) {
794 # vm was shutdown from inside the guest or crashed, doing api cleanup
795 PVE
::QemuServer
::vm_stop_cleanup
($storecfg, $vmid, $conf, 0, 0);
797 PVE
::GuestHelpers
::exec_hookscript
($conf, $vmid, 'post-stop');
799 $restart = eval { PVE
::QemuServer
::clear_reboot_request
($vmid) };
803 warn "Finished cleanup for $vmid\n";
806 warn "Restarting VM $vmid\n";
807 PVE
::API2
::Qemu-
>vm_start({
816 my $print_agent_result = sub {
819 my $result = $data->{result
} // $data;
820 return if !defined($result);
822 my $class = ref($result);
826 return if $result =~ m/^\s*$/;
831 if (($class eq 'HASH') && !scalar(keys %$result)) { # empty hash
835 print to_json
($result, { pretty
=> 1, canonical
=> 1});
841 my $ssh_key_map = ['sshkeys', sub {
842 return URI
::Escape
::uri_escape
(PVE
::Tools
::file_get_contents
($_[0]));
844 my $cipassword_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password', { name
=> 'cipassword' });
845 my $password_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password');
847 'update_vm' => [$ssh_key_map, $cipassword_map],
848 'create_vm' => [$ssh_key_map, $cipassword_map],
849 'set-user-password' => [$password_map],
852 return $mapping->{$name};
856 list
=> [ "PVE::API2::Qemu", 'vmlist', [],
857 { node
=> $nodename }, sub {
860 exit 0 if (!scalar(@$vmlist));
862 printf "%10s %-20s %-10s %-10s %12s %-10s\n",
863 qw(VMID NAME STATUS MEM(MB) BOOTDISK
(GB
) PID
);
865 foreach my $rec (sort { $a->{vmid
} <=> $b->{vmid
} } @$vmlist) {
866 printf "%10s %-20s %-10s %-10s %12.2f %-10s\n", $rec->{vmid
}, $rec->{name
},
867 $rec->{qmpstatus
} || $rec->{status
},
868 ($rec->{maxmem
} || 0)/(1024*1024),
869 ($rec->{maxdisk
} || 0)/(1024*1024*1024),
876 create
=> [ "PVE::API2::Qemu", 'create_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
878 destroy
=> [ "PVE::API2::Qemu", 'destroy_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
880 clone
=> [ "PVE::API2::Qemu", 'clone_vm', ['vmid', 'newid'], { node
=> $nodename }, $upid_exit ],
882 migrate
=> [ "PVE::API2::Qemu", 'migrate_vm', ['vmid', 'target'], { node
=> $nodename }, $upid_exit ],
884 set
=> [ "PVE::API2::Qemu", 'update_vm', ['vmid'], { node
=> $nodename } ],
886 resize
=> [ "PVE::API2::Qemu", 'resize_vm', ['vmid', 'disk', 'size'], { node
=> $nodename } ],
888 move_disk
=> [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node
=> $nodename }, $upid_exit ],
890 unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid'], { node
=> $nodename } ],
892 config
=> [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
893 { node
=> $nodename }, sub {
895 foreach my $k (sort (keys %$config)) {
896 next if $k eq 'digest';
897 my $v = $config->{$k};
898 if ($k eq 'description') {
899 $v = PVE
::Tools
::encode_text
($v);
905 pending
=> [ "PVE::API2::Qemu", 'vm_pending', ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::format_pending
],
906 showcmd
=> [ __PACKAGE__
, 'showcmd', ['vmid']],
908 status
=> [ __PACKAGE__
, 'status', ['vmid']],
910 snapshot
=> [ "PVE::API2::Qemu", 'snapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
912 delsnapshot
=> [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
914 listsnapshot
=> [ "PVE::API2::Qemu", 'snapshot_list', ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::print_snapshot_tree
],
916 rollback
=> [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
918 template
=> [ "PVE::API2::Qemu", 'template', ['vmid'], { node
=> $nodename }],
920 start
=> [ "PVE::API2::Qemu", 'vm_start', ['vmid'], { node
=> $nodename } , $upid_exit ],
922 stop
=> [ "PVE::API2::Qemu", 'vm_stop', ['vmid'], { node
=> $nodename }, $upid_exit ],
924 reset => [ "PVE::API2::Qemu", 'vm_reset', ['vmid'], { node
=> $nodename }, $upid_exit ],
926 shutdown => [ "PVE::API2::Qemu", 'vm_shutdown', ['vmid'], { node
=> $nodename }, $upid_exit ],
928 reboot
=> [ "PVE::API2::Qemu", 'vm_reboot', ['vmid'], { node
=> $nodename }, $upid_exit ],
930 suspend
=> [ "PVE::API2::Qemu", 'vm_suspend', ['vmid'], { node
=> $nodename }, $upid_exit ],
932 resume
=> [ "PVE::API2::Qemu", 'vm_resume', ['vmid'], { node
=> $nodename }, $upid_exit ],
934 sendkey
=> [ "PVE::API2::Qemu", 'vm_sendkey', ['vmid', 'key'], { node
=> $nodename } ],
936 vncproxy
=> [ __PACKAGE__
, 'vncproxy', ['vmid']],
938 wait => [ __PACKAGE__
, 'wait', ['vmid']],
940 unlock
=> [ __PACKAGE__
, 'unlock', ['vmid']],
942 rescan
=> [ __PACKAGE__
, 'rescan', []],
944 monitor
=> [ __PACKAGE__
, 'monitor', ['vmid']],
946 agent
=> { alias
=> 'guest cmd' },
949 cmd
=> [ "PVE::API2::Qemu::Agent", 'agent', ['vmid', 'command'], { node
=> $nodename }, $print_agent_result ],
950 passwd
=> [ "PVE::API2::Qemu::Agent", 'set-user-password', [ 'vmid', 'username' ], { node
=> $nodename }],
951 exec => [ __PACKAGE__
, 'exec', [ 'vmid', 'extra-args' ], { node
=> $nodename }, $print_agent_result],
952 'exec-status' => [ "PVE::API2::Qemu::Agent", 'exec-status', [ 'vmid', 'pid' ], { node
=> $nodename }, $print_agent_result],
955 mtunnel
=> [ __PACKAGE__
, 'mtunnel', []],
957 nbdstop
=> [ __PACKAGE__
, 'nbdstop', ['vmid']],
959 terminal
=> [ __PACKAGE__
, 'terminal', ['vmid']],
961 importdisk
=> [ __PACKAGE__
, 'importdisk', ['vmid', 'source', 'storage']],
963 importovf
=> [ __PACKAGE__
, 'importovf', ['vmid', 'manifest', 'storage']],
965 cleanup
=> [ __PACKAGE__
, 'cleanup', ['vmid', 'clean-shutdown', 'guest-requested'], { node
=> $nodename }],
968 dump => [ "PVE::API2::Qemu", 'cloudinit_generated_config_dump', ['vmid', 'type'], { node
=> $nodename }, sub {