Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com>
---
 src/PVE/API2/LXC.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

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); };
-- 
2.17.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to