Signed-off-by: Stefan Hanreich <s.hanre...@proxmox.com>
---
 src/PVE/API2/LXC/Snapshot.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/PVE/API2/LXC/Snapshot.pm b/src/PVE/API2/LXC/Snapshot.pm
index 4be16ad..62adaee 100644
--- a/src/PVE/API2/LXC/Snapshot.pm
+++ b/src/PVE/API2/LXC/Snapshot.pm
@@ -272,6 +272,11 @@ __PACKAGE__->register_method({
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid'),
            snapname => get_standard_option('pve-snapshot-name'),
+           start => {
+               optional => 1,
+               type => 'string',
+               description => "whether the container should get restarted 
afterwards",
+           },
        },
     },
     returns => {
@@ -291,9 +296,16 @@ __PACKAGE__->register_method({
 
        my $snapname = extract_param($param, 'snapname');
 
+       my $start = extract_param($param, 'start');
+
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "rollback snapshot LXC 
$vmid: $snapname");
            PVE::LXC::Config->snapshot_rollback($vmid, $snapname);
+
+           if ($start) {
+               PVE::Cluster::log_msg('info', $authuser, "start CT $vmid");
+               PVE::API2::LXC::Status->vm_start({ vmid => $vmid, node => $node 
})
+           }
        };
 
        my $worker = sub {
-- 
2.30.2


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

Reply via email to