summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-07-31 15:40:01 +0200
committerHans de Goede <hdegoede@redhat.com>2009-08-04 10:56:32 +0200
commitada34f6073bc907e689399a494cf8886a246b12a (patch)
treebc649dfad4fb353ba47f4d7cb68a25ab410b326b
parentc1a80ff250bb02c5a83a6be68e4c406425178ec1 (diff)
downloadanaconda-ada34f6073bc907e689399a494cf8886a246b12a.tar.gz
anaconda-ada34f6073bc907e689399a494cf8886a246b12a.tar.xz
anaconda-ada34f6073bc907e689399a494cf8886a246b12a.zip
Add functions to go from an iScsiDiskDevice to an libiscsi node
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
-rw-r--r--storage/iscsi.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/storage/iscsi.py b/storage/iscsi.py
index cfe0c55d3..13ddc082e 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