]> git.proxmox.com Git - pve-container.git/commitdiff
api create: allow auto ct start after create finished
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 13 Jun 2018 14:34:10 +0000 (16:34 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 18 Jun 2018 08:31:06 +0000 (10:31 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/API2/LXC.pm

index d85c1a244eabfe58fda8e0e8acd5b73931220028..9f94bf339f20473c36c7d7f3855709c3ceb7397b 100644 (file)
@@ -167,6 +167,12 @@ __PACKAGE__->register_method({
                type => 'number',
                minimum => '0',
            },
+           start => {
+               optional => 1,
+               type => 'boolean',
+               default => 0,
+               description => "Start the CT after its creation finished successfully.",
+           },
        }),
     },
     returns => {
@@ -187,6 +193,8 @@ __PACKAGE__->register_method({
 
        my $bwlimit = extract_param($param, 'bwlimit');
 
+       my $start_after_create = extract_param($param, 'start');
+
        my $basecfg_fn = PVE::LXC::Config->config_file($vmid);
 
        my $same_container_exists = -f $basecfg_fn;
@@ -428,6 +436,9 @@ __PACKAGE__->register_method({
                die $err;
            }
            PVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;
+
+           PVE::API2::LXC::Status->vm_start({ vmid => $vmid, node => $node })
+               if $start_after_create;
        };
 
        my $realcmd = sub { PVE::LXC::Config->lock_config($vmid, $code); };