From: Thomas Lamprecht Date: Wed, 13 Jun 2018 14:34:10 +0000 (+0200) Subject: api create: allow auto ct start after create finished X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=9d0225fb6dc001ccc399825a8ec1131800168348;p=pve-container.git api create: allow auto ct start after create finished Signed-off-by: Thomas Lamprecht --- diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index d85c1a2..9f94bf3 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -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); };