コード例 #1
0
ファイル: iscsi.py プロジェクト: openSUSE/vdsm
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()
コード例 #2
0
ファイル: iscsi.py プロジェクト: vikas-lamba/vdsm
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()
コード例 #3
0
ファイル: iscsi.py プロジェクト: openSUSE/vdsm
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()
コード例 #4
0
ファイル: iscsi.py プロジェクト: vikas-lamba/vdsm
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()
コード例 #5
0
ファイル: iscsi.py プロジェクト: vikas-lamba/vdsm
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
コード例 #6
0
ファイル: iscsi.py プロジェクト: openSUSE/vdsm
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