def reportConnectedEsxTopology(context, unitaryComputerSystem):
    '''
    UnitaryComputersystem -> OSHVector
    '''
    resultVector = ObjectStateHolderVector()

    unitaryComputerSystemReporter = vmware_cim_report.UnitaryComputerSystemReporter(
    )

    resultVector.addAll(
        unitaryComputerSystemReporter.reportConnectionTopology(
            unitaryComputerSystem, context.ipAddress))
    esxOsh = unitaryComputerSystem.getOsh(
        vmware_cim_report.UnitaryComputerSystemReporter.UCS_KEY_HOST)
    if esxOsh is None:
        raise ValueError("ESX OSH cannot be found")

    cimOsh = cim.createCimOsh(context.ipAddress, esxOsh, context.credentialId,
                              vmware_cim_discover.CimCategory.VMWARE)
    resultVector.add(cimOsh)

    ipAddressOsh = modeling.createIpOSH(context.ipAddress)
    resultVector.add(ipAddressOsh)

    containmentLink = modeling.createLinkOSH('containment', esxOsh,
                                             ipAddressOsh)
    resultVector.add(containmentLink)

    return resultVector
def reportConnectedEsxTopology(context, unitaryComputerSystem):
    '''
    UnitaryComputersystem -> OSHVector
    '''
    resultVector = ObjectStateHolderVector()
    
    unitaryComputerSystemReporter = vmware_cim_report.UnitaryComputerSystemReporter()

    resultVector.addAll(unitaryComputerSystemReporter.reportConnectionTopology(unitaryComputerSystem, context.ipAddress))
    esxOsh = unitaryComputerSystem.getOsh(vmware_cim_report.UnitaryComputerSystemReporter.UCS_KEY_HOST)
    if esxOsh is None:
        raise ValueError("ESX OSH cannot be found")
    
    cimOsh = cim.createCimOsh(context.ipAddress, esxOsh, context.credentialId, vmware_cim_discover.CimCategory.VMWARE)
    resultVector.add(cimOsh)
    
    ipAddressOsh = modeling.createIpOSH(context.ipAddress)
    resultVector.add(ipAddressOsh)
    
    containmentLink = modeling.createLinkOSH('containment', esxOsh, ipAddressOsh)
    resultVector.add(containmentLink)
    
    return resultVector
Exemplo n.º 3
0
                testedNamespace = cim_discover.testConnectionWithNamespace(
                    Framework, ip_address, credential, namespaceObject)
                break
            except JException, ex:
                msg = ex.getMessage()
                msg = cim_discover.translateErrorMessage(msg)
                errormessages.resolveAndAddToObjectsCollections(
                    msg, protocolName, warningsList, errorsList)
            except:
                trace = logger.prepareJythonStackTrace('')
                errormessages.resolveAndAddToObjectsCollections(
                    trace, protocolName, warningsList, errorsList)

        if testedNamespace is not None:
            hostOsh = modeling.createHostOSH(ip_address)
            smisOsh = cim.createCimOsh(ip_address, hostOsh, credential,
                                       smis.CimCategory.SMIS)
            smisOsh.setStringAttribute('application_category', 'Storage')
            vector.add(hostOsh)
            vector.add(smisOsh)
            warningsList = []
            errorsList = []
            break

    if vector.size() <= 0:
        Framework.clearState()
        if (len(warningsList) == 0) and (len(errorsList) == 0):
            msg = errormessages.makeErrorMessage(
                protocolName, pattern=errormessages.ERROR_GENERIC)
            logger.debug(msg)
            errobj = errorobject.createError(
                errorcodes.INTERNAL_ERROR_WITH_PROTOCOL, [protocolName], msg)
Exemplo n.º 4
0
        for namespaceObject in smisNamespaces:
            try:
    
                testedNamespace = cim_discover.testConnectionWithNamespace(Framework, ip_address, credential, namespaceObject)
                break
            except JException, ex:
                msg = ex.getMessage()
                msg = cim_discover.translateErrorMessage(msg)
                errormessages.resolveAndAddToObjectsCollections(msg, protocolName, warningsList, errorsList)
            except:
                trace = logger.prepareJythonStackTrace('')
                errormessages.resolveAndAddToObjectsCollections(trace, protocolName, warningsList, errorsList)
        
        if testedNamespace is not None:
            hostOsh = modeling.createHostOSH(ip_address)
            smisOsh = cim.createCimOsh(ip_address, hostOsh, credential, smis.CimCategory.SMIS)
            smisOsh.setStringAttribute('application_category', 'Storage')
            vector.add(hostOsh)
            vector.add(smisOsh)
            warningsList = []
            errorsList = []
            break

    if vector.size() <= 0:
        Framework.clearState()
        if (len(warningsList) == 0) and (len(errorsList) == 0):
                msg = errormessages.makeErrorMessage(protocolName, pattern=errormessages.ERROR_GENERIC)
                logger.debug(msg)
                errobj = errorobject.createError(errorcodes.INTERNAL_ERROR_WITH_PROTOCOL, [protocolName], msg)
                errorsList.append(errobj)
    if errorsList: