94 lines
2.8 KiB
Diff
94 lines
2.8 KiB
Diff
commit d0bc79aedaf76eff09a5d1f399da09561a4d4d7d
|
|
Author: Laurent Dufour <ldufour@linux.ibm.com>
|
|
Date: Fri Sep 16 18:39:17 2022 +0200
|
|
|
|
drmgr: introducing the LPM hooks
|
|
|
|
There are 3 hooks run when an LPM is performed:
|
|
1. check before the LPM is really initiated
|
|
1 bis. undocheck if check failed.
|
|
2. pre just before entering the switch over
|
|
3. post at the end of the LPM operation
|
|
|
|
Only the check hook's return status is taken in account. If the check hook
|
|
return value is different from 0, the LPM is aborted and the outputs of the
|
|
check hook are reported to the end user through the HMC.
|
|
|
|
In the case at least one check hook returned a non zero status, the
|
|
undocheck event is run (for all the hooks), and the pre and post events are
|
|
not triggered.
|
|
|
|
The post event is triggered even if the LPM operation has failed.
|
|
|
|
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
|
|
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
|
|
diff --git a/src/drmgr/drmig_chrp_pmig.c b/src/drmgr/drmig_chrp_pmig.c
|
|
index f78ff15..f169fa5 100644
|
|
--- a/src/drmgr/drmig_chrp_pmig.c
|
|
+++ b/src/drmgr/drmig_chrp_pmig.c
|
|
@@ -691,11 +691,15 @@ void post_mobility_update(void)
|
|
devtree_update();
|
|
}
|
|
}
|
|
-
|
|
+
|
|
int drmig_chrp_pmig(void)
|
|
{
|
|
int rc;
|
|
uint64_t stream_val;
|
|
+ enum drc_type drc_type = DRC_TYPE_NONE;
|
|
+
|
|
+ if (usr_action == MIGRATE)
|
|
+ drc_type = DRC_TYPE_MIGRATION;
|
|
|
|
/* Ensure that this partition is migratable/mobile */
|
|
if (! pmig_capable()) {
|
|
@@ -704,14 +708,11 @@ int drmig_chrp_pmig(void)
|
|
return -1;
|
|
}
|
|
|
|
- /* Today we do no pre-checks for migratability. The only check
|
|
- * we could do is whether the "ibm,suspend-me" RTAS call exists.
|
|
- * But if it doesn't, the firmware level doesn't support migration,
|
|
- * in which case why the heck are we being invoked anyways.
|
|
- */
|
|
- if (strcmp(usr_p_option, "check") == 0) {
|
|
- say(DEBUG, "check: Nothing to do...\n");
|
|
- return 0;
|
|
+ if (usr_action == MIGRATE && (strcmp(usr_p_option, "check") == 0)) {
|
|
+ rc = run_hooks(drc_type, HOOK_CHECK);
|
|
+ if (rc)
|
|
+ run_hooks(drc_type, HOOK_UNDOCHECK);
|
|
+ return rc;
|
|
}
|
|
|
|
/* The only other command is pre, any other command is invalid */
|
|
@@ -734,6 +735,9 @@ int drmig_chrp_pmig(void)
|
|
|
|
/* Now do the actual migration */
|
|
do {
|
|
+ if (usr_action == MIGRATE)
|
|
+ run_hooks(drc_type, HOOK_PRE);
|
|
+
|
|
if (usr_action == MIGRATE)
|
|
rc = do_migration(stream_val);
|
|
else if (usr_action == HIBERNATE)
|
|
@@ -748,10 +752,12 @@ int drmig_chrp_pmig(void)
|
|
|
|
syslog(LOG_LOCAL0 | LOG_INFO, "drmgr: %s rc %d\n",
|
|
(usr_action == MIGRATE ? "migration" : "hibernation"), rc);
|
|
- if (rc)
|
|
- return rc;
|
|
|
|
- post_mobility_update();
|
|
+ if (!rc)
|
|
+ post_mobility_update();
|
|
|
|
- return 0;
|
|
+ /* Post hook is called even if the migration has failed */
|
|
+ if (usr_action == MIGRATE)
|
|
+ run_hooks(drc_type, HOOK_POST);
|
|
+ return rc;
|
|
}
|