Пример #1
0
def activate():
    util.SMlog("MPATH: multipath activate called")
    # Adjust any HBAs on the host
    cmd = [hba_script, "enable"]
    util.SMlog(util.pread2(cmd))
    cmd = ['ln', '-sf', iscsi_mpath_file, iscsi_file]
    util.pread2(cmd)

    # If we've got no active sessions, and the deamon is already running,
    # we're ok to restart the daemon
    if iscsilib.is_iscsi_daemon_running():
        if not iscsilib._checkAnyTGT():
            iscsilib.restart_daemon()

    # Start the updatempppathd daemon
    if not _is_mpp_daemon_running():
        cmd = ["/etc/init.d/updatempppathd", "start"]
        util.pread2(cmd)

    if not _is_mpath_daemon_running():
        util.SMlog("Warning: multipath daemon not running.  Starting daemon!")
        cmd = ["/etc/init.d/multipathd", "start"]
        util.pread2(cmd)

    for i in range(0, 120):
        if mpath_cli.is_working():
            util.SMlog("MPATH: dm-multipath activated.")
            return
        time.sleep(1)

    util.SMlog("Failed to communicate with the multipath daemon!")
    raise xs_errors.XenError('MultipathdCommsFailure')
Пример #2
0
def deactivate():
    util.SMlog("MPATH: multipath deactivate called")
    cmd = ['ln', '-sf', iscsi_default_file, iscsi_file]
    if os.path.exists(iscsi_default_file):
        # Only do this if using our customized open-iscsi package
        util.pread2(cmd)

    # Stop the updatempppathd daemon
    if _is_mpp_daemon_running():
        cmd = ["service", "updatempppathd", "stop"]
        util.pread2(cmd)

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid, True)

    # Disable any active MPP LUN maps (except the root dev)
    systemroot = os.path.realpath(util.getrootdev())
    for dev in glob.glob(DEVBYMPPPATH + "/*"):
        if os.path.realpath(dev) != systemroot:
            sid = os.path.basename(dev).split('-')[0]
            reset(sid)
        else:
            util.SMlog("MPP: Found root dev node, not resetting")

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()

    util.SMlog("MPATH: multipath deactivated.")
Пример #3
0
def deactivate():
    util.SMlog("MPATH: multipath deactivate called")
    cmd = ['ln', '-sf', iscsi_default_file, iscsi_file]
    if os.path.exists(iscsi_default_file):
        # Only do this if using our customized open-iscsi package
        util.pread2(cmd)

    # Stop the updatempppathd daemon
    if _is_mpp_daemon_running():
        cmd = ["service", "updatempppathd", "stop"]
        util.pread2(cmd)

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid,True)
        
    # Disable any active MPP LUN maps (except the root dev)
    systemroot = os.path.realpath(util.getrootdev())
    for dev in glob.glob(DEVBYMPPPATH + "/*"):
        if os.path.realpath(dev) != systemroot:
            sid = os.path.basename(dev).split('-')[0]
            reset(sid)
        else:
            util.SMlog("MPP: Found root dev node, not resetting")

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()
        
    util.SMlog("MPATH: multipath deactivated.")
Пример #4
0
def deactivate():
    util.SMlog("MPATH: multipath deactivate called")
    # Adjust any HBAs on the host
    cmd = [hba_script, "disable"]
    util.SMlog(util.pread2(cmd))
    cmd = ['ln', '-sf', iscsi_default_file, iscsi_file]
    util.pread2(cmd)

    # Stop the updatempppathd daemon
    if _is_mpp_daemon_running():
        cmd = ["/etc/init.d/updatempppathd", "stop"]
        util.pread2(cmd)

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid, True)

    # Disable any active MPP LUN maps (except the root dev)
    systemroot = os.path.realpath(util.getrootdev())
    for dev in glob.glob(DEVBYMPPPATH + "/*"):
        if os.path.realpath(dev) != systemroot:
            sid = os.path.basename(dev).split('-')[0]
            reset(sid)
        else:
            util.SMlog("MPP: Found root dev node, not resetting")

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()

    util.SMlog("MPATH: multipath deactivated.")
Пример #5
0
def deactivate():
    util.SMlog("MPATH: multipath deactivate called")
    # Adjust any HBAs on the host
    cmd = [hba_script, "disable"]
    util.SMlog(util.pread2(cmd))
    cmd = ['ln', '-sf', iscsi_default_file, iscsi_file]
    util.pread2(cmd)

    # Stop the updatempppathd daemon
    if _is_mpp_daemon_running():
        cmd = ["/etc/init.d/updatempppathd", "stop"]
        util.pread2(cmd)

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid,True)
        
    # Disable any active MPP LUN maps (except the root dev)
    systemroot = os.path.realpath(util.getrootdev())
    for dev in glob.glob(DEVBYMPPPATH + "/*"):
        if os.path.realpath(dev) != systemroot:
            sid = os.path.basename(dev).split('-')[0]
            reset(sid)
        else:
            util.SMlog("MPP: Found root dev node, not resetting")

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()
        
    util.SMlog("MPATH: multipath deactivated.")
Пример #6
0
def activate():
    util.SMlog("MPATH: multipath activate called")
    # Adjust any HBAs on the host
    cmd = [hba_script, "enable"]
    util.SMlog(util.pread2(cmd))
    cmd = ['ln', '-sf', iscsi_mpath_file, iscsi_file]
    util.pread2(cmd)

    # If we've got no active sessions, and the deamon is already running,
    # we're ok to restart the daemon
    if iscsilib.is_iscsi_daemon_running():
        if not iscsilib._checkAnyTGT():
            iscsilib.restart_daemon()
        
    # Start the updatempppathd daemon
    if not _is_mpp_daemon_running():
        cmd = ["/etc/init.d/updatempppathd", "start"]
        util.pread2(cmd)

    if not _is_mpath_daemon_running():
        util.SMlog("Warning: multipath daemon not running.  Starting daemon!")
        cmd = ["/etc/init.d/multipathd", "start"]
        util.pread2(cmd)

    for i in range(0,120):
        if mpath_cli.is_working():
            util.SMlog("MPATH: dm-multipath activated.")
            return
        time.sleep(1)

    util.SMlog("Failed to communicate with the multipath daemon!")
    raise xs_errors.XenError('MultipathdCommsFailure')    
Пример #7
0
def deactivate():
    util.SMlog("MPATH: dm-multipath deactivate called")
    # Adjust any HBAs on the host
    if os.path.realpath(mpath_file) != mpath_disable_file:
        cmd = [hba_script, "disable"]
        util.SMlog(util.pread2(cmd))
    cmd = ['ln', '-sf', mpath_disable_file, mpath_file]
    util.pread2(cmd)
    cmd = ['ln', '-sf', iscsi_default_file, iscsi_file]
    util.pread2(cmd)

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid,True)
        
        # ...then stop the daemon
        cmd = ["/etc/init.d/multipathd", "stop"]
        util.pread2(cmd)

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()
        
    util.SMlog("MPATH: dm-multipath deactivated.")
Пример #8
0
def activate():
    util.SMlog("MPATH: multipath activate called")

    # If we've got no active sessions, and the deamon is already running,
    # we're ok to restart the daemon
    if iscsilib.is_iscsi_daemon_running():
        if not iscsilib._checkAnyTGT():
            iscsilib.restart_daemon()

    if not _is_mpath_daemon_running():
        util.SMlog("Warning: multipath daemon not running.  Starting daemon!")
        cmd = ["service", "multipathd", "start"]
        util.pread2(cmd)

    for i in range(0, 120):
        if mpath_cli.is_working():
            util.SMlog("MPATH: dm-multipath activated.")
            return
        time.sleep(1)

    util.SMlog("Failed to communicate with the multipath daemon!")
    raise xs_errors.XenError('MultipathdCommsFailure')
Пример #9
0
def deactivate():
    util.SMlog("MPATH: multipath deactivate called")

    if _is_mpath_daemon_running():
        # Flush the multipath nodes
        for sid in mpath_cli.list_maps():
            reset(sid, True)

    # Disable any active MPP LUN maps (except the root dev)
    systemroot = os.path.realpath(util.getrootdev())
    for dev in glob.glob(DEVBYMPPPATH + "/*"):
        if os.path.realpath(dev) != systemroot:
            sid = os.path.basename(dev).split('-')[0]
            reset(sid)
        else:
            util.SMlog("MPP: Found root dev node, not resetting")

    # Check the ISCSI daemon doesn't have any active sessions, if not,
    # restart in the new mode
    if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT():
        iscsilib.restart_daemon()

    util.SMlog("MPATH: multipath deactivated.")
Пример #10
0
def activate():
    util.SMlog("MPATH: multipath activate called")
    cmd = ['ln', '-sf', iscsi_mpath_file, iscsi_file]
    try:
        if os.path.exists(iscsi_mpath_file):
            # Only do this if using our customized open-iscsi package
            util.pread2(cmd)
    except util.CommandException, ce:
        if not ce.reason.endswith(': File exists'):
            raise

    # If we've got no active sessions, and the deamon is already running,
    # we're ok to restart the daemon
    if iscsilib.is_iscsi_daemon_running():
        if not iscsilib._checkAnyTGT():
            iscsilib.restart_daemon()

    # Start the updatempppathd daemon
    if not _is_mpp_daemon_running():
        cmd = ["service", "updatempppathd", "start"]
        util.pread2(cmd)

    if not _is_mpath_daemon_running():
        util.SMlog("Warning: multipath daemon not running.  Starting daemon!")
        cmd = ["service", "multipathd", "start"]
        util.pread2(cmd)

    for i in range(0, 120):
        if mpath_cli.is_working():
            util.SMlog("MPATH: dm-multipath activated.")
Пример #11
0
def activate():
    util.SMlog("MPATH: multipath activate called")
    cmd = ['ln', '-sf', iscsi_mpath_file, iscsi_file]
    try:
        if os.path.exists(iscsi_mpath_file):
            # Only do this if using our customized open-iscsi package
            util.pread2(cmd)
    except util.CommandException, ce:
        if not ce.reason.endswith(': File exists'):
            raise

    # If we've got no active sessions, and the deamon is already running,
    # we're ok to restart the daemon
    if iscsilib.is_iscsi_daemon_running():
        if not iscsilib._checkAnyTGT():
            iscsilib.restart_daemon()
        
    # Start the updatempppathd daemon
    if not _is_mpp_daemon_running():
        cmd = ["service", "updatempppathd", "start"]
        util.pread2(cmd)

    if not _is_mpath_daemon_running():
        util.SMlog("Warning: multipath daemon not running.  Starting daemon!")
        cmd = ["service", "multipathd", "start"]
        util.pread2(cmd)

    for i in range(0,120):
        if mpath_cli.is_working():
            util.SMlog("MPATH: dm-multipath activated.")