[PATCH 4/8] Store iscsi node pointer in iScsiDiskDevice objects

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

 



This is a preparation patch for adding support for writing
the necessary dracut cmndline options to grub.conf
---
 storage/__init__.py   |    6 ++++--
 storage/devices.py    |    8 +++-----
 storage/devicetree.py |   10 ++++++----
 storage/iscsi.py      |    4 +---
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 348a155..094c079 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -222,7 +222,8 @@ class Storage(object):
                                      protected=self.protectedDevSpecs,
                                      zeroMbr=self.zeroMbr,
                                      passphrase=self.encryptionPassphrase,
-                                     luksDict=self.__luksDevs)
+                                     luksDict=self.__luksDevs,
+                                     iscsi=self.iscsi)
         self.fsset = FSSet(self.devicetree)
 
     def doIt(self):
@@ -287,7 +288,8 @@ class Storage(object):
                                      protected=self.protectedDevSpecs,
                                      zeroMbr=self.zeroMbr,
                                      passphrase=self.encryptionPassphrase,
-                                     luksDict=self.__luksDevs)
+                                     luksDict=self.__luksDevs,
+                                     iscsi=self.iscsi)
         self.devicetree.populate()
         self.fsset = FSSet(self.devicetree)
         self.anaconda.id.rootParts = None
diff --git a/storage/devices.py b/storage/devices.py
index 8658e4f..ac1bbda 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2931,12 +2931,10 @@ class iScsiDiskDevice(DiskDevice, NetworkStorageDevice):
     _packages = ["iscsi-initiator-utils"]
 
     def __init__(self, device, **kwargs):
-        self.iscsi_name    = kwargs.pop("iscsi_name")
-        self.iscsi_address = kwargs.pop("iscsi_address")
-        self.iscsi_port    = int(kwargs.pop("iscsi_port"))
+        self.node = kwargs.pop("node")
         DiskDevice.__init__(self, device, **kwargs)
-        NetworkStorageDevice.__init__(self, host_address=self.iscsi_address)
-        log.debug("created new iscsi disk %s %s:%d" % (self.iscsi_name, self.iscsi_address, self.iscsi_port))
+        NetworkStorageDevice.__init__(self, host_address=self.node.address)
+        log.debug("created new iscsi disk %s %s:%d" % (self.node.name, self.node.address, self.node.port))
 
 
 class FcoeDiskDevice(DiskDevice, NetworkStorageDevice):
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 71d7a48..b4634d9 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -203,7 +203,7 @@ class DeviceTree(object):
 
     def __init__(self, intf=None, ignored=[], exclusive=[], type=CLEARPART_TYPE_NONE,
                  clear=[], zeroMbr=None, reinitializeDisks=None, protected=[],
-                 passphrase=None, luksDict=None):
+                 passphrase=None, luksDict=None, iscsi=None):
         # internal data members
         self._devices = []
         self._actions = []
@@ -217,6 +217,7 @@ class DeviceTree(object):
         self.clearPartDisks = clear
         self.zeroMbr = zeroMbr
         self.reinitializeDisks = reinitializeDisks
+        self.iscsi = iscsi
 
         # protected device specs as provided by the user
         self.protectedDevSpecs = protected
@@ -1105,9 +1106,10 @@ class DeviceTree(object):
         kwargs = {}
         if udev_device_is_iscsi(info):
             diskType = iScsiDiskDevice
-            kwargs["iscsi_name"]    = udev_device_get_iscsi_name(info)
-            kwargs["iscsi_address"] = udev_device_get_iscsi_address(info)
-            kwargs["iscsi_port"]    = udev_device_get_iscsi_port(info)
+            kwargs["node"] = self.iscsi.getNode(
+                                   udev_device_get_iscsi_name(info),
+                                   udev_device_get_iscsi_address(info),
+                                   udev_device_get_iscsi_port(info))
             log.debug("%s is an iscsi disk" % name)
         elif udev_device_is_fcoe(info):
             diskType = FcoeDiskDevice
diff --git a/storage/iscsi.py b/storage/iscsi.py
index 51b0eb8..7c2dc36 100644
--- a/storage/iscsi.py
+++ b/storage/iscsi.py
@@ -299,9 +299,7 @@ class iscsi(object):
         nodeDisks = []
         iscsiDisks = storage.devicetree.getDevicesByType("iscsi")
         for disk in iscsiDisks:
-            if node.name    == disk.iscsi_name and \
-               node.address == disk.iscsi_address and \
-               node.port    == disk.iscsi_port:
+            if disk.node == node:
                 nodeDisks.append(disk)
 
         return nodeDisks
-- 
1.6.2.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