]>
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);
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",
133 returns
=> { type
=> 'null'},
137 my $storecfg = PVE
::Storage
::config
();
138 my $cmdline = PVE
::QemuServer
::vm_commandline
($storecfg, $param->{vmid
});
140 $cmdline =~ s/ -/ \\\n -/g if $param->{pretty
};
147 __PACKAGE__-
>register_method ({
151 description
=> "Show VM status.",
153 additionalProperties
=> 0,
155 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
157 description
=> "Verbose output format",
163 returns
=> { type
=> 'null'},
168 my $conf = PVE
::QemuConfig-
>load_config ($param->{vmid
});
170 my $vmstatus = PVE
::QemuServer
::vmstatus
($param->{vmid
}, 1);
171 my $stat = $vmstatus->{$param->{vmid
}};
172 if ($param->{verbose
}) {
173 foreach my $k (sort (keys %$stat)) {
174 next if $k eq 'cpu' || $k eq 'relcpu'; # always 0
176 print_recursive_hash
("", $v, $k);
179 my $status = $stat->{qmpstatus
} || 'unknown';
180 print "status: $status\n";
186 __PACKAGE__-
>register_method ({
190 description
=> "Proxy VM VNC traffic to stdin/stdout",
192 additionalProperties
=> 0,
194 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
197 returns
=> { type
=> 'null'},
201 my $vmid = $param->{vmid
};
202 my $vnc_socket = PVE
::QemuServer
::vnc_socket
($vmid);
204 if (my $ticket = $ENV{LC_PVE_TICKET
}) { # NOTE: ssh on debian only pass LC_* variables
205 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,password");
206 PVE
::QemuServer
::vm_mon_cmd
($vmid, "set_password", protocol
=> 'vnc', password
=> $ticket);
207 PVE
::QemuServer
::vm_mon_cmd
($vmid, "expire_password", protocol
=> 'vnc', time => "+30");
209 PVE
::QemuServer
::vm_mon_cmd
($vmid, "change", device
=> 'vnc', target
=> "unix:$vnc_socket,x509,password");
212 run_vnc_proxy
($vnc_socket);
217 __PACKAGE__-
>register_method ({
221 description
=> "Unlock the VM.",
223 additionalProperties
=> 0,
225 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
228 returns
=> { type
=> 'null'},
232 my $vmid = $param->{vmid
};
234 PVE
::QemuConfig-
>lock_config ($vmid, sub {
235 my $conf = PVE
::QemuConfig-
>load_config($vmid);
236 delete $conf->{lock};
237 delete $conf->{pending
}->{lock} if $conf->{pending
}; # just to be sure
238 PVE
::QemuConfig-
>write_config($vmid, $conf);
244 __PACKAGE__-
>register_method ({
248 description
=> "Stop embedded nbd server.",
250 additionalProperties
=> 0,
252 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
255 returns
=> { type
=> 'null'},
259 my $vmid = $param->{vmid
};
261 PVE
::QemuServer
::nbd_stop
($vmid);
266 __PACKAGE__-
>register_method ({
270 description
=> "Used by qmigrate - do not use manually.",
272 additionalProperties
=> 0,
275 returns
=> { type
=> 'null'},
279 if (!PVE
::Cluster
::check_cfs_quorum
(1)) {
284 my $tunnel_write = sub {
291 $tunnel_write->("tunnel online");
292 $tunnel_write->("ver 1");
294 while (my $line = <STDIN
>) {
296 if ($line =~ /^quit$/) {
297 $tunnel_write->("OK");
299 } elsif ($line =~ /^resume (\d+)$/) {
301 if (PVE
::QemuServer
::check_running
($vmid, 1)) {
302 eval { PVE
::QemuServer
::vm_resume
($vmid, 1, 1); };
304 $tunnel_write->("ERR: resume failed - $@");
306 $tunnel_write->("OK");
309 $tunnel_write->("ERR: resume failed - VM $vmid not running");
317 __PACKAGE__-
>register_method ({
321 description
=> "Wait until the VM is stopped.",
323 additionalProperties
=> 0,
325 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
327 description
=> "Timeout in seconds. Default is to wait forever.",
334 returns
=> { type
=> 'null'},
338 my $vmid = $param->{vmid
};
339 my $timeout = $param->{timeout
};
341 my $pid = PVE
::QemuServer
::check_running
($vmid);
344 print "waiting until VM $vmid stopps (PID $pid)\n";
347 while ((!$timeout || ($count < $timeout)) && PVE
::QemuServer
::check_running
($vmid)) {
352 die "wait failed - got timeout\n" if PVE
::QemuServer
::check_running
($vmid);
357 __PACKAGE__-
>register_method ({
361 description
=> "Enter Qemu Monitor interface.",
363 additionalProperties
=> 0,
365 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
368 returns
=> { type
=> 'null'},
372 my $vmid = $param->{vmid
};
374 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
376 print "Entering Qemu Monitor for VM $vmid - type 'help' for help\n";
378 my $term = new Term
::ReadLine
('qm');
381 while (defined ($input = $term->readline('qm> '))) {
384 next if $input =~ m/^\s*$/;
386 last if $input =~ m/^\s*q(uit)?\s*$/;
389 print PVE
::QemuServer
::vm_human_monitor_command
($vmid, $input);
391 print "ERROR: $@" if $@;
398 __PACKAGE__-
>register_method ({
402 description
=> "Rescan all storages and update disk sizes and unused disk images.",
404 additionalProperties
=> 0,
406 vmid
=> get_standard_option
('pve-vmid', {
408 completion
=> \
&PVE
::QemuServer
::complete_vmid
,
414 description
=> 'Do not actually write changes out to VM config(s).',
418 returns
=> { type
=> 'null'},
422 my $dryrun = $param->{dryrun
};
424 print "NOTE: running in dry-run mode, won't write changes out!\n" if $dryrun;
426 PVE
::QemuServer
::rescan
($param->{vmid
}, 0, $dryrun);
431 __PACKAGE__-
>register_method ({
432 name
=> 'importdisk',
433 path
=> 'importdisk',
435 description
=> "Import an external disk image as an unused disk in a VM. The
436 image format has to be supported by qemu-img(1).",
438 additionalProperties
=> 0,
440 vmid
=> get_standard_option
('pve-vmid', {completion
=> \
&PVE
::QemuServer
::complete_vmid
}),
442 description
=> 'Path to the disk image to import',
446 storage
=> get_standard_option
('pve-storage-id', {
447 description
=> 'Target storage ID',
448 completion
=> \
&PVE
::QemuServer
::complete_storage
,
453 description
=> 'Target format',
454 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
459 returns
=> { type
=> 'null'},
463 my $vmid = extract_param
($param, 'vmid');
464 my $source = extract_param
($param, 'source');
465 my $storeid = extract_param
($param, 'storage');
466 my $format = extract_param
($param, 'format');
468 my $vm_conf = PVE
::QemuConfig-
>load_config($vmid);
469 PVE
::QemuConfig-
>check_lock($vm_conf);
470 die "$source: non-existent or non-regular file\n" if (! -f
$source);
472 my $storecfg = PVE
::Storage
::config
();
473 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
475 my $target_storage_config =
476 PVE
::Storage
::storage_config
($storecfg, $storeid);
477 die "storage $storeid does not support vm images\n"
478 if !$target_storage_config->{content
}->{images
};
480 PVE
::QemuServer
::ImportDisk
::do_import
($source, $vmid, $storeid, { format
=> $format });
485 __PACKAGE__-
>register_method ({
489 description
=> "Open a terminal using a serial device (The VM need to have a serial device configured, for example 'serial0: socket')",
491 additionalProperties
=> 0,
493 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
495 description
=> "Select the serial device. By default we simply use the first suitable device.",
498 enum
=> [qw(serial0 serial1 serial2 serial3)],
501 description
=> "Escape character.",
508 returns
=> { type
=> 'null'},
512 my $vmid = $param->{vmid
};
514 my $escape = $param->{escape
} // '^O';
515 if ($escape =~ /^\^([\x40-\x7a])$/) {
516 $escape = ord($1) & 0x1F;
517 } elsif ($escape =~ /^0x[0-9a-f]+$/i) {
518 $escape = hex($escape);
519 } elsif ($escape =~ /^[0-9]+$/) {
520 $escape = int($escape);
522 die "invalid escape character definition: $escape\n";
526 $escapemsg = sprintf(' (press Ctrl+%c to exit)', $escape+0x40);
527 $escape = sprintf(',escape=0x%x', $escape);
532 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
534 my $iface = $param->{iface
};
537 die "serial interface '$iface' is not configured\n" if !$conf->{$iface};
538 die "wrong serial type on interface '$iface'\n" if $conf->{$iface} ne 'socket';
540 foreach my $opt (qw(serial0 serial1 serial2 serial3)) {
541 if ($conf->{$opt} && ($conf->{$opt} eq 'socket')) {
546 die "unable to find a serial interface\n" if !$iface;
549 die "VM $vmid not running\n" if !PVE
::QemuServer
::check_running
($vmid);
551 my $socket = "/var/run/qemu-server/${vmid}.$iface";
553 my $cmd = "socat UNIX-CONNECT:$socket STDIO,raw,echo=0$escape";
555 print "starting serial terminal on interface ${iface}${escapemsg}\n";
562 __PACKAGE__-
>register_method ({
565 description
=> "Create a new VM using parameters read from an OVF manifest",
567 additionalProperties
=> 0,
569 vmid
=> get_standard_option
('pve-vmid', { completion
=> \
&PVE
::Cluster
::complete_next_vmid
}),
572 description
=> 'path to the ovf file',
574 storage
=> get_standard_option
('pve-storage-id', {
575 description
=> 'Target storage ID',
576 completion
=> \
&PVE
::QemuServer
::complete_storage
,
581 description
=> 'Target format',
582 enum
=> [ 'raw', 'qcow2', 'vmdk' ],
587 description
=> 'Print a parsed representation of the extracted OVF parameters, but do not create a VM',
592 returns
=> { type
=> 'null' },
596 my $vmid = PVE
::Tools
::extract_param
($param, 'vmid');
597 my $ovf_file = PVE
::Tools
::extract_param
($param, 'manifest');
598 my $storeid = PVE
::Tools
::extract_param
($param, 'storage');
599 my $format = PVE
::Tools
::extract_param
($param, 'format');
600 my $dryrun = PVE
::Tools
::extract_param
($param, 'dryrun');
602 die "$ovf_file: non-existent or non-regular file\n" if (! -f
$ovf_file);
603 my $storecfg = PVE
::Storage
::config
();
604 PVE
::Storage
::storage_check_enabled
($storecfg, $storeid);
606 my $parsed = PVE
::QemuServer
::OVF
::parse_ovf
($ovf_file);
609 print to_json
($parsed, { pretty
=> 1, canonical
=> 1});
613 $param->{name
} = $parsed->{qm
}->{name
} if defined($parsed->{qm
}->{name
});
614 $param->{memory
} = $parsed->{qm
}->{memory
} if defined($parsed->{qm
}->{memory
});
615 $param->{cores
} = $parsed->{qm
}->{cores
} if defined($parsed->{qm
}->{cores
});
619 PVE
::Cluster
::check_vmid_unused
($vmid);
624 # order matters, as do_import() will load_config() internally
625 $conf->{vmgenid
} = PVE
::QemuServer
::generate_uuid
();
626 $conf->{smbios1
} = PVE
::QemuServer
::generate_smbios1_uuid
();
627 PVE
::QemuConfig-
>write_config($vmid, $conf);
629 foreach my $disk (@{ $parsed->{disks
} }) {
630 my ($file, $drive) = ($disk->{backing_file
}, $disk->{disk_address
});
631 PVE
::QemuServer
::ImportDisk
::do_import
($file, $vmid, $storeid,
632 { drive_name
=> $drive, format
=> $format });
635 # reload after disks entries have been created
636 $conf = PVE
::QemuConfig-
>load_config($vmid);
637 PVE
::QemuConfig-
>check_lock($conf);
638 my $firstdisk = PVE
::QemuServer
::resolve_first_disk
($conf);
639 $conf->{bootdisk
} = $firstdisk if $firstdisk;
640 PVE
::QemuConfig-
>write_config($vmid, $conf);
646 eval { PVE
::QemuServer
::vm_destroy
($storecfg, $vmid, $skiplock); };
647 die "import failed - $err";
651 my $wait_for_lock = 1;
652 PVE
::QemuConfig-
>lock_config_full($vmid, $wait_for_lock, $importfn);
659 __PACKAGE__-
>register_method({
664 description
=> "Executes the given command via the guest agent",
666 additionalProperties
=> 0,
668 node
=> get_standard_option
('pve-node'),
669 vmid
=> get_standard_option
('pve-vmid', {
670 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
675 description
=> "If set to off, returns the pid immediately instead of waiting for the commmand to finish or the timeout.",
679 description
=> "The maximum time to wait synchronously for the command to finish. If reached, the pid gets returned. Set to 0 to deactivate",
684 'extra-args' => get_standard_option
('extra-args'),
693 my $vmid = $param->{vmid
};
694 my $sync = $param->{synchronous
} // 1;
695 if (!$param->{'extra-args'} || !@{$param->{'extra-args'}}) {
696 raise_param_exc
( { 'extra-args' => "No command given" });
698 if (defined($param->{timeout
}) && !$sync) {
699 raise_param_exc
({ synchronous
=> "needs to be set for 'timeout'"});
702 my $res = PVE
::QemuServer
::Agent
::qemu_exec
($vmid, $param->{'extra-args'});
705 my $pid = $res->{pid
};
706 my $timeout = $param->{timeout
} // 30;
707 my $starttime = time();
709 while ($timeout == 0 || (time() - $starttime) < $timeout) {
710 my $out = PVE
::QemuServer
::Agent
::qemu_exec_status
($vmid, $pid);
711 if ($out->{exited
}) {
718 if (!$res->{exited
}) {
719 warn "timeout reached, returning pid\n";
723 return { result
=> $res };
726 __PACKAGE__-
>register_method({
731 description
=> "Cleans up resources like tap devices, vgpus, etc. Called after a vm shuts down, crashes, etc.",
733 additionalProperties
=> 0,
735 node
=> get_standard_option
('pve-node'),
736 vmid
=> get_standard_option
('pve-vmid', {
737 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
738 'clean-shutdown' => {
740 description
=> "Indicates if qemu shutdown cleanly.",
742 'guest-requested' => {
744 description
=> "Indicates if the shutdown was requested by the guest or via qmp.",
748 returns
=> { type
=> 'null', },
752 my $vmid = $param->{vmid
};
753 my $clean = $param->{'clean-shutdown'};
754 my $guest = $param->{'guest-requested'};
756 my $storecfg = PVE
::Storage
::config
();
757 warn "Starting cleanup for $vmid\n";
759 PVE
::QemuConfig-
>lock_config($vmid, sub {
760 my $conf = PVE
::QemuConfig-
>load_config ($vmid);
761 my $pid = PVE
::QemuServer
::check_running
($vmid);
762 die "vm still running\n" if $pid;
765 # we have to cleanup the tap devices after a crash
767 foreach my $opt (keys %$conf) {
768 next if $opt !~ m/^net(\d)+$/;
770 PVE
::Network
::tap_unplug
("tap${vmid}i${interface}");
774 if (!$clean || $guest) {
775 # vm was shutdown from inside the guest or crashed, doing api cleanup
776 PVE
::QemuServer
::vm_stop_cleanup
($storecfg, $vmid, $conf, 0, 0);
780 warn "Finished cleanup for $vmid\n";
785 my $print_agent_result = sub {
788 my $result = $data->{result
} // $data;
789 return if !defined($result);
791 my $class = ref($result);
795 return if $result =~ m/^\s*$/;
800 if (($class eq 'HASH') && !scalar(keys %$result)) { # empty hash
804 print to_json
($result, { pretty
=> 1, canonical
=> 1});
810 my $ssh_key_map = ['sshkeys', sub {
811 return URI
::Escape
::uri_escape
(PVE
::Tools
::file_get_contents
($_[0]));
813 my $cipassword_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password', { name
=> 'cipassword' });
814 my $password_map = PVE
::CLIHandler
::get_standard_mapping
('pve-password');
816 'update_vm' => [$ssh_key_map, $cipassword_map],
817 'create_vm' => [$ssh_key_map, $cipassword_map],
818 'set-user-password' => [$password_map],
821 return $mapping->{$name};
825 list
=> [ "PVE::API2::Qemu", 'vmlist', [],
826 { node
=> $nodename }, sub {
829 exit 0 if (!scalar(@$vmlist));
831 printf "%10s %-20s %-10s %-10s %12s %-10s\n",
832 qw(VMID NAME STATUS MEM(MB) BOOTDISK
(GB
) PID
);
834 foreach my $rec (sort { $a->{vmid
} <=> $b->{vmid
} } @$vmlist) {
835 printf "%10s %-20s %-10s %-10s %12.2f %-10s\n", $rec->{vmid
}, $rec->{name
},
836 $rec->{qmpstatus
} || $rec->{status
},
837 ($rec->{maxmem
} || 0)/(1024*1024),
838 ($rec->{maxdisk
} || 0)/(1024*1024*1024),
845 create
=> [ "PVE::API2::Qemu", 'create_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
847 destroy
=> [ "PVE::API2::Qemu", 'destroy_vm', ['vmid'], { node
=> $nodename }, $upid_exit ],
849 clone
=> [ "PVE::API2::Qemu", 'clone_vm', ['vmid', 'newid'], { node
=> $nodename }, $upid_exit ],
851 migrate
=> [ "PVE::API2::Qemu", 'migrate_vm', ['vmid', 'target'], { node
=> $nodename }, $upid_exit ],
853 set
=> [ "PVE::API2::Qemu", 'update_vm', ['vmid'], { node
=> $nodename } ],
855 resize
=> [ "PVE::API2::Qemu", 'resize_vm', ['vmid', 'disk', 'size'], { node
=> $nodename } ],
857 move_disk
=> [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node
=> $nodename }, $upid_exit ],
859 unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid'], { node
=> $nodename } ],
861 config
=> [ "PVE::API2::Qemu", 'vm_config', ['vmid'],
862 { node
=> $nodename }, sub {
864 foreach my $k (sort (keys %$config)) {
865 next if $k eq 'digest';
866 my $v = $config->{$k};
867 if ($k eq 'description') {
868 $v = PVE
::Tools
::encode_text
($v);
874 pending
=> [ "PVE::API2::Qemu", 'vm_pending', ['vmid'],
875 { node
=> $nodename }, sub {
877 foreach my $item (sort { $a->{key
} cmp $b->{key
}} @$data) {
878 my $k = $item->{key
};
879 next if $k eq 'digest';
880 my $v = $item->{value
};
881 my $p = $item->{pending
};
882 if ($k eq 'description') {
883 $v = PVE
::Tools
::encode_text
($v) if defined($v);
884 $p = PVE
::Tools
::encode_text
($p) if defined($p);
887 if ($item->{delete}) {
888 print "del $k: $v\n";
889 } elsif (defined($p)) {
890 print "cur $k: $v\n";
891 print "new $k: $p\n";
893 print "cur $k: $v\n";
895 } elsif (defined($p)) {
896 print "new $k: $p\n";
901 showcmd
=> [ __PACKAGE__
, 'showcmd', ['vmid']],
903 status
=> [ __PACKAGE__
, 'status', ['vmid']],
905 snapshot
=> [ "PVE::API2::Qemu", 'snapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
907 delsnapshot
=> [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
909 listsnapshot
=> [ "PVE::API2::Qemu", 'snapshot_list', ['vmid'], { node
=> $nodename },
912 foreach my $e (@$res) {
913 my $headline = $e->{description
} || 'no-description';
914 $headline =~ s/\n.*//sg;
915 my $parent = $e->{parent
} // 'no-parent';
916 printf("%-20s %-20s %s\n", $e->{name
}, $parent, $headline);
920 rollback
=> [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node
=> $nodename } , $upid_exit ],
922 template
=> [ "PVE::API2::Qemu", 'template', ['vmid'], { node
=> $nodename }],
924 start
=> [ "PVE::API2::Qemu", 'vm_start', ['vmid'], { node
=> $nodename } , $upid_exit ],
926 stop
=> [ "PVE::API2::Qemu", 'vm_stop', ['vmid'], { node
=> $nodename }, $upid_exit ],
928 reset => [ "PVE::API2::Qemu", 'vm_reset', ['vmid'], { node
=> $nodename }, $upid_exit ],
930 shutdown => [ "PVE::API2::Qemu", 'vm_shutdown', ['vmid'], { node
=> $nodename }, $upid_exit ],
932 suspend
=> [ "PVE::API2::Qemu", 'vm_suspend', ['vmid'], { node
=> $nodename }, $upid_exit ],
934 resume
=> [ "PVE::API2::Qemu", 'vm_resume', ['vmid'], { node
=> $nodename }, $upid_exit ],
936 sendkey
=> [ "PVE::API2::Qemu", 'vm_sendkey', ['vmid', 'key'], { node
=> $nodename } ],
938 vncproxy
=> [ __PACKAGE__
, 'vncproxy', ['vmid']],
940 wait => [ __PACKAGE__
, 'wait', ['vmid']],
942 unlock
=> [ __PACKAGE__
, 'unlock', ['vmid']],
944 rescan
=> [ __PACKAGE__
, 'rescan', []],
946 monitor
=> [ __PACKAGE__
, 'monitor', ['vmid']],
948 agent
=> { alias
=> 'guest cmd' },
951 cmd
=> [ "PVE::API2::Qemu::Agent", 'agent', ['vmid', 'command'], { node
=> $nodename }, $print_agent_result ],
952 passwd
=> [ "PVE::API2::Qemu::Agent", 'set-user-password', [ 'vmid', 'username' ], { node
=> $nodename }],
953 exec => [ __PACKAGE__
, 'exec', [ 'vmid', 'extra-args' ], { node
=> $nodename }, $print_agent_result],
954 'exec-status' => [ "PVE::API2::Qemu::Agent", 'exec-status', [ 'vmid', 'pid' ], { node
=> $nodename }, $print_agent_result],
957 mtunnel
=> [ __PACKAGE__
, 'mtunnel', []],
959 nbdstop
=> [ __PACKAGE__
, 'nbdstop', ['vmid']],
961 terminal
=> [ __PACKAGE__
, 'terminal', ['vmid']],
963 importdisk
=> [ __PACKAGE__
, 'importdisk', ['vmid', 'source', 'storage']],
965 importovf
=> [ __PACKAGE__
, 'importovf', ['vmid', 'manifest', 'storage']],
967 cleanup
=> [ __PACKAGE__
, 'cleanup', ['vmid', 'clean-shutdown', 'guest-requested'], { node
=> $nodename }],