From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-container/qemu-server/pve-guest-common/pve-docs 0/1] Add pre/post-migrate hooks
Date: Tue, 27 Sep 2022 09:47:10 +0200 [thread overview]
Message-ID: <cebe50b7-ee9e-9e8c-4f1e-08a1cd79208c@proxmox.com> (raw)
In-Reply-To: <f28c7144-f956-68e8-4566-0c898bba7c71@proxmox.com>
Am 27/09/2022 um 09:40 schrieb Stefan Hanreich:
> On 9/26/22 17:51, Thomas Lamprecht wrote:
>> Am 22/09/2022 um 16:13 schrieb Stefan Hanreich:
>>> I have decided to create distinct event types for source/target nodes, since
>>> otherwise the same script would run essentially twice on the source/target node.
>>> With distinct event types, the hooks should be more flexible in their usage.
>>
>> just make that a parameter, same flexibility but less cmd explosion and
>> complexity.
>>
>> Also, _iff_ (see reply we keep the CLI entries for pct/qm it should just be
>> a single command there, any difference should be handled in the parameters;
>> it's internal after all and we want to avoid that there's more internal
>> commands then externals someday ;)
>>
>> Target and source should be part of the parameters on either call (pre/post,
>> src/target), it is relevant info and should be easily available. Some param
>> info like offline/online migration could be relevant too, but we can always
>> extend on that, so in that regard it can be fine to stop smaller, to avoid
>> going over board and having to keep all that info for backward compat. Any
>> parameter would need to be encoded in the example then.
>>
>
> This is also an option I explored. One thing that I wasn't sure about was
> where the scripts run then? Does the pre event run on the source node and the
> post event on the target node? Dominik made an interesting point, that it
> might actually be desirable the other way around since you might want to do
> some setup code in the pre-hook, which would be nice on the target node. It
> might also be nice to run some cleanup code on the post-event which would be
> more suited to running on the source node.
IMO they both need to run on both, that's the point of a migration hookscript
prepare source & target for leaving/incomming guest and then cleanup source &
target after the migration happened (failed or not).
>
> Do you think it would be smart to implement it as positional parameters to
> the script? Like 'qm pre-migrate <target> <source>' ? Since there are already
> ideas of adding additional contextual information, might it be smarter to
> expose all the additional info to the script in a dictionary? Not sure about
> this, but I could see us ending up with a situation where you have many
> additional variables only accessible by knowing their indexes. This has other
> downsides of course..
_if_ we stay with this approach I'd use as much non-positional params as
possible. This is an internal command so user facing UX doesn't matter, the
only thing that matters is having some flexibility for forward/backward
extendability/compat, and there fixed params are worse than none, iow. they
have no benefit for a internal, automatic called script.
>
>> Some more general note, the example is better than nothing, but a nice
>> list/table directly in the docs would be really good to have. This could be
>> done upfront, before adding new hooks - best for now to duplicate it for
>> both CT and VM chapter (if sensible it can live in its own
>> guest-hook-list.adoc and just get included twice). Including the example
>> script as an appendix would be a nice touch too.
>
> I looked at the documentation as well and found it a bit lacking, I thought
> it would be nice to overhaul this in an additional patch series, after all
> the hooks are merged. I figured it might be okay to silently add these
> features and document them afterwards in a subsequent patch. I will add a
> short documentation section for each hook to the documentation in the
> respective patches as well and then we can maybe overhaul/unify them
> afterwards.
IMO the status quo is best documented before extending it.
prev parent reply other threads:[~2022-09-27 7:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 14:13 Stefan Hanreich
2022-09-22 14:13 ` [pve-devel] [PATCH pve-guest-common 1/1] Add abstract methods for " Stefan Hanreich
2022-09-26 15:27 ` Thomas Lamprecht
2022-09-27 7:40 ` Stefan Hanreich
2022-09-27 8:05 ` Thomas Lamprecht
2022-09-22 14:13 ` [pve-devel] [PATCH pve-container 1/1] Add CT hooks for pre/post-migrate on target/source Stefan Hanreich
2022-09-22 14:13 ` [pve-devel] [PATCH pve-docs 1/1] Add pre/post-migrate events for target and source to example hookscript Stefan Hanreich
2022-09-22 14:13 ` [pve-devel] [PATCH qemu-server 1/1] Add VM hooks for pre/post-migrate on target/source Stefan Hanreich
2022-09-26 15:38 ` Thomas Lamprecht
2022-09-27 7:40 ` Stefan Hanreich
2022-09-26 15:51 ` [pve-devel] [PATCH pve-container/qemu-server/pve-guest-common/pve-docs 0/1] Add pre/post-migrate hooks Thomas Lamprecht
2022-09-27 7:40 ` Stefan Hanreich
2022-09-27 7:47 ` Thomas Lamprecht [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=cebe50b7-ee9e-9e8c-4f1e-08a1cd79208c@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 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