[pve-devel] [PATCH container] api create: allow auto ct start after create finished
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Jun 13 16:34:10 CEST 2018
Signed-off-by: Thomas Lamprecht <t.lamprecht at 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
More information about the pve-devel
mailing list