public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Hanreich <s.hanreich@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-container v2 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of CT
Date: Mon, 12 Sep 2022 16:12:34 +0200	[thread overview]
Message-ID: <b52faf6a-270c-9c30-d816-b2b7ccb6b076@proxmox.com> (raw)
In-Reply-To: <20220912120008.1220711-2-s.hanreich@proxmox.com>

Am 12/09/2022 um 14:00 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
>  src/PVE/API2/LXC/Snapshot.pm | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/PVE/API2/LXC/Snapshot.pm b/src/PVE/API2/LXC/Snapshot.pm
> index 4be16ad..62adaee 100644
> --- a/src/PVE/API2/LXC/Snapshot.pm
> +++ b/src/PVE/API2/LXC/Snapshot.pm
> @@ -272,6 +272,11 @@ __PACKAGE__->register_method({
>  	    node => get_standard_option('pve-node'),
>  	    vmid => get_standard_option('pve-vmid'),
>  	    snapname => get_standard_option('pve-snapshot-name'),
> +	    start => {
> +		optional => 1,
> +		type => 'string',

why is this a string and not a 'boolean'? We normally also document the default
in the schema through, well, the default => X key.

> +		description => "whether the container should get restarted afterwards",

Please try to use somewhat full sentences, that can stand alone and avoids question
like "afterward what?", e.g.:

"Whether the container should get started after rolling back successfully"

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

do you need to extract (i.e., delete from $param hash) the parameter?
Otherwise just use $param->{start} directly below.

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

why produce a cluster log here? The vm_start already does a syslog and if
we'd like to get a cluster log too (or instead of that) it would be an independent
patch and done in PVE::API2::LXC::Status's vm_start code (not that I see much need
for that)

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





  reply	other threads:[~2022-09-12 14:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 12:00 [pve-devel] [PATCH manager/qemu-server/pve-container v2] Add checkbox for automatic restart of CT/VM after rollback Stefan Hanreich
2022-09-12 12:00 ` [pve-devel] [PATCH pve-container v2 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of CT Stefan Hanreich
2022-09-12 14:12   ` Thomas Lamprecht [this message]
2022-09-12 12:00 ` [pve-devel] [PATCH qemu-server v2 1/1] fix #4228: add start parameter to rollback endpoint for automatic restarting of VM Stefan Hanreich
2022-09-12 14:15   ` Thomas Lamprecht
2022-09-12 12:00 ` [pve-devel] [PATCH manager v2 1/1] fix #4228: ui: Add checkbox to rollback dialog for automatically restarting VM/CT Stefan Hanreich
2022-09-12 14:36   ` Thomas Lamprecht

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=b52faf6a-270c-9c30-d816-b2b7ccb6b076@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@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