]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/CLI/qmrestore.pm
schema: fix description of migrate_downtime parameter
[qemu-server.git] / PVE / CLI / qmrestore.pm
index 7214c2d62987a339dab47ecc6f63cbc812f7316b..a47648bd430db8b0bd6703ec2d6137b0c66f42d0 100755 (executable)
@@ -14,9 +14,13 @@ use PVE::API2::Qemu;
 
 use base qw(PVE::CLIHandler);
 
+sub setup_environment {
+    PVE::RPCEnvironment->setup_default_cli_env();
+}
+
 __PACKAGE__->register_method({
-    name => 'qmrestore', 
-    path => 'qmrestore', 
+    name => 'qmrestore',
+    path => 'qmrestore',
     method => 'POST',
     description => "Restore QemuServer vzdump backups.",
     parameters => {
@@ -25,7 +29,7 @@ __PACKAGE__->register_method({
            vmid => get_standard_option('pve-vmid', { completion => \&PVE::Cluster::complete_next_vmid }),
            archive => {
                description => "The backup file. You can pass '-' to read from standard input.",
-               type => 'string', 
+               type => 'string',
                maxLength => 255,
                completion => \&PVE::QemuServer::complete_backup_archives,
            },
@@ -35,23 +39,34 @@ __PACKAGE__->register_method({
                completion => \&PVE::QemuServer::complete_storage,
            }),
            force => {
-               optional => 1, 
+               optional => 1,
                type => 'boolean',
                description => "Allow to overwrite existing VM.",
            },
            unique => {
-               optional => 1, 
+               optional => 1,
                type => 'boolean',
                description => "Assign a unique random ethernet address.",
            },
-           pool => { 
+           pool => {
                optional => 1,
                type => 'string', format => 'pve-poolid',
                description => "Add the VM to the specified pool.",
            },
+           bwlimit => {
+               description => "Override I/O bandwidth limit (in KiB/s).",
+               optional => 1,
+               type => 'number',
+               minimum => '0',
+           },
+           'live-restore' => {
+               optional => 1,
+               type => 'boolean',
+               description => "Start the VM immediately from the backup and restore in background. PBS only.",
+           },
        },
     },
-    returns => { 
+    returns => {
        type => 'string',
     },
     code => sub {
@@ -60,13 +75,13 @@ __PACKAGE__->register_method({
        $param->{node} = PVE::INotify::nodename();
 
        return PVE::API2::Qemu->create_vm($param);
-    }});    
+    }});
 
-our $cmddef = [ __PACKAGE__, 'qmrestore', ['archive', 'vmid'], undef, 
+our $cmddef = [ __PACKAGE__, 'qmrestore', ['archive', 'vmid'], undef,
                sub {
                    my $upid = shift;
                    my $status = PVE::Tools::upid_read_status($upid);
-                   exit($status eq 'OK' ? 0 : -1);
+                   exit(PVE::Tools::upid_status_is_error($status) ? -1 : 0);
                }];
 
 1;