DRMGR-HOOKS(8)
π NAME π
drmgr-hooks β the actual hooks that drmgr runs, and yes bestie they're iconic β¨
okay so this is drmgr-hooks, section 8 of the Linux on Power Service Tools manual, and it's literally the whole tea on how these hook scripts work. no cap.
πΈ DESCRIPTION πΈ
so when drmgr gets run to do PowerVM Dynamic Logical Partitioning (DLPAR) operations, a whole set of hooks can be triggered to validate the incoming operation and/or just be aware it's happening. it's giving backstage pass energy π«
not every DLPAR operation gets hook calls though β currently only the LPAR Migration operation (LPM) is concerned. lowkey exclusive.
the hooks are executable files stored in a directory named "DRC TYPE" in /etc/drmgr.d/. for instance, hooks run when a LPAR migration is done are stored in /etc/drmgr.d/pmig. so the folder name is literally the DRC type, iykyk.
hook files can be symbolic links to executable files. all the hooks can be stored in /etc/drmgr.d and linked into multiple directories to provide multiple DRC type's hooks. so you can reuse one script across multiple DRC types β efficiency queen π
π ARGUMENTS π
hooks are called without any arguments but with these environment variables set. no positional args, just vibes and env vars:
DRC_TYPEβ the Dynamic reconfiguration connector type to act upon from the following list:pmig,pci,cpu,mem,port,slot,phb. so it's telling you which flavor of DRC you're dealing with.PHASEβ the phase of the operation from the following list:check,undocheck,pre,post. which part of the whole production we're in.ACTIONβ the action in progress from the following list:add,remove,migrate. what's actually going down.DRC_COUNTβ the number of impacted items. simple math, bestie.
π¦ LPAR MIGRATION π¦
when a LPAR migration is initiated the check phase is first triggered. hooks called at check phase may returned a non zero value to prevent the migration operation to happen. and the error messages displayed in STDOUT or STDERR would be reported to the end user through the HMC. so if you're gonna block it, say why β the HMC is gonna spill the tea to the user π
if the check phase has failed, because at least one hook has returned a non null value, the undocheck phase is launched. return value for the undocheck phase is ignored. so undocheck is just cleanup mode, don't stress about what it returns.
if the check phase succeeded, the pre and later post phases are triggered. returned values for these 2 phases are ignored, and the post phase is triggered even if the LPM operation has failed. so post always shows up to the party, even if the party flopped π
the ACTION variable is set always to migrate β no surprises there.
the DRC_COUNT variable is set to 0. literally zero, every time, periodt.
π§ CPU π§
when a CPU DLPAR add or remove operation is initiated, the pre and then post phases are triggered with the ACTION variable set to either add or remove value. so it's telling you the direction of the CPU reconfig.
when the pre phase is called, the DRC_COUNT variable contains the desired number of CPU to add or remove. when the post phase is called, DRC_COUNT contains the number of CPU effectively added or removed. so pre is the dream, post is the reality check β¨
return values for these 2 phases are ignored. they're just informational, not gatekeepers.
the post phase is triggered even if the operation has failed. again, post shows up regardless. reliable icon.
π ENVIRONMENT π
the drmgr's hooks are called while holding the DLPAR lock, so any other DLPAR operation initiated from a hook is expected to fail. so like, don't try to start another DLPAR from inside a hook β the lock says no bestie π
the hooks standard input STDIN is redirected to /dev/null while STDOUT and STDERR are redirected to pipes. the outputs done in these pipes are reported to the end user when a hook has returned an error value and that error value is not ignored (e.g in the LPM, the check phase but not the pre or post phase). so your output only gets shown when it actually matters, which is honestly a vibe.
except the variables specified in the ARGUMENTS section, all the environment variables are unset before calling the hook. so your hook starts fresh with a clean slate β no leftover env var chaos. π§Ό
π FILES π
/etc/drmgr.d/pmig//etc/drmgr.d/cpu/
π AUTHOR π
Laurent Dufour <ldufour@linux.ibm.com> β the real MVP of this whole thing, no cap π«Ά
π SEE ALSO π
drmgr(8) β go read that one too, bestie, it's the main character here.
and that's the whole page π this was DRMGR-HOOKS(8) from the Linux manual, dated May 24, 2022 β mwah, go slay your DLPAR operations β¨π
π¦ where this page comes from
- opensuse-leap 16.0: powerpc-utils 1.3.14-160000.2.1 Β· GPL-2.0-or-later
- Copyright (C) 2022 International Business Machines
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms