def discoverVolumeGroups(shell):
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lsvg')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Logical Volumes')
        logger.warn(str(ex))
        return {}
def discoverLparPhysScsiAndRaid(shell, physicalVolumesDict):
    scsiList = []
    physVolumes = []
    output = ""
    for hdisk in physicalVolumesDict.keys():
        try:
            output = ibm_hmc_lib.executeCommand(shell, 'lspath -l %s -F"name:parent"' % hdisk)
        except ValueError, ex:
            logger.warn(str(ex))
            continue
        (hdisks, devices) = parseHdiskToScsiCorres(output, "\:+")
        for i in range(len(devices)):
            deviceName = devices[i]
            physicalVolume = physicalVolumesDict.get(hdisks[i])
            if physicalVolume:
                command = "lscfg | grep %s" % deviceName
                try:
                    output = shell.execAlternateCmds(command, "ioscli " + command, "/usr/ios/cli/ioscli " + command)
                    if output:
                        physicalPath = re.match('\+\s+scsi1\s+([\w\.\-]+)\s+', output.strip())
                        if physicalPath:
                            localSlotNumber = re.match(".*-[Cc](\d+)", physicalPath.group(1).strip()) or re.match(".*-[Pp](\d+)", physicalPath.group(1).strip())
                            if localSlotNumber:
                                scsi = storage_topology.ScsiAdapter()
                                scsi.physicalPath = physicalPath.group(1).strip()
                                scsi.slotNumber = localSlotNumber.group(1).strip()
                                physicalVolume.scsiAdapterSlotNumber = scsi.slotNumber
                                physVolumes.append(physicalVolume)
                                scsiList.append(scsi)
                except:
                    logger.warnException("Failed to discover physical SCSI and RAID.")
コード例 #3
0
def discoverVolumeGroups(shell):
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lsvg')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Logical Volumes')
        logger.warn(str(ex))
        return {}
def discoverPhysicalVolumes(shell):
    physVolumeDict = {}
    output = None   # modified by Daniel La 29/03/2012 use to be output = ''
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lspv')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Physical Volumes')
        logger.warn(str(ex))
コード例 #5
0
def discoverPhysicalVolumes(shell):
    physVolumeDict = {}
    output = ""
    try:
        output = ibm_hmc_lib.executeCommand(shell, "lspv")
    except ValueError, ex:
        logger.reportWarning("Failed to discover Physical Volumes")
        logger.warn(str(ex))
コード例 #6
0
def discoverPhysicalVolumes(shell):
    physVolumeDict = {}
    output = ''
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lspv')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Physical Volumes')
        logger.warn(str(ex))
def discoverPhysScsiAndRaid(shell, physicalVolumesDict):
    scsiList = []
    physVolumes = []
    output = ""
    try:
        output = ibm_hmc_lib.executeCommand(shell, "lspath -field name parent")
        if output and re.search(r"\s+isk\d+\s+sc\s+si\d+", output, re.DOTALL):
            output = output.replace('isk', 'hdisk').replace('sc si', 'scsi')
    except ValueError, ex:
        logger.reportWarning('Failed to run lspath.')
        logger.warn(str(ex))
コード例 #8
0
def discoverPhysScsiAndRaid(shell, physicalVolumesDict):
    scsiList = []
    physVolumes = []
    output = ""
    try:
        output = ibm_hmc_lib.executeCommand(shell, "lspath -field name parent")
        if output and re.search(r"\s+isk\d+\s+sc\s+si\d+", output, re.DOTALL):
            output = output.replace('isk', 'hdisk').replace('sc si', 'scsi')
    except ValueError, ex:
        logger.reportWarning('Failed to run lspath.')
        logger.warn(str(ex))
コード例 #9
0
def discoverVirtIoSlots(shell, servers):
    """
    Lists and calls parser for all I/O Slots on the Managed Systems
    @param shell: either SSH or Telnet client
    @type shell: instance of the ShellUtills class
    @param managedSystemsDoList: all previously discovered Managed Systems
    @type managedSystemsDoList: list of the ManagedSystemDo class instances
    """
    if servers:
        for server in servers:
            try:
                #Discover Virtual IO Slot parameters
                output = ibm_hmc_lib.executeCommand(shell, 'lshwres -r virtualio --rsubtype slot --level  slot -m \'' + server.managedSystem.genericParameters.name + '\'')
                server.managedSystem.vIoSlotList = ibm_hmc_lib.getEntiesAsList(output, parseVirtIoSlots)
            except ValueError, ex:
                logger.warn(str(ex))
