From: Stefan Hanreich <s.hanreich@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH-SERIES guest-common/docs v3] add pre/post/failed snapshot hooks
Date: Mon, 23 Jan 2023 17:07:32 +0100 [thread overview]
Message-ID: <0256b6e0-d641-fbe8-c12e-df5a9c95e89e@proxmox.com> (raw)
In-Reply-To: <20230123155847.598536-1-s.hanreich@proxmox.com>
On 1/23/23 16:58, Stefan Hanreich wrote:
> This patch series introduces the pre/post/failed-snapshot hooks that run before/
> after a snapshot is taken, or after failing to take a snapshot.
>
> I used the new example script from pve-docs as template for my test hookscripts.
>
> What I tested:
> * Normal snapshotting, without VM state, without hookscript
> * snapshot works, no hooks executed
> * Normal snapshotting, with VM state, without hookscript
> * snapshot works, no hooks executed
> * Normal snapshotting, without VM state, with hookscript
> * snapshot works, pre/post hooks work
> * Normal snapshotting, with VM state, with hookscript
> * snapshot works, pre/post hooks work
> * Taking snapshot with existing name, with hookscript
> * fails, no hookscripts get executed
> * Failed at wrong storage config, with hookscript
> * pre/failed get executed, lock gets released
> * Failed at taking RAM Snapshot (simulated with monkey-patched die), with hookscript
> * pre/failed get executed, lock gets released
> * pre/post hookscript that detaches/attaches unsnapshottable disk (without --skiplock)
> * snapshotting fails, attach/detach fails, pre/failed get executed, lock released
> * pre/post hookscript that detaches/attaches unsnapshottable disk (with --skiplock)
> * snapshotting works, attach/detach works, pre/post get executed
> * restoring works, detached disk is detached after restoring
> * pre-snapshot hookscript exits with code > 0
> * pre/failed-snapshot get executed, snapshot fails, lock gets released
> * post-snapshot hookscript exits with code > 0
> * pre/post/failed-snapshot get executed, snapshot fails, lock gets released
> * Taking snapshot of template
> * fails, no hookscripts get executed
> * execute commands in VM in pre/post via qm guest exec
> * snapshot succeeds, commands get executed, pre/post executed
>
> Changes from v2 (thanks fabian!):
> * added guards, so cfs_update() only gets called when necessary
> * added PVE_SNAPSHOT_PHASE envvar to failed-snapshot as indicator
> when the failure occured
>
> Changes from v1:
> * added failed-snapshot hook that runs after a failed snapshot
> * this enables users to revert any changes made in pre-snapshot hooks
> in case of errors
> * running cfs_update() after every hookscript invocation
> * adjusted the call sites of exec_hookscript()
> * particularly interesting for pre-snapshot since some checks now run
> before the hook runs
> * VM/CT config is now locked during hookscript execution
>
> Thanks to Fiona and Fabian for their valuable input/help!
>
> pve-guest-common:
>
flipped this heading with pve-docs
> Stefan Hanreich (1):
> examples: add pre/post/failed-snapshot hooks to example hookscript
>
> examples/guest-example-hookscript.pl | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
>
> pve-docs:
^ see above
>
> Stefan Hanreich (1):
> partial fix #2530: snapshots: add pre/post/failed-snapshot hooks
>
> src/PVE/AbstractConfig.pm | 76 +++++++++++++++++++++++++++++++++++----
> 1 file changed, 70 insertions(+), 6 deletions(-)
>
prev parent reply other threads:[~2023-01-23 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 15:58 Stefan Hanreich
2023-01-23 15:58 ` [pve-devel] [PATCH pve-docs v3 1/1] examples: add pre/post/failed-snapshot hooks to example hookscript Stefan Hanreich
2023-01-23 15:58 ` [pve-devel] [PATCH pve-guest-common v3 1/1] partial fix #2530: snapshots: add pre/post/failed-snapshot hooks Stefan Hanreich
2023-01-23 16:07 ` Stefan Hanreich [this message]
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=0256b6e0-d641-fbe8-c12e-df5a9c95e89e@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal