Ejemplo n.º 1
0
def addiSCSIiface(initiator):
    """
    Create the iSCSI iface with the given initiator name.
    For the sake of simplicity the iface is created with the same name
    as an initiator. It makes the bookkeeping trivial.
    """
    cmd = ISCSIADM_IFACE + ["-o", "new", "-I", initiator]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()

    cmd = ISCSIADM_IFACE + ["-o", "update", "-I", initiator, "-n",
        "iface.initiatorname", "-v", initiator]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()
Ejemplo n.º 2
0
def remiSCSIiface(initiator):
    """
    Remove the iface with the given initiator name.
    """
    cmd = ISCSIADM_IFACE + ["-o", "delete", "-I", initiator]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()
Ejemplo n.º 3
0
def remiSCSIiface(initiator):
    """
    Remove the iface with the given initiator name.
    """
    cmd = ISCSIADM_IFACE + ["-o", "delete", "-I", initiator]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()
Ejemplo n.º 4
0
def addiSCSIiface(initiator):
    """
    Create the iSCSI iface with the given initiator name.
    For the sake of simplicity the iface is created with the same name
    as an initiator. It makes the bookkeeping trivial.
    """
    cmd = ISCSIADM_IFACE + ["-o", "new", "-I", initiator]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()

    cmd = ISCSIADM_IFACE + [
        "-o", "update", "-I", initiator, "-n", "iface.initiatorname", "-v",
        initiator
    ]
    rc, out, err = misc.execCmd(cmd)
    if rc != 0:
        raise se.iSCSIifaceError()
Ejemplo n.º 5
0
def getiSCSIifaces():
    """
    Collect the dictionary of all the existing iSCSI ifaces
    (including the default and hw/fw)
    """
    rc, out, err = misc.execCmd(ISCSIADM_IFACE)
    if rc != 0:
        raise se.iSCSIifaceError()
    ifaces = dict()
    for i in out:
        iface, params = i.split()
        params = params.split(',')
        ifaces[iface] = params

    return ifaces
Ejemplo n.º 6
0
def getiSCSIifaces():
    """
    Collect the dictionary of all the existing iSCSI ifaces
    (including the default and hw/fw)
    """
    rc, out, err = misc.execCmd(ISCSIADM_IFACE)
    if rc != 0:
        raise se.iSCSIifaceError()
    ifaces = dict()
    for i in out:
        iface, params = i.split()
        params = params.split(',')
        ifaces[iface] = params

    return ifaces