From 2a6e841778c7b75fa09e8396d0ad9777b0a6c0e0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 17 Mar 2009 16:34:06 +0100 Subject: Get iscsi going with the new storage code This patch gets iscsi going with the new storage code. There are still a few hicups left (such as NetworkManager downing the interface our / is on), but I'll address those in separate patches. --- storage/udev.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'storage/udev.py') diff --git a/storage/udev.py b/storage/udev.py index 1263823ab..a6d3190cb 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -304,3 +304,33 @@ def udev_device_is_dmraid_partition(info, devicetree): return True return False + +# iscsi disks have ID_PATH in the form of: +# ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${lun} +def udev_device_is_iscsi(info): + try: + path_components = info["ID_PATH"].split("-") + + if info["ID_BUS"] == "scsi" and len(path_components) >= 6 and \ + path_components[0] == "ip" and path_components[2] == "iscsi": + return True + except KeyError: + pass + + return False + +def udev_device_get_iscsi_name(info): + path_components = info["ID_PATH"].split("-") + + # Tricky, the name itself contains atleast 1 - char + return "-".join(path_components[3:len(path_components)-2]) + +def udev_device_get_iscsi_address(info): + path_components = info["ID_PATH"].split("-") + + return path_components[1].split(":")[0] + +def udev_device_get_iscsi_port(info): + path_components = info["ID_PATH"].split("-") + + return path_components[1].split(":")[1] -- cgit