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

[master 8/9] iscsi: call iscsi.stabilize() at the end of the iscsi configuration.



Includes making stabilize() a method of the iscsi class so as long as we
hold an iscsi object we don't have to import the module.
---
 pyanaconda/partIntfHelpers.py |    6 +++++-
 pyanaconda/storage/iscsi.py   |   28 ++++++++++++++--------------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/pyanaconda/partIntfHelpers.py b/pyanaconda/partIntfHelpers.py
index 6109caf..2c66ab3 100644
--- a/pyanaconda/partIntfHelpers.py
+++ b/pyanaconda/partIntfHelpers.py
@@ -444,6 +444,7 @@ def drive_iscsi_addition(anaconda, wizard):
     STEP_NODES     = 1
     STEP_LOGIN     = 2
     STEP_SUMMARY   = 3
+    STEP_STABILIZE = 4
     STEP_DONE      = 10
 
     login_ok_nodes = []
@@ -499,11 +500,14 @@ def drive_iscsi_addition(anaconda, wizard):
                                                    login_fail_nodes,
                                                    login_fail_msg)
                 if rc:
-                    step = STEP_DONE
+                    step = STEP_STABILIZE
                 else:
                     # user wants to try logging into the failed nodes again
                     found_nodes = login_fail_nodes
                     step = STEP_NODES
+            elif step == STEP_STABILIZE:
+                anaconda.storage.iscsi.stabilize(anaconda.intf)
+                step = STEP_DONE
 
         except (network.IPMissing, network.IPError) as msg:
             log.info("addIscsiDrive() cancelled due to an invalid IP address.")
diff --git a/pyanaconda/storage/iscsi.py b/pyanaconda/storage/iscsi.py
index 0084b0c..59d9008 100644
--- a/pyanaconda/storage/iscsi.py
+++ b/pyanaconda/storage/iscsi.py
@@ -77,18 +77,6 @@ def randomIname():
         s += dig[random.randrange(0, 32)]
     return s
 
-def stabilize(intf = None):
-    # Wait for udev to create the devices for the just added disks
-    if intf:
-        w = intf.waitWindow(_("Scanning iSCSI nodes"),
-                            _("Scanning iSCSI nodes"))
-    # It is possible when we get here the events for the new devices
-    # are not send yet, so sleep to make sure the events are fired
-    time.sleep(2)
-    udev_settle()
-    if intf:
-        w.pop()
-
 class iscsi(object):
     """ iSCSI utility class.
 
@@ -160,7 +148,19 @@ class iscsi(object):
                           (node.name, str(e)))
                 pass
 
-        stabilize(intf)
+        self.stabilize(intf)
+
+    def stabilize(self, intf = None):
+        # Wait for udev to create the devices for the just added disks
+        if intf:
+            w = intf.waitWindow(_("Scanning iSCSI nodes"),
+                                _("Scanning iSCSI nodes"))
+        # It is possible when we get here the events for the new devices
+        # are not send yet, so sleep to make sure the events are fired
+        time.sleep(2)
+        udev_settle()
+        if intf:
+            w.pop()
 
     def startup(self, intf = None):
         if self.started:
@@ -327,7 +327,7 @@ class iscsi(object):
         if logged_in == 0:
             raise IOError, _("Could not log in to any of the discovered nodes")
 
-        stabilize(intf)
+        self.stabilize(intf)
 
     def writeKS(self, f):
         if not self.initiatorSet:
-- 
1.7.1.1


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