mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-12 21:28:59 +00:00
fix #4228: add start parameter to rollback endpoint for automatic restarting of VM
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
This commit is contained in:
parent
d80ad18c67
commit
76b29aafd7
@ -4875,6 +4875,12 @@ __PACKAGE__->register_method({
|
|||||||
node => get_standard_option('pve-node'),
|
node => get_standard_option('pve-node'),
|
||||||
vmid => get_standard_option('pve-vmid', { completion => \&PVE::QemuServer::complete_vmid }),
|
vmid => get_standard_option('pve-vmid', { completion => \&PVE::QemuServer::complete_vmid }),
|
||||||
snapname => get_standard_option('pve-snapshot-name'),
|
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 => {
|
returns => {
|
||||||
@ -4897,6 +4903,10 @@ __PACKAGE__->register_method({
|
|||||||
my $realcmd = sub {
|
my $realcmd = sub {
|
||||||
PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname");
|
PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname");
|
||||||
PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
|
PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
|
||||||
|
|
||||||
|
if ($param->{start}) {
|
||||||
|
PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
my $worker = sub {
|
my $worker = sub {
|
||||||
|
Loading…
Reference in New Issue
Block a user