]> git.proxmox.com Git - pve-container.git/commitdiff
add lxc/pending API path
authorOguz Bektas <o.bektas@proxmox.com>
Mon, 14 Oct 2019 08:28:42 +0000 (10:28 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 18:39:07 +0000 (20:39 +0200)
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
src/PVE/API2/LXC.pm

index 3830e5ebc43937459223c0409edb0dcd1f5a2824..7571ab7601f9fc0192b3191700fba90286bd7c78 100644 (file)
@@ -515,6 +515,7 @@ __PACKAGE__->register_method({
 
        my $res = [
            { subdir => 'config' },
+           { subdir => 'pending' },
            { subdir => 'status' },
            { subdir => 'vncproxy' },
            { subdir => 'termproxy' },
@@ -1869,4 +1870,59 @@ __PACKAGE__->register_method({
        return $task;
   }});
 
+__PACKAGE__->register_method({
+    name => 'vm_pending',
+    path => '{vmid}/pending',
+    method => 'GET',
+    proxyto => 'node',
+    description => 'Get container configuration, including pending changes.',
+    permissions => {
+       check => ['perm', '/vms/{vmid}', [ 'VM.Audit' ]],
+    },
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+           vmid => get_standard_option('pve-vmid', { completion => \&PVE::LXC::complete_ctid }),
+       },
+    },
+    returns => {
+       type => "array",
+       items => {
+           type => "object",
+           properties => {
+               key => {
+                   description => 'Configuration option name.',
+                   type => 'string',
+               },
+               value => {
+                   description => 'Current value.',
+                   type => 'string',
+                   optional => 1,
+               },
+               pending => {
+                   description => 'Pending value.',
+                   type => 'string',
+                   optional => 1,
+               },
+               delete => {
+                   description => "Indicates a pending delete request if present and not 0.",
+                   type => 'integer',
+                   minimum => 0,
+                   maximum => 2,
+                   optional => 1,
+               },
+           },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $conf = PVE::LXC::Config->load_config($param->{vmid});
+
+       my $pending_delete_hash = PVE::LXC::Config->parse_pending_delete($conf->{pending}->{delete});
+
+       return PVE::GuestHelpers::conf_table_with_pending($conf, $pending_delete_hash);
+    }});
+
 1;