Re: [PATCH 2/2] Reintegrate reipl to trigger reboot/halt on s390x correctly. (#528380)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Because of 8bc669549ddcc7040a5ba56b8afafa18684bac4e and maybe others,
triggering reipl at the end of anaconda is no longer sufficient to be
hit in all different anaconda install paths. Therefore, move the triggering
right after having configured reipl in sysfs and do all in one place.
Now loader must no longer immediately relay SIGUSR1/2 to init,
since anaconda is not nearly finished with installation,
but only remember the state requested by anaconda. Only right before loader
terminates, it kills init with the remembered state to really reboot/halt.
---
 anaconda        |    8 --------
 iutil.py        |   17 +++++++++++++++++
 loader/loader.c |   11 +++++++++--
 packages.py     |    6 +-----
 4 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/anaconda b/anaconda
index be38973..d1d2ba2 100755
--- a/anaconda
+++ b/anaconda
@@ -1000,11 +1000,3 @@ if __name__ == "__main__":
             drive.eject()
 
     del anaconda.intf
-
-    if iutil.isS390():
-        if anaconda.canReIPL:
-            log.info(_("reipl configuration successful => reboot"))
-            os.kill(os.getppid(), signal.SIGUSR2)
-        else:
-            log.info(_("reipl configuration failed => halt"))
-            os.kill(os.getppid(), signal.SIGUSR1)
diff --git a/iutil.py b/iutil.py
index 5316dce..047fde4 100644
--- a/iutil.py
+++ b/iutil.py
@@ -966,6 +966,16 @@ def reIPLonFCP(iplsubdev, reipl_path):
     return None
 
 
+def reIPLtrigger(anaconda):
+    if not isS390():
+        return
+    if anaconda.canReIPL:
+        log.info("reipl configuration successful => reboot")
+        os.kill(os.getppid(), signal.SIGUSR2)
+    else:
+        log.info("reipl configuration failed => halt")
+        os.kill(os.getppid(), signal.SIGUSR1)
+
 def reIPL(anaconda, loader_pid):
     instruction = _("After shutdown, please perform a manual IPL from the device "
                     "now containing /boot to continue installation")
@@ -985,6 +995,13 @@ def reIPL(anaconda, loader_pid):
     elif ipldev.startswith("sd"):
         message = reIPLonFCP(ipldev, reipl_path)
 
+    if message is None:
+        anaconda.canReIPL = True
+    else:
+        anaconda.canReIPL = False
+
+    reIPLtrigger(anaconda)
+
     # the final return is either None if reipl configuration worked (=> reboot),
     # or a two-item list with errorMessage and rebootInstr (=> shutdown)
     return message
diff --git a/loader/loader.c b/loader/loader.c
index 69523cd..51f82a8 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -125,6 +125,7 @@ int num_link_checks = 5;
 int post_link_sleep = 0;
 
 static pid_t init_pid = 1;
+static int init_sig = SIGUSR1; /* default to shutdown=halt */
 
 static struct installMethod installMethods[] = {
     { N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage },
@@ -1735,8 +1736,8 @@ void loaderSegvHandler(int signum) {
 }
 
 void loaderUsrXHandler(int signum) {
-    logMessage(INFO, "Sending signal %d to process %d\n", signum, init_pid);
-    kill(init_pid, signum);
+    logMessage(INFO, "Remembering signal %d\n", signum);
+    init_sig = signum;
 }
 
 static int anaconda_trace_init(void) {
@@ -2314,6 +2315,12 @@ int main(int argc, char ** argv) {
         }
 
         stop_fw_loader(&loaderData);
+#if defined(__s390__) || defined(__s390x__)
+        /* at the latest possibility signal init=linuxrc.s390 to reboot/halt */
+        logMessage(INFO, "Sending signal %d to process %d\n",
+                   init_sig, init_pid);
+        kill(init_pid, init_sig);
+#endif
         return rc;
     }
 #if 0
diff --git a/packages.py b/packages.py
index 783d2ad..3d32a68 100644
--- a/packages.py
+++ b/packages.py
@@ -373,11 +373,7 @@ def doReIPL(anaconda):
 
     messageInfo = iutil.reIPL(anaconda, os.getppid())
 
-    if messageInfo is None:
-        anaconda.canReIPL = True
-    else:
-        anaconda.canReIPL = False
-
+    if messageInfo:
         (errorMessage, rebootInstr) = messageInfo
 
         # errorMessage intentionally not shown in UI
-- 
1.6.5


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux