[PATCH rhel7-alpha 1/2] 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 - commit 4acfadedb038744e6b47af74fe584188f82e44aa.
---
 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 69f1e4e..4a70f6c 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2187,10 +2187,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