]> git.proxmox.com Git - qemu-server.git/blobdiff - qm
rename move to move_disk
[qemu-server.git] / qm
diff --git a/qm b/qm
index 044bc21dce24bfeca3067be4d1fd5ac1fc6cfc8f..879c477e17f9f4d0f2a3e33637764ff4b8c0ef48 100755 (executable)
--- a/qm
+++ b/qm
@@ -48,6 +48,9 @@ sub run_vnc_proxy {
 
     my $path = PVE::QemuServer::vnc_socket($vmid);
 
+    my $c;
+    while ( ++$c < 10 && !-e $path ) { sleep(1); }
+
     my $s = IO::Socket::UNIX->new(Peer => $path, Timeout => 120);
 
     die "unable to connect to socket '$path' - $!" if !$s;
@@ -294,7 +297,7 @@ __PACKAGE__->register_method ({
            last if $input =~ m/^\s*q(uit)?\s*$/;
 
            eval {
-               print PVE::QemuServer::vm_monitor_command ($vmid, $input);
+               print PVE::QemuServer::vm_human_monitor_command ($vmid, $input);
            };
            print "ERROR: $@" if $@;
        }
@@ -303,6 +306,26 @@ __PACKAGE__->register_method ({
 
     }});
 
+__PACKAGE__->register_method ({
+    name => 'rescan', 
+    path => 'rescan', 
+    method => 'POST',
+    description => "Rescan all storages and update disk sizes and unused disk images.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           vmid => get_standard_option('pve-vmid', {optional => 1}),
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       PVE::QemuServer::rescan($param->{vmid});
+
+       return undef;
+    }});
+
 my $cmddef = {
     list => [ "PVE::API2::Qemu", 'vmlist', [],
             { node => $nodename }, sub {
@@ -328,10 +351,16 @@ my $cmddef = {
 
     destroy => [ "PVE::API2::Qemu", 'destroy_vm', ['vmid'], { node => $nodename }, $upid_exit ],
 
+    clone => [ "PVE::API2::Qemu", 'clone_vm', ['vmid', 'newid'], { node => $nodename }, $upid_exit ],
+
     migrate => [ "PVE::API2::Qemu", 'migrate_vm', ['vmid', 'target'], { node => $nodename }, $upid_exit ],
 
     set => [ "PVE::API2::Qemu", 'update_vm', ['vmid'], { node => $nodename } ],
 
+    resize => [ "PVE::API2::Qemu", 'resize_vm', ['vmid', 'disk', 'size'], { node => $nodename } ],
+
+    move_disk => [ "PVE::API2::Qemu", 'move_vm_disk', ['vmid', 'disk', 'storage'], { node => $nodename }, $upid_exit ],
+
     unlink => [ "PVE::API2::Qemu", 'unlink', ['vmid', 'idlist'], { node => $nodename } ],
 
     config => [ "PVE::API2::Qemu", 'vm_config', ['vmid'], 
@@ -351,6 +380,14 @@ my $cmddef = {
 
     status => [ __PACKAGE__, 'status', ['vmid']],
 
+    snapshot => [ "PVE::API2::Qemu", 'snapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
+
+    delsnapshot => [ "PVE::API2::Qemu", 'delsnapshot', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
+
+    rollback => [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
+
+    template => [ "PVE::API2::Qemu", 'template', ['vmid'], { node => $nodename }],
+
     start => [ "PVE::API2::Qemu", 'vm_start', ['vmid'], { node => $nodename } , $upid_exit ],
 
     stop => [ "PVE::API2::Qemu", 'vm_stop', ['vmid'], { node => $nodename }, $upid_exit ],
@@ -371,6 +408,8 @@ my $cmddef = {
 
     unlock => [ __PACKAGE__, 'unlock', ['vmid']],
 
+    rescan  => [ __PACKAGE__, 'rescan', []],
+
     monitor  => [ __PACKAGE__, 'monitor', ['vmid']],
 
     mtunnel => [ __PACKAGE__, 'mtunnel', []],  
@@ -378,6 +417,9 @@ my $cmddef = {
 
 my $cmd = shift;
 
+# Note: disable '+' prefix for Getopt::Long (for resize command)
+use Getopt::Long qw(:config no_getopt_compat); 
+
 PVE::CLIHandler::handle_cmd($cmddef, "qm", $cmd, \@ARGV, undef, $0);
 
 exit 0;