[PATCH f16-branch] Start NM in loader on s390 until we have systemd init here too (#733680)

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

 



This is exactly how we used to do it before systemd took over
starting NM for anaconda which was fixed in f16 alpha with
commit 4acfadedb038744e6b47af74fe584188f82e44aa (bug 727951).

So this patch updates the change so that efforts of
http://fedoraproject.org/wiki/Architectures/s390x are not blocked
before we achieve http://fedoraproject.org/wiki/Anaconda/Features/RemoveLinuxrcS390.

It is safe, I'm going to propose it as F16Beta NTH.

---
 loader/loader.c         |    6 ++++++
 pyanaconda/isys/iface.c |   38 ++++++++++++++++++++++++++++++++++++++
 pyanaconda/isys/iface.h |    5 +++++
 3 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 2c5eb51..b3048cb 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2177,10 +2177,16 @@ int main(int argc, char ** argv) {
     }
 #endif
 
+#if defined(__s390__) || defined(__s390x__)
+    /* Start NetworkManager until we have systemd init on s390 too */
+    if (iface_start_NetworkManager())
+        logMessage(INFO, "failed to start NetworkManager");
+#else
     /* Restart NetworkManager now so that it uses our inital ifcfg config */
     logMessage(INFO, "restarting NetworkManager");
     if (iface_restart_NetworkManager())
         logMessage(ERROR, "failed to restart NetworkManager");
+#endif
 
     if (!FL_CMDLINE(flags))
         startNewt();
diff --git a/pyanaconda/isys/iface.c b/pyanaconda/isys/iface.c
index 8ef4708..7d11600 100644
--- a/pyanaconda/isys/iface.c
+++ b/pyanaconda/isys/iface.c
@@ -539,6 +539,44 @@ int iface_restart_NetworkManager(void) {
 }
 
 /*
+ * Start NetworkManager -- requires that you have already written out the
+ * control files in /etc/sysconfig for the interface.
+ * This is needed on s390 until we have systemd init doing it as for other archs.
+ */
+int iface_start_NetworkManager(void) {
+    pid_t pid;
+
+    if (is_nm_running())
+        return 0;  /* already running */
+
+    /* Start NetworkManager */
+    pid = fork();
+    if (pid == 0) {
+        if (setpgrp() == -1) {
+            exit(1);
+        }
+
+        if (_iface_redirect_io("/dev/null", STDIN_FILENO, O_RDONLY) ||
+            _iface_redirect_io(OUTPUT_TERMINAL, STDOUT_FILENO, O_WRONLY) ||
+            _iface_redirect_io(OUTPUT_TERMINAL, STDERR_FILENO, O_WRONLY)) {
+            exit(2);
+        }
+
+        if (execl(NETWORKMANAGER, NETWORKMANAGER,
+                  "--pid-file=/var/run/NetworkManager/NetworkManager.pid",
+                  NULL) == -1) {
+            exit(3);
+        }
+    } else if (pid == -1) {
+        return 1;
+    } else {
+        return wait_for_nm();
+    }
+
+    return 0;
+}
+
+/*
  * Set the MTU on the specified device.
  */
 int iface_set_interface_mtu(char *ifname, int mtu) {
diff --git a/pyanaconda/isys/iface.h b/pyanaconda/isys/iface.h
index a386865..77e66ed 100644
--- a/pyanaconda/isys/iface.h
+++ b/pyanaconda/isys/iface.h
@@ -156,6 +156,11 @@ gboolean is_nm_connected(void);
 gboolean is_iface_activated(char * ifname);
 
 /*
+ * Start NetworkManager
+ */
+int iface_start_NetworkManager(void);
+
+/*
  * Restart NetworkManager
  */
 int iface_restart_NetworkManager(void);
-- 
1.7.4

_______________________________________________
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