def get_path_status(scsi_id, onlyActive = False):
    listPaths = []
    list = []
    retVal = True
    try:
        lines = mpath_cli.get_topology(scsi_id)
        listPaths = []
    	for line in lines:
            m=mpath_cli.regex.search(line)
            if(m):
                listPaths.append(line)

        XenCertPrint("list_paths returned: %s" % listPaths)

        for node in listPaths:
            XenCertPrint("Looking at node: %s" % node)
            l = node.split()
            status = l[len(l) - 1].lstrip('[').rstrip(']')
            XenCertPrint("HBTL: %s" % l[1])
            XenCertPrint("Path status: %s, %s" % (status.split('][')[0], status.split('][')[1]))
	    pathStatus = status.split('][')[0]
	    if onlyActive:
		if pathStatus == 'active':
		    list.append((l[1],status.split('][')[0], status.split('][')[1]))
	    else:
		list.append((l[1],status.split('][')[0], status.split('][')[1]))
		
	XenCertPrint("Returning list: %s" % list)
    except Exception, e:
	XenCertPrint("There was some exception in getting path status for scsi id: %s. Exception: %s" % (scsi_id, str(e)))
        retVal = False
Example #2
0
def get_path_count(SCSIid, active=True):
    count = 0
    lines = mpath_cli.get_topology(SCSIid)
    for line in filter(match_dmpLUN,lines):
        if not active:
            count += 1
        elif match_pathup(line):
            count += 1
    return count
Example #3
0
def get_path_count(SCSIid):
    count = 0
    total = 0
    lines = mpath_cli.get_topology(SCSIid)
    for line in filter(match_dmpLUN, lines):
        total += 1
        if match_pathup(line):
            count += 1
    return (count, total)
Example #4
0
def get_path_count(SCSIid, active=True):
    count = 0
    lines = mpath_cli.get_topology(SCSIid)
    for line in filter(match_dmpLUN, lines):
        if not active:
            count += 1
        elif match_pathup(line):
            count += 1
    return count
Example #5
0
def get_path_count(SCSIid, active=True):
    count = 0
    if mpp_luncheck.is_RdacLun(SCSIid):
        (total_count, active_count) = mpp_mpathutil.get_pathinfo(SCSIid)
        return (total_count, active_count)
    lines = mpath_cli.get_topology(SCSIid)
    for line in filter(match_dmpLUN, lines):
        if not active:
            count += 1
        elif match_pathup(line):
            count += 1
    return count
Example #6
0
def get_path_count(SCSIid, active=True):
    count = 0
    if (mpp_luncheck.is_RdacLun(SCSIid)):
        (total_count, active_count) = mpp_mpathutil.get_pathinfo(SCSIid)
        return (total_count, active_count)
    lines = mpath_cli.get_topology(SCSIid)
    for line in filter(match_dmpLUN,lines):
        if not active:
            count += 1
        elif match_pathup(line):
            count += 1
    return count
Example #7
0
def get_path_status(scsi_id, onlyActive=False):
    listPaths = []
    list = []
    retVal = True
    try:
        lines = mpath_cli.get_topology(scsi_id)
        listPaths = []
        for line in lines:
            m = mpath_cli.regex.search(line)
            if (m):
                listPaths.append(line)

        XenCertPrint("list_paths returned: %s" % listPaths)

        # Extract hbtl, dm and path status from the multipath topology output
        # e.g. "| |- 0:0:0:0 sda 8:0   active ready running"
        pat = re.compile(r'(\d+:\d+:\d+:\d+.*)$')

        for node in listPaths:
            XenCertPrint("Looking at node: %s" % node)
            match_res = pat.search(node)
            if match_res is None:
                continue

            # Extract path info if pattern matched successfully
            l = match_res.group(1).split()
            hbtl = l[0]
            dm_status = l[3]
            path_status = l[4]
            XenCertPrint("HBTL: %s" % hbtl)
            XenCertPrint("Path status: %s, %s" % (dm_status, path_status))

            if onlyActive:
                if dm_status == 'active':
                    list.append((hbtl, dm_status, path_status))
            else:
                list.append((hbtl, dm_status, path_status))

        XenCertPrint("Returning list: %s" % list)
    except Exception, e:
        XenCertPrint(
            "There was some exception in getting path status for scsi id: %s. Exception: %s"
            % (scsi_id, str(e)))
        retVal = False
def get_path_status(scsi_id, onlyActive=False):
    listPaths = []
    list = []
    retVal = True
    try:
        lines = mpath_cli.get_topology(scsi_id)
        listPaths = []
        for line in lines:
            m = mpath_cli.regex.search(line)
            if m:
                listPaths.append(line)

        XenCertPrint("list_paths returned: %s" % listPaths)

        # Extract hbtl, dm and path status from the multipath topology output
        # e.g. "| |- 0:0:0:0 sda 8:0   active ready running"
        pat = re.compile(r"(\d:\d:\d:\d.*)$")

        for node in listPaths:
            XenCertPrint("Looking at node: %s" % node)
            match_res = pat.search(node)
            if match_res is None:
                continue

            # Extract path info if pattern matched successfully
            l = match_res.group(1).split()
            hbtl = l[0]
            dm_status = l[3]
            path_status = l[4]
            XenCertPrint("HBTL: %s" % hbtl)
            XenCertPrint("Path status: %s, %s" % (dm_status, path_status))

            if onlyActive:
                if dm_status == "active":
                    list.append((hbtl, dm_status, path_status))
            else:
                list.append((hbtl, dm_status, path_status))

        XenCertPrint("Returning list: %s" % list)
    except Exception, e:
        XenCertPrint(
            "There was some exception in getting path status for scsi id: %s. Exception: %s" % (scsi_id, str(e))
        )
        retVal = False
Example #9
0
def get_path_status(scsi_id, onlyActive=False):
    listPaths = []
    list = []
    retVal = True
    try:
        lines = mpath_cli.get_topology(scsi_id)
        listPaths = []
        for line in lines:
            m = mpath_cli.regex.search(line)
            if (m):
                listPaths.append(line)

        XenCertPrint("list_paths returned: %s" % listPaths)

        for node in listPaths:
            XenCertPrint("Looking at node: %s" % node)
            l = node.split()
            status = l[len(l) - 1].lstrip('[').rstrip(']')
            XenCertPrint("HBTL: %s" % l[1])
            XenCertPrint("Path status: %s, %s" %
                         (status.split('][')[0], status.split('][')[1]))
            pathStatus = status.split('][')[0]
            if onlyActive:
                if pathStatus == 'active':
                    list.append(
                        (l[1], status.split('][')[0], status.split('][')[1]))
            else:
                list.append(
                    (l[1], status.split('][')[0], status.split('][')[1]))

        XenCertPrint("Returning list: %s" % list)
    except Exception, e:
        XenCertPrint(
            "There was some exception in getting path status for scsi id: %s. Exception: %s"
            % (scsi_id, str(e)))
        retVal = False