[PATCH 1/8] Add functions to go from an iScsiDiskDevice to an libiscsi node

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

 



Add functions to go from an iScsiDiskDevice to an libiscsi node and the other
way around. This is a preparation patch for adding support for writing
the necessary dracut cmdline options to grub.conf
---
 storage/iscsi.py |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/storage/iscsi.py b/storage/iscsi.py
index cfe0c55..13ddc08 100644
--- a/storage/iscsi.py
+++ b/storage/iscsi.py
@@ -268,13 +268,10 @@ class iscsi(object):
                 # devices used for root get started by the initrd
                 if root.dependsOn(disk):
                     continue
-                # find the iscsi node matching this disk
-                for node in self.nodes:
-                    if node.name    == disk.iscsi_name and \
-                       node.address == disk.iscsi_address and \
-                       node.port    == disk.iscsi_port:
-                        node.setParameter("node.startup", "automatic")
-                        break
+
+                node = self.getNode(disk.iscsi_name, disk.iscsi_address, disk.iscsi_port)
+                if node:
+                    node.setParameter("node.startup", "automatic")
 
             if not os.path.isdir(instPath + "/etc/iscsi"):
                 os.makedirs(instPath + "/etc/iscsi", 0755)
@@ -289,4 +286,23 @@ class iscsi(object):
                 shutil.copytree("/var/lib/iscsi", instPath + "/var/lib/iscsi",
                                 symlinks=True)
 
+    def getNode(self, name, address, port):
+        for node in self.nodes:
+            if node.name == name and node.address == address and \
+               node.port == port:
+                return node
+
+        return None
+
+    def getNodeDisks(self, node, storage):
+        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:
+                nodeDisks.append(disk)
+
+        return nodeDisks
+
 # vim:tw=78:ts=4:et:sw=4
-- 
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