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

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 3ec31c2..e6f8f31 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -4764,6 +4764,12 @@ __PACKAGE__->register_method({
            node => get_standard_option('pve-node'),
            vmid => get_standard_option('pve-vmid', { completion => 
\&PVE::QemuServer::complete_vmid }),
            snapname => get_standard_option('pve-snapshot-name'),
+           start => {
+               type => 'boolean',
+               description => "Whether the VM should get started after rolling 
back successfully",
+               optional => 1,
+               default => 0,
+           },
        },
     },
     returns => {
@@ -4786,6 +4792,10 @@ __PACKAGE__->register_method({
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM 
$vmid: $snapname");
            PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
+
+           if ($param->{start}) {
+               PVE::API2::Qemu->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