]> git.proxmox.com Git - pve-container.git/commitdiff
fix #4228: add start parameter to rollback endpoint for automatic restarting of CT
authorStefan Hanreich <s.hanreich@proxmox.com>
Wed, 14 Sep 2022 08:30:52 +0000 (10:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 8 Nov 2022 17:15:25 +0000 (18:15 +0100)
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
src/PVE/API2/LXC/Snapshot.pm

index 4be16ad1553bb9434b1f769b5f465f4dd4e83d21..0999fbc9e0b4ecac39e7f2983ced545bde0470d4 100644 (file)
@@ -272,6 +272,12 @@ __PACKAGE__->register_method({
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid'),
            snapname => get_standard_option('pve-snapshot-name'),
+           start => {
+               type => 'boolean',
+               description => "Whether the container should get started after rolling back successfully",
+               optional => 1,
+               default => 0,
+           },
        },
     },
     returns => {
@@ -294,6 +300,10 @@ __PACKAGE__->register_method({
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "rollback snapshot LXC $vmid: $snapname");
            PVE::LXC::Config->snapshot_rollback($vmid, $snapname);
+
+           if ($param->{start}) {
+               PVE::API2::LXC::Status->vm_start({ vmid => $vmid, node => $node })
+           }
        };
 
        my $worker = sub {