public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server v3 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of VM
Date: Wed, 14 Sep 2022 10:30:53 +0200	[thread overview]
Message-ID: <20220914083054.1277527-3-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20220914083054.1277527-1-s.hanreich@proxmox.com>

Signed-off-by: Stefan Hanreich <s.hanreich@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




  parent reply	other threads:[~2022-09-14  8:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  8:30 [pve-devel] [PATCH manager/qemu-server/container v3 0/1] Add checkbox for automatic restart of CT/VM after rollback Stefan Hanreich
2022-09-14  8:30 ` [pve-devel] [PATCH pve-container v3 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of CT Stefan Hanreich
2022-11-08 17:16   ` [pve-devel] applied: " Thomas Lamprecht
2022-09-14  8:30 ` Stefan Hanreich [this message]
2022-11-08 17:16   ` [pve-devel] applied: [PATCH qemu-server v3 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of VM Thomas Lamprecht
2022-09-14  8:30 ` [pve-devel] [PATCH pve-manager v3 1/1] fix #4228: ui: add automatic restarting to snapshot rollback dialog Stefan Hanreich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220914083054.1277527-3-s.hanreich@proxmox.com \
    --to=s.hanreich@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal