示例#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