[pve-devel] [PATCH qemu-server v2 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of VM

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 12 16:15:08 CEST 2022


Am 12/09/2022 um 14:00 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
> ---
>  PVE/API2/Qemu.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index d9ef201..8bdda11 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -4745,6 +4745,11 @@ __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 => {
> +		optional => 1,
> +		type => 'string',
> +		description => "whether the container should get restarted afterwards",

same as for cotainer: fix type, add default improve description, but please
also with s/container/VM/ here ;-)

> +	    },
>  	},
>      },
>      returns => {
> @@ -4764,9 +4769,16 @@ __PACKAGE__->register_method({
>  
>  	my $snapname = extract_param($param, 'snapname');
>  
> +	my $start = extract_param($param, 'start');

same as pve-container w.r.t. param extraction need

> +
>  	my $realcmd = sub {
>  	    PVE::Cluster::log_msg('info', $authuser, "rollback snapshot VM $vmid: $snapname");
>  	    PVE::QemuConfig->snapshot_rollback($vmid, $snapname);
> +
> +	    if ($start) {
> +		PVE::Cluster::log_msg('info', $authuser, "start VM $vmid");

same as my comment for the pve-container w.r.t adding a cluster log here:
iff, separate patch and done centrally, but we can omit that completely
for now too,

> +		PVE::API2::Qemu->vm_start({ vmid => $vmid, node => $node });
> +	    }
>  	};
>  
>  	my $worker = sub {






More information about the pve-devel mailing list