* [pve-devel] [PATCH qemu-server v3] rollback: Only create start task with --start if VM is not running
@ 2022-12-21 16:51 Stefan Hanreich
2022-12-30 14:56 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2022-12-21 16:51 UTC (permalink / raw)
To: pve-devel
When rolling back to the snapshot of a VM that includes RAM, the VM
gets started by the rollback task anyway, so no additional start task
is needed. Previously, when rolling back with the start parameter and
the VM snapshot included RAM, a start task was created. That task
failed because the VM had already been started by the rollback task.
Additionally documented this behaviour in the description of the start
parameter
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
Changes v2 -> v3:
Use vm_running_locally() instead of check_running()
Improved description
Changes v1 -> v2:
Do not parse config for checking type of snapshot but rather directly check
whether VM is running or not via check_running()
PVE/API2/Qemu.pm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index e2a420f..c87602d 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -5066,7 +5066,8 @@ __PACKAGE__->register_method({
snapname => get_standard_option('pve-snapshot-name'),
start => {
type => 'boolean',
- description => "Whether the VM should get started after rolling back successfully",
+ description => "Whether the VM should get started after rolling back successfully."
+ . " (Note: VMs will be automatically started if the snapshot includes RAM.)",
optional => 1,
default => 0,
},
@@ -5093,7 +5094,7 @@ __PACKAGE__->register_method({
PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname");
PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
- if ($param->{start}) {
+ if ($param->{start} && !PVE::QemuServer::Helpers::vm_running_locally($vmid)) {
PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node });
}
};
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH qemu-server v3] rollback: Only create start task with --start if VM is not running
2022-12-21 16:51 [pve-devel] [PATCH qemu-server v3] rollback: Only create start task with --start if VM is not running Stefan Hanreich
@ 2022-12-30 14:56 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-12-30 14:56 UTC (permalink / raw)
To: Proxmox VE development discussion, Stefan Hanreich
Am 21/12/2022 um 17:51 schrieb Stefan Hanreich:
> When rolling back to the snapshot of a VM that includes RAM, the VM
> gets started by the rollback task anyway, so no additional start task
> is needed. Previously, when rolling back with the start parameter and
> the VM snapshot included RAM, a start task was created. That task
> failed because the VM had already been started by the rollback task.
>
> Additionally documented this behaviour in the description of the start
> parameter
>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> Changes v2 -> v3:
> Use vm_running_locally() instead of check_running()
> Improved description
>
> Changes v1 -> v2:
> Do not parse config for checking type of snapshot but rather directly check
> whether VM is running or not via check_running()
>
> PVE/API2/Qemu.pm | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-30 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21 16:51 [pve-devel] [PATCH qemu-server v3] rollback: Only create start task with --start if VM is not running Stefan Hanreich
2022-12-30 14:56 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox