[PATCH master 02/13] Activate all devices set by kickstart network --activate command

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

 



Port from rhel6-branch.
Resolves: rhbz#638131
---
 loader/kickstart.c |   21 +++++++++++++++------
 loader/net.c       |   27 +++++++++------------------
 loader/net.h       |    2 ++
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 06804f8..6e2fea5 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -748,6 +748,9 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
                 loaderData->netDev = strdup(device);
 
             loaderData->netDev_set = 1;
+            logMessage(INFO, "kickstart network command - device %s", loaderData->netDev);
+        } else {
+            logMessage(INFO, "kickstart network command - unspecified device");
         }
 
         Py_XDECREF(attr);
@@ -801,12 +804,18 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
 
     Py_XDECREF(noksdev);
 
-    /* Make sure the network is always up if there's a network line in the
-     * kickstart file, as %post/%pre scripts might require that.
-     */
-    if (loaderData->method != METHOD_NFS && loaderData->method != METHOD_URL) {
-        if (kickstartNetworkUp(loaderData, &iface))
-            logMessage(ERROR, "unable to bring up network");
+    if (!is_nm_connected()) {
+        logMessage(INFO, "activating because no network connection is available");
+        activateDevice(loaderData, &iface);
+        return;
+    }
+
+    attr = getObject(ele, "activate", 0);
+    if (isTrue(attr)) {
+        logMessage(INFO, "activating because --activate flag is set");
+        activateDevice(loaderData, &iface);
+    } else {
+        logMessage(INFO, "not activating becuase --activate flag is not set");
     }
 
 cleanup:
diff --git a/loader/net.c b/loader/net.c
index 22ed892..9829898 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1887,7 +1887,6 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
  * kickstart install so that we can do things like grab the ks.cfg from
  * the network */
 int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
-    int rc, err;
 
     if ((is_nm_connected() == TRUE) &&
         (loaderData->netDev != NULL) && (loaderData->netDev_set == 1))
@@ -1895,6 +1894,13 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
 
     memset(iface, 0, sizeof(*iface));
 
+    return activateDevice(loaderData, iface);
+
+}
+
+int activateDevice(struct loaderData_s * loaderData, iface_t * iface) {
+    int rc;
+
     do {
         do {
             /* this is smart and does the right thing based on whether or not
@@ -1930,12 +1936,13 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
                            loaderData->method);
 
         if (rc == LOADER_ERROR) {
-            logMessage(ERROR, "unable to setup networking");
+            logMessage(ERROR, "unable to activate device %s", iface->device);
             return -1;
         } else if (rc == LOADER_BACK) {
             /* Going back to the interface selection screen, so unset anything
              * we set before attempting to bring the incorrect interface up.
              */
+            logMessage(ERROR, "unable to activate device %s", iface->device);
             if ((rc = writeDisabledNetInfo()) != 0) {
                 logMessage(ERROR, "writeDisabledNetInfo failure (%s): %d",
                            __func__, rc);
@@ -1951,22 +1958,6 @@ int kickstartNetworkUp(struct loaderData_s * loaderData, iface_t * iface) {
         } else {
             break;
         }
-
-        err = writeEnabledNetInfo(iface);
-        if (err) {
-            logMessage(ERROR,
-                       "failed to write %s data for %s (%d)",
-                       SYSCONFIG_PATH, iface->device, err);
-            return -1;
-        }
-
-        err = get_connection(iface);
-        newtPopWindow();
-
-        if (err) {
-            logMessage(ERROR, "failed to start NetworkManager (%d)", err);
-            return -1;
-        }
     } while (1);
 
     return 0;
diff --git a/loader/net.h b/loader/net.h
index 96c1ffb..690d644 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -71,6 +71,8 @@ void setupIfaceStruct(iface_t * iface, struct loaderData_s * loaderData);
 int setupWireless(iface_t * iface);
 int kickstartNetworkUp(struct loaderData_s * loaderData,
                        iface_t * iface);
+int activateDevice(struct loaderData_s * loaderData,
+                   iface_t * iface);
 void splitHostname (char *str, char **host, char **port);
 int get_connection(iface_t * iface);
 
-- 
1.7.2

_______________________________________________
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