]>
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
::Helpers
;
31 use PVE
::QemuServer
::Agent
qw(agent_available);
32 use PVE
::QemuServer
::ImportDisk
;
33 use PVE
::QemuServer
::OVF
;
37 use base
qw(PVE::CLIHandler);
41 my $status = PVE
::Tools
::upid_read_status
($upid);
42 exit($status eq 'OK' ?
0 : -1);
45 my $nodename = PVE
::INotify
::nodename
();
47 sub setup_environment
{
48 PVE
::RPCEnvironment-
>setup_default_cli_env();
55 while ( ++$c < 10 && !-e
$path ) { sleep(1); }
57 my $s = IO
::Socket
::UNIX-
>new(Peer
=> $path, Timeout
=> 120);
59 die "unable to connect to socket '$path' - $!" if !$s;
61 my $select = new IO
::Select
;
63 $select->add(\
*STDIN
);
66 my $timeout = 60*15; # 15 minutes
69 while ($select->count &&
70 scalar(@handles = $select->can_read ($timeout))) {
71 foreach my $h (@handles) {
73 my $n = $h->sysread($buf, 4096);
83 syswrite(\
*STDOUT
, $buf);
93 sub print_recursive_hash
{
94 my ($prefix, $hash, $key) = @_;
96 if (ref($hash) eq 'HASH') {
98 print "$prefix$key:\n";
100 foreach my $itemkey (keys %$hash) {
101 print_recursive_hash
("\t$prefix", $hash->{$itemkey}, $itemkey);
103 } elsif (ref($hash) eq 'ARRAY') {
105 print "$prefix$key:\n";
107 foreach my $item (@$hash) {
108 print_recursive_hash
("\t$prefix", $item);
110 } elsif (!ref($hash) && defined($hash)) {
112 print "$prefix$key: $hash\n";
114 print "$prefix$hash\n";
119 __PACKAGE__-
>register_method ({
123 description
=> "Show command line which is used to start the VM (debug info).",
125 additionalProperties
=> 0,
127 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
129 description
=> "Puts each option on a new line to enhance human readability",
134 snapshot
=> get_standard_option
('pve-snapshot-name', {
135 description
=> "Fetch config values from given snapshot.",
138 my ($cmd, $pname, $cur, $args) = @_;
139 PVE
::QemuConfig-
>snapshot_list($args->[0]);
144 returns
=> { type
=> 'null'},
148 my $storecfg = PVE
::Storage
::config
();
149 my $cmdline = PVE
::QemuServer
::vm_commandline
($storecfg, $param->{vmid
}, $param->{snapshot
});
151 $cmdline =~ s/ -/ \\\n -/g if $param->{pretty
};
158 __PACKAGE__-
>register_method ({
162 description
=> "Show VM status.",
164 additionalProperties
=> 0,
166 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
168 description
=> "Verbose output format",
174 returns
=> { type
=> 'null'},
179 my $conf = PVE
::QemuConfig-
>load_config ($param->{vmid
});
181 my $vmstatus = PVE
::QemuServer
::vmstatus
($param->{vmid
}, 1);
182 my $stat = $vmstatus->{$param->{vmid
}};
183 if ($param->{verbose
}) {
184 foreach my $k (sort (keys %$stat)) {
185 next if $k eq 'cpu' || $k eq 'relcpu'; # always 0
187 print_recursive_hash
("", $v, $k);
190 my $status = $stat->{qmpstatus
} || 'unknown';
191 print "status: $status\n";
197 __PACKAGE__-
>register_method ({
201 description
=> "Proxy VM VNC traffic to stdin/stdout",
203 additionalProperties
=> 0,
205 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
208 returns
=> { type
=> 'null'},
212 my $vmid = $param->{vmid
};
213 my $vnc_socket = PVE
::QemuServer
::Helpers
::vnc_socket
($vmid);
215 if (my $ticket = $ENV{LC_PVE_TICKET
}) { # NOTE: ssh on debian only pass LC_* variables
216 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
217 PVE
::QemuServer
::vm_mon_cmd
($vmid, "set_password", protocol
=> 'vnc', password
=> $ticket);
218 PVE
::QemuServer
::vm_mon_cmd
($vmid, "expire_password", protocol
=> 'vnc', time => "+30");
220 # FIXME: remove or allow to add tls-creds object, as x509 vnc param is removed with qemu 4??
221 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
224 run_vnc_proxy
($vnc_socket);
229 __PACKAGE__-
>register_method ({
233 description
=> "Unlock the VM.",
235 additionalProperties
=> 0,
237 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
240 returns
=> { type
=> 'null'},
244 my $vmid = $param->{vmid
};
246 PVE
::QemuConfig-
>lock_config ($vmid, sub {
247 my $conf = PVE
::QemuConfig-
>load_config($vmid);
248 delete $conf->{lock};
249 delete $conf->{pending
}->{lock} if $conf->{pending
}; # just to be sure
250 PVE
::QemuConfig-
>write_config($vmid, $conf);
256 __PACKAGE__-
>register_method ({
260 description
=> "Stop embedded nbd server.",
262 additionalProperties
=> 0,
264 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
267 returns
=> { type
=> 'null'},
271 my $vmid = $param->{vmid
};
273 PVE
::QemuServer
::nbd_stop
($vmid);
278 __PACKAGE__-
>register_method ({
282 description
=> "Used by qmigrate - do not use manually.",
284 additionalProperties
=> 0,
287 returns
=> { type
=> 'null'},
291 if (!PVE
::Cluster
::check_cfs_quorum
(1)) {
296 my $tunnel_write = sub {
303 $tunnel_write->("tunnel online");
304 $tunnel_write->("ver 1");
306 while (my $line = <STDIN
>) {
308 if ($line =~ /^quit$/) {
309 $tunnel_write->("OK");
311 } elsif ($line =~ /^resume (\d+)$/) {
313 if (PVE
::QemuServer
::check_running
($vmid, 1)) {
314 eval { PVE
::QemuServer
::vm_resume
($vmid, 1, 1); };
316 $tunnel_write->("ERR: resume failed - $@");
318 $tunnel_write->("OK");
321 $tunnel_write->("ERR: resume failed - VM $vmid not running");
329 __PACKAGE__-
>register_method ({
333 description
=> "Wait until the VM is stopped.",
335 additionalProperties
=> 0,
337 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
339 description
=> "Timeout in seconds. Default is to wait forever.",
346 returns
=> { type
=> 'null'},
350 my $vmid = $param->{vmid
};
351 my $timeout = $param->{timeout
};
353 my $pid = PVE
::QemuServer
::check_running
($vmid);
356 print "waiting until VM $vmid stopps (PID $pid)\n";
359 while ((!$timeout || ($count < $timeout)) && PVE
::QemuServer
::check_running
($vmid)) {
364 die "wait failed - got timeout\n" if PVE
::QemuServer
::check_running
($vmid);
369 __PACKAGE__-
>register_method ({
373 description
=> "Enter Qemu Monitor interface.",
375 additionalProperties
=> 0,
377 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
380 returns
=> { type
=> 'null'},
384 my $vmid = $param->{vmid
};
386 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
388 print "Entering Qemu Monitor for VM $vmid - type 'help' for help\n";
390 my $term = new Term
::ReadLine
('qm');
393 while (defined ($input = $term->readline('qm> '))) {
396 next if $input =~ m/^\s*$/;
398 last if $input =~ m/^\s*q(uit)?\s*$/;
401 print PVE
::QemuServer
::vm_human_monitor_command
($vmid, $input);
403 print "ERROR: $@" if $@;
410 __PACKAGE__-
>register_method ({
414 description
=> "Rescan all storages and update disk sizes and unused disk images.",
416 additionalProperties
=> 0,
418 vmid
=> get_standard_option
('pve-vmid', {
420 completion
=> \
&PVE
::QemuServer
::complete_vmid
,
426 description
=> 'Do not actually write changes out to VM config(s).',
430 returns
=> { type
=> 'null'},
434 my $dryrun = $param->{dryrun
};
436 print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
438 PVE
::QemuServer
::rescan
($param->{vmid
}, 0, $dryrun);
443 __PACKAGE__-
>register_method ({
444 name
=> 'importdisk',
445 path
=> 'importdisk',
447 description
=> "Import an external disk image as an unused disk in a VM. The
448 image format has to be supported by qemu-img(1).",
450 additionalProperties
=> 0,
452 vmid
=> get_standard_option
('pve-vmid', {completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
454 description
=> 'Path to the disk image to import',
458 storage
=> get_standard_option
('pve-storage-id', {
459 description
=> 'Target storage ID',
460 completion
=> \
&PVE
::QemuServer
::complete_storage
,
465 description
=> 'Target format',
466 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
471 returns
=> { type
=> 'null'},
475 my $vmid = extract_param
($param, 'vmid');
476 my $source = extract_param
($param, 'source');
477 my $storeid = extract_param
($param, 'storage');
478 my $format = extract_param
($param, 'format');
480 my $vm_conf = PVE
::QemuConfig-
>load_config($vmid);
481 PVE
::QemuConfig-
>check_lock($vm_conf);
482 die "$source: non-existent or non-regular file\n" if (! -f
$source);
484 my $storecfg = PVE
::Storage
::config
();
485 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
487 my $target_storage_config = PVE
::Storage
::storage_config
($storecfg, $storeid);
488 die "storage $storeid does not support vm images\n"
489 if !$target_storage_config->{content
}->{images
};
491 print "importing disk '$source' to VM $vmid ...\n";
492 my ($drive_id, $volid) = PVE
::QemuServer
::ImportDisk
::do_import
($source, $vmid, $storeid, { format
=> $format });
493 print "Successfully imported disk as '$drive_id:$volid'\n";
498 __PACKAGE__-
>register_method ({
502 description
=> "Open a terminal using a serial device (The VM need to have a serial device configured, for example 'serial0: socket')",
504 additionalProperties
=> 0,
506 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
508 description
=> "Select the serial device. By default we simply use the first suitable device.",
511 enum
=> [qw(serial0 serial1 serial2 serial3)],
514 description
=> "Escape character.",
521 returns
=> { type
=> 'null'},
525 my $vmid = $param->{vmid
};
527 my $escape = $param->{escape
} // '^O';
528 if ($escape =~ /^\^([\x40-\x7a])$/) {
529 $escape = ord($1) & 0x1F;
530 } elsif ($escape =~ /^0x[0-9a-f]+$/i) {
531 $escape = hex($escape);
532 } elsif ($escape =~ /^[0-9]+$/) {
533 $escape = int($escape);
535 die "invalid escape character definition: $escape\n";
539 $escapemsg = sprintf(' (press Ctrl+%c to exit)', $escape+0x40);
540 $escape = sprintf(',escape=0x%x', $escape);
545 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
547 my $iface = $param->{iface
};
550 die "serial interface '$iface' is not configured\n" if !$conf->{$iface};
551 die "wrong serial type on interface '$iface'\n" if $conf->{$iface} ne 'socket';
553 foreach my $opt (qw(serial0 serial1 serial2 serial3)) {
554 if ($conf->{$opt} && ($conf->{$opt} eq 'socket')) {
559 die "unable to find a serial interface\n" if !$iface;
562 die "VM $vmid not running\n" if !PVE
::QemuServer
::check_running
($vmid);
564 my $socket = "/var/run/qemu-server/${vmid}.$iface";
566 my $cmd = "socat UNIX-CONNECT:$socket STDIO,raw,echo=0$escape";
568 print "starting serial terminal on interface ${iface}${escapemsg}\n";
575 __PACKAGE__-
>register_method ({
578 description
=> "Create a new VM using parameters read from an OVF manifest",
580 additionalProperties
=> 0,
582 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::Cluster
::complete_next_vmid
}),
585 description
=> 'path to the ovf file',
587 storage
=> get_standard_option
('pve-storage-id', {
588 description
=> 'Target storage ID',
589 completion
=> \
&PVE
::QemuServer
::complete_storage
,
594 description
=> 'Target format',
595 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
600 description
=> 'Print a parsed representation of the extracted OVF parameters, but do not create a VM',
605 returns
=> { type
=> 'null' },
609 my $vmid = PVE
::Tools
::extract_param
($param, 'vmid');
610 my $ovf_file = PVE
::Tools
::extract_param
($param, 'manifest');
611 my $storeid = PVE
::Tools
::extract_param
($param, 'storage');
612 my $format = PVE
::Tools
::extract_param
($param, 'format');
613 my $dryrun = PVE
::Tools
::extract_param
($param, 'dryrun');
615 die "$ovf_file: non-existent or non-regular file\n" if (! -f
$ovf_file);
616 my $storecfg = PVE
::Storage
::config
();
617 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
619 my $parsed = PVE
::QemuServer
::OVF
::parse_ovf
($ovf_file);
622 print to_json
($parsed, { pretty
=> 1, canonical
=> 1});
626 eval { PVE
::QemuConfig-
>create_and_lock_config($vmid) };
627 die "Reserving empty config for OVF import to VM $vmid failed: $@" if $@;
629 my $conf = PVE
::QemuConfig-
>load_config($vmid);
630 die "Internal error: Expected 'create' lock in config of VM $vmid!"
631 if !PVE
::QemuConfig-
>has_lock($conf, "create");
633 $conf->{name
} = $parsed->{qm
}->{name
} if defined($parsed->{qm
}->{name
});
634 $conf->{memory
} = $parsed->{qm
}->{memory
} if defined($parsed->{qm
}->{memory
});
635 $conf->{cores
} = $parsed->{qm
}->{cores
} if defined($parsed->{qm
}->{cores
});
638 # order matters, as do_import() will load_config() internally
639 $conf->{vmgenid
} = PVE
::QemuServer
::generate_uuid
();
640 $conf->{smbios1
} = PVE
::QemuServer
::generate_smbios1_uuid
();
641 PVE
::QemuConfig-
>write_config($vmid, $conf);
643 foreach my $disk (@{ $parsed->{disks
} }) {
644 my ($file, $drive) = ($disk->{backing_file
}, $disk->{disk_address
});
645 PVE
::QemuServer
::ImportDisk
::do_import
($file, $vmid, $storeid, {
646 drive_name
=> $drive,
652 # reload after disks entries have been created
653 $conf = PVE
::QemuConfig-
>load_config($vmid);
654 my $firstdisk = PVE
::QemuServer
::resolve_first_disk
($conf);
655 $conf->{bootdisk
} = $firstdisk if $firstdisk;
656 PVE
::QemuConfig-
>write_config($vmid, $conf);
662 # eval for additional safety in error path
663 eval { PVE
::QemuServer
::destroy_vm
($storecfg, $vmid, $skiplock) };
664 warn "Could not destroy VM $vmid: $@" if "$@";
665 die "import failed - $err";
668 PVE
::QemuConfig-
>remove_lock($vmid, "create");
675 __PACKAGE__-
>register_method({
680 description
=> "Executes the given command via the guest agent",
682 additionalProperties
=> 0,
684 node
=> get_standard_option
('pve-node'),
685 vmid
=> get_standard_option
('pve-vmid', {
686 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
691 description
=> "If set to off, returns the pid immediately instead of waiting for the commmand to finish or the timeout.",
695 description
=> "The maximum time to wait synchronously for the command to finish. If reached, the pid gets returned. Set to 0 to deactivate",
700 'extra-args' => get_standard_option
('extra-args'),
709 my $vmid = $param->{vmid
};
710 my $sync = $param->{synchronous
} // 1;
711 if (!$param->{'extra-args'} || !@{$param->{'extra-args'}}) {
712 raise_param_exc
( { 'extra-args' => "No command given" });
714 if (defined($param->{timeout
}) && !$sync) {
715 raise_param_exc
({ synchronous
=> "needs to be set for 'timeout'"});
718 my $res = PVE
::QemuServer
::Agent
::qemu_exec
($vmid, $param->{'extra-args'});
721 my $pid = $res->{pid
};
722 my $timeout = $param->{timeout
} // 30;
723 my $starttime = time();
725 while ($timeout == 0 || (time() - $starttime) < $timeout) {
726 my $out = PVE
::QemuServer
::Agent
::qemu_exec_status
($vmid, $pid);
727 if ($out->{exited
}) {
734 if (!$res->{exited
}) {
735 warn "timeout reached, returning pid\n";
739 return { result
=> $res };
742 __PACKAGE__-
>register_method({
747 description
=> "Cleans up resources like tap devices, vgpus, etc. Called after a vm shuts down, crashes, etc.",
749 additionalProperties
=> 0,
751 node
=> get_standard_option
('pve-node'),
752 vmid
=> get_standard_option
('pve-vmid', {
753 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
754 'clean-shutdown' => {
756 description
=> "Indicates if qemu shutdown cleanly.",
758 'guest-requested' => {
760 description
=> "Indicates if the shutdown was requested by the guest or via qmp.",
764 returns
=> { type
=> 'null', },
768 my $vmid = $param->{vmid
};
769 my $clean = $param->{'clean-shutdown'};
770 my $guest = $param->{'guest-requested'};
773 # return if we do not have the config anymore
774 return if !-f PVE
::QemuConfig-
>config_file($vmid);
776 my $storecfg = PVE
::Storage
::config
();
777 warn "Starting cleanup for $vmid\n";
779 PVE
::QemuConfig-
>lock_config($vmid, sub {
780 my $conf = PVE
::QemuConfig-
>load_config ($vmid);
781 my $pid = PVE
::QemuServer
::check_running
($vmid);
782 die "vm still running\n" if $pid;
785 # we have to cleanup the tap devices after a crash
787 foreach my $opt (keys %$conf) {
788 next if $opt !~ m/^net(\d)+$/;
790 PVE
::Network
::tap_unplug
("tap${vmid}i${interface}");
794 if (!$clean || $guest) {
795 # vm was shutdown from inside the guest or crashed, doing api cleanup
796 PVE
::QemuServer
::vm_stop_cleanup
($storecfg, $vmid, $conf, 0, 0);
798 PVE
::GuestHelpers
::exec_hookscript
($conf, $vmid, 'post-stop');
800 $restart = eval { PVE
::QemuServer
::clear_reboot_request
($vmid) };
804 warn "Finished cleanup for $vmid\n";
807 warn "Restarting VM $vmid\n";
808 PVE
::API2
::Qemu-
>vm_start({
817 my $print_agent_result = sub {
820 my $result = $data->{result
} // $data;
821 return if !defined($result);
823 my $class = ref($result);
827 return if $result =~ m/^\s*$/;
832 if (($class eq 'HASH') && !scalar(keys %$result)) { # empty hash
836 print to_json
($result, { pretty
=> 1, canonical
=> 1});
842 my $ssh_key_map = ['sshkeys', sub {
843 return URI
::Escape
::uri_escape
(PVE
::Tools
::file_get_contents
($_[0]));
845 my $cipassword_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password', { name
=> 'cipassword' });
846 my $password_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password');
848 'update_vm' => [$ssh_key_map, $cipassword_map],
849 'create_vm' => [$ssh_key_map, $cipassword_map],
850 'set-user-password' => [$password_map],
853 return $mapping->{$name};
857 list
=> [ "PVE::API2::Qemu", 'vmlist', [],
858 { node
=> $nodename }, sub {
861 exit 0 if (!scalar(@$vmlist));
863 printf "%10s %-20s %-10s %-10s %12s %-10s\n",
864 qw(VMID NAME STATUS MEM(MB) BOOTDISK
(GB
) PID
);
866 foreach my $rec (sort { $a->{vmid
} <=> $b->{vmid
} } @$vmlist) {
867 printf "%10s %-20s %-10s %-10s %12.2f %-10s\n", $rec->{vmid
}, $rec->{name
},
868 $rec->{qmpstatus
} || $rec->{status
},
869 ($rec->{maxmem
} || 0)/(1024*1024),
870 ($rec->{maxdisk
} || 0)/(1024*1024*1024),
877 create
=> [ "PVE::API2::Qemu", 'create_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
879 destroy
=> [ "PVE::API2::Qemu", 'destroy_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
881 clone
=> [ "PVE::API2::Qemu", 'clone_vm', ['vmid', 'newid'], { node
=> $nodename }, $upid_exit ],
883 migrate
=> [ "PVE::API2::Qemu", 'migrate_vm', ['vmid', 'target'], { node
=> $nodename }, $upid_exit ],
885 set
=> [ "PVE::API2::Qemu", 'update_vm', ['vmid'], { node
=> $nodename } ],
887 resize
=> [ "PVE::API2::Qemu", 'resize_vm', ['vmid', 'disk', 'size'], { node
=> $nodename } ],
889 move_disk
=> [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node
=> $nodename }, $upid_exit ],
891 unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid'], { node
=> $nodename } ],
893 config
=> [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
894 { node
=> $nodename }, sub {
896 foreach my $k (sort (keys %$config)) {
897 next if $k eq 'digest';
898 my $v = $config->{$k};
899 if ($k eq 'description') {
900 $v = PVE
::Tools
::encode_text
($v);
906 pending
=> [ "PVE::API2::Qemu", 'vm_pending', ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::format_pending
],
907 showcmd
=> [ __PACKAGE__
, 'showcmd', ['vmid']],
909 status
=> [ __PACKAGE__
, 'status', ['vmid']],
911 snapshot
=> [ "PVE::API2::Qemu", 'snapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
913 delsnapshot
=> [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
915 listsnapshot
=> [ "PVE::API2::Qemu", 'snapshot_list', ['vmid'], { node
=> $nodename }, \
&PVE
::GuestHelpers
::print_snapshot_tree
],
917 rollback
=> [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
919 template
=> [ "PVE::API2::Qemu", 'template', ['vmid'], { node
=> $nodename }],
921 start
=> [ "PVE::API2::Qemu", 'vm_start', ['vmid'], { node
=> $nodename } , $upid_exit ],
923 stop
=> [ "PVE::API2::Qemu", 'vm_stop', ['vmid'], { node
=> $nodename }, $upid_exit ],
925 reset => [ "PVE::API2::Qemu", 'vm_reset', ['vmid'], { node
=> $nodename }, $upid_exit ],
927 shutdown => [ "PVE::API2::Qemu", 'vm_shutdown', ['vmid'], { node
=> $nodename }, $upid_exit ],
929 reboot
=> [ "PVE::API2::Qemu", 'vm_reboot', ['vmid'], { node
=> $nodename }, $upid_exit ],
931 suspend
=> [ "PVE::API2::Qemu", 'vm_suspend', ['vmid'], { node
=> $nodename }, $upid_exit ],
933 resume
=> [ "PVE::API2::Qemu", 'vm_resume', ['vmid'], { node
=> $nodename }, $upid_exit ],
935 sendkey
=> [ "PVE::API2::Qemu", 'vm_sendkey', ['vmid', 'key'], { node
=> $nodename } ],
937 vncproxy
=> [ __PACKAGE__
, 'vncproxy', ['vmid']],
939 wait => [ __PACKAGE__
, 'wait', ['vmid']],
941 unlock
=> [ __PACKAGE__
, 'unlock', ['vmid']],
943 rescan
=> [ __PACKAGE__
, 'rescan', []],
945 monitor
=> [ __PACKAGE__
, 'monitor', ['vmid']],
947 agent
=> { alias
=> 'guest cmd' },
950 cmd
=> [ "PVE::API2::Qemu::Agent", 'agent', ['vmid', 'command'], { node
=> $nodename }, $print_agent_result ],
951 passwd
=> [ "PVE::API2::Qemu::Agent", 'set-user-password', [ 'vmid', 'username' ], { node
=> $nodename }],
952 exec => [ __PACKAGE__
, 'exec', [ 'vmid', 'extra-args' ], { node
=> $nodename }, $print_agent_result],
953 'exec-status' => [ "PVE::API2::Qemu::Agent", 'exec-status', [ 'vmid', 'pid' ], { node
=> $nodename }, $print_agent_result],
956 mtunnel
=> [ __PACKAGE__
, 'mtunnel', []],
958 nbdstop
=> [ __PACKAGE__
, 'nbdstop', ['vmid']],
960 terminal
=> [ __PACKAGE__
, 'terminal', ['vmid']],
962 importdisk
=> [ __PACKAGE__
, 'importdisk', ['vmid', 'source', 'storage']],
964 importovf
=> [ __PACKAGE__
, 'importovf', ['vmid', 'manifest', 'storage']],
966 cleanup
=> [ __PACKAGE__
, 'cleanup', ['vmid', 'clean-shutdown', 'guest-requested'], { node
=> $nodename }],
969 dump => [ "PVE::API2::Qemu", 'cloudinit_generated_config_dump', ['vmid', 'type'], { node
=> $nodename }, sub {