]> git.proxmox.com Git - pve-manager.git/commitdiff
add vzdump/extractconfig API path
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 3 Jun 2016 09:09:40 +0000 (11:09 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 3 Jun 2016 10:11:14 +0000 (12:11 +0200)
PVE/API2/VZDump.pm

index 712c7129915e5f2219166af4cd7204ee325a98a2..91b8a2766294fe9f218e070e26e7aea13f0d9677 100644 (file)
@@ -165,3 +165,42 @@ __PACKAGE__->register_method ({
 
        return $rpcenv->fork_worker('vzdump', undef, $user, $worker);
    }});
+
+__PACKAGE__->register_method ({
+    name => 'extractconfig',
+    path => 'extractconfig',
+    method => 'GET',
+    description => "Extract configuration from vzdump backup archive.",
+    permissions => {
+       description => "The user needs 'VM.Backup' permissions on the backed up guest ID, and 'Datastore.AllocateSpace' on the backup storage.",
+       user => 'all',
+    },
+    protected => 1,
+    proxyto => 'node',
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+           volume => {
+               description => "Volume identifier",
+               type => 'string',
+               completion => \&PVE::Storage::complete_volume,
+           },
+       },
+    },
+    returns => { type => 'string' },
+    code => sub {
+       my ($param) = @_;
+
+       my $volume = extract_param($param, 'volume');
+
+       my $rpcenv = PVE::RPCEnvironment::get();
+       my $authuser = $rpcenv->get_user();
+
+       my $storage_cfg = PVE::Storage::config();
+       $rpcenv->check_volume_access($authuser, $storage_cfg, undef, $volume);
+
+       return PVE::Storage::extract_vzdump_config($storage_cfg, $volume);
+    }});
+
+1;