diff options
author | Hans de Goede <hdegoede@redhat.com> | 2009-07-31 15:40:01 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2009-08-04 10:56:32 +0200 |
commit | ada34f6073bc907e689399a494cf8886a246b12a (patch) | |
tree | bc649dfad4fb353ba47f4d7cb68a25ab410b326b | |
parent | c1a80ff250bb02c5a83a6be68e4c406425178ec1 (diff) | |
download | anaconda-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.py | 30 |
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 |