コード例 #10
0
def discoverIoSlots(shell, servers):
    """
    Lists and calls parser for all I/O Slots on the Managed Systems
    @param shell: either SSH or Telnet client
    @type shell: instance of the ShellUtills class
    @param managedSystemsDoList: all previously discovered Managed Systems
    @type managedSystemsDoList: list of the ManagedSystemDo class instances
    """
    if servers:
        for server in servers:
            try:
                #Discover IO Slot parameters
                output = ibm_hmc_lib.executeCommand(
                    shell, 'lshwres -r io --rsubtype slot -m \'' +
                    server.managedSystem.genericParameters.name + '\'')
                server.managedSystem.ioSlotList = ibm_hmc_lib.getEntiesAsList(
                    output, parseIoSlot)
            except ValueError, ex:
                logger.warn(str(ex))
コード例 #11
0
def discoverLparPhysScsiAndRaid(shell, physicalVolumesDict):
    scsiList = []
    physVolumes = []
    output = ""
    for hdisk in physicalVolumesDict.keys():
        try:
            output = ibm_hmc_lib.executeCommand(
                shell, 'lspath -l %s -F"name:parent"' % hdisk)
        except ValueError, ex:
            logger.warn(str(ex))
            continue
        (hdisks, devices) = parseHdiskToScsiCorres(output, "\:+")
        for i in range(len(devices)):
            deviceName = devices[i]
            physicalVolume = physicalVolumesDict.get(hdisks[i])
            if physicalVolume:
                command = "lscfg | grep %s" % deviceName
                try:
                    output = shell.execAlternateCmds(
                        command, "ioscli " + command,
                        "/usr/ios/cli/ioscli " + command)
                    if output:
                        physicalPath = re.match('\+\s+scsi1\s+([\w\.\-]+)\s+',
                                                output.strip())
                        if physicalPath:
                            localSlotNumber = re.match(
                                ".*-[Cc](\d+)",
                                physicalPath.group(1).strip()) or re.match(
                                    ".*-[Pp](\d+)",
                                    physicalPath.group(1).strip())
                            if localSlotNumber:
                                scsi = storage_topology.ScsiAdapter()
                                scsi.physicalPath = physicalPath.group(
                                    1).strip()
                                scsi.slotNumber = localSlotNumber.group(
                                    1).strip()
                                physicalVolume.scsiAdapterSlotNumber = scsi.slotNumber
                                physVolumes.append(physicalVolume)
                                scsiList.append(scsi)
                except:
                    logger.warnException(
                        "Failed to discover physical SCSI and RAID.")
        if vgId:
            return vgId.group(1).strip()


def discoverVolumeGroups(shell):
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lsvg')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Logical Volumes')
        logger.warn(str(ex))
        return {}
    vgDict = parseVolumeGroupNames(output)
    if vgDict:
        for vg in vgDict.values():
            try:
                output = ibm_hmc_lib.executeCommand(shell, 'lsvg %s' % vg.vgName)
                vg.vgId = parseVolumeGroupParameters(output)
                vgDict[vg.vgName] = vg
            except ValueError, ex:
                logger.warn(str(ex))
    return vgDict

def parsePhysicalVolume(output):
    pvDoDict = {}
    if output:
        lines = ibm_hmc_lib.splitCommandOutput(output)
        if lines:
            if re.match("\s*NAME\s+PVID", output):
                lines = lines[1:]
            for line in lines:
                tokens = re.split("\s+", line)
コード例 #13
0
        if vgId:
            return vgId.group(1).strip()


def discoverVolumeGroups(shell):
    try:
        output = ibm_hmc_lib.executeCommand(shell, 'lsvg')
    except ValueError, ex:
        logger.reportWarning('Failed to discover Logical Volumes')
        logger.warn(str(ex))
        return {}
    vgDict = parseVolumeGroupNames(output)
    if vgDict:
        for vg in vgDict.values():
            try:
                output = ibm_hmc_lib.executeCommand(shell,
                                                    'lsvg %s' % vg.vgName)
                vg.vgId = parseVolumeGroupParameters(output)
                vgDict[vg.vgName] = vg
            except ValueError, ex:
                logger.warn(str(ex))
    return vgDict


def parsePhysicalVolume(output):
    pvDoDict = {}
    if output:
        lines = ibm_hmc_lib.splitCommandOutput(output)
        if lines:
            if re.match("\s*NAME\s+PVID", output):
                lines = lines[1:]
            for line in lines: