def _parseCpuParameters(self, output): """ This procedure parses and sets the values of the Processor Configuration for the Managed System @param output: output of 'lshwres -r proc --level sys <Managed System>' command @type output: String @param managedSysDo: data object of ManagedSystemDo @type managedSysDo: ManagedSystemDo class instace """ if output: propertiesDict = self.buildPropertiesDict(output) cpuParameters = ibm_hmc_lib.ManagedSystemProcessorParameters() cpuParameters.minCpuPerVirtualCpu = ibm_hmc_lib.toFloat( propertiesDict.get('min_proc_units_per_virtual_proc')) cpuParameters.curCpuAvail = ibm_hmc_lib.toFloat( propertiesDict.get('curr_avail_sys_proc_units')) cpuParameters.maxCpuPerLpar = ibm_hmc_lib.toInteger( propertiesDict.get('max_procs_per_lpar')) cpuParameters.maxVirtCpuPerLpar = ibm_hmc_lib.toInteger( propertiesDict.get('max_virtual_procs_per_lpar')) cpuParameters.instCpuUnits = ibm_hmc_lib.toFloat( propertiesDict.get('installed_sys_proc_units')) cpuParameters.pendingAvailCpuUnits = ibm_hmc_lib.toFloat( propertiesDict.get('pend_avail_sys_proc_units')) cpuParameters.maxSharedCpuPools = ibm_hmc_lib.toInteger( propertiesDict.get('max_shared_proc_pools')) cpuParameters.maxOs400CpuUnits = ibm_hmc_lib.toInteger( propertiesDict.get('max_curr_procs_per_os400_lpar')) cpuParameters.configurableCpuUnits = ibm_hmc_lib.toFloat( propertiesDict.get('configurable_sys_proc_units')) return cpuParameters
def _parsePool(self, buffer): """ This fucntion performs parsing of the command output 'lshwres -r proc --level pool -m <Managed System Name>' and sets the values for IbmProcessorPool @param buffer: input buffer @type buffer: String @return: instance of IbmProcessorPool class """ if buffer: propertiesDict = self.buildPropertiesDict(buffer) procPool = ibm_hmc_lib.IbmProcessorPool() procPool.name = propertiesDict.get('pool_id') if procPool.name is None or procPool.name == "": procPool.name = "0" procPool.physCpuAvail = ibm_hmc_lib.toFloat(propertiesDict.get('curr_avail_pool_proc_units')) procPool.physCpuConf = ibm_hmc_lib.toFloat(propertiesDict.get('configurable_pool_proc_units')) procPool.physCpuPendingAvail = ibm_hmc_lib.toFloat(propertiesDict.get('pend_avail_pool_proc_units')) return procPool
def _parseLparProfile(self, buffer): """ This function performs parsing of the command output lssysscfg -r prof -m '<Managed System Name>' bloc and sets the values for IbmLparProfileDo @param buffer: command output buffer @type buffer: String @return: instance of IbmLparProfileDo class """ if buffer : propertiesDict = self.buildPropertiesDict(buffer) lparId = ibm_hmc_lib.toInteger(propertiesDict.get('lpar_id')) if not lparId: raise ValueError('Failed to parse out Lpar Id for buffer %s' % buffer) lparProfile = ibm_fsm.IbmLparProfile() lparProfile.desNumHugePages = ibm_hmc_lib.toInteger(propertiesDict.get('desired_num_huge_pages')) lparProfile.minNumHugePages = ibm_hmc_lib.toInteger(propertiesDict.get('min_num_huge_pages')) lparProfile.maxNumHugePages = ibm_hmc_lib.toInteger(propertiesDict.get('max_num_huge_pages')) lparProfile.desCpu = ibm_hmc_lib.toInteger(propertiesDict.get('desired_procs')) lparProfile.minCpu = ibm_hmc_lib.toInteger(propertiesDict.get('min_procs')) lparProfile.maxCpu = ibm_hmc_lib.toInteger(propertiesDict.get('max_procs')) lparProfile.desPhysCpu = ibm_hmc_lib.toFloat(propertiesDict.get('desired_proc_units')) lparProfile.minPhysCpu = ibm_hmc_lib.toFloat(propertiesDict.get('min_proc_units')) lparProfile.maxPhysCpu = ibm_hmc_lib.toFloat(propertiesDict.get('max_proc_units')) lparProfile.desMem = ibm_hmc_lib.toLong(propertiesDict.get('desired_mem')) lparProfile.minMem = ibm_hmc_lib.toLong(propertiesDict.get('min_mem')) lparProfile.maxMem = ibm_hmc_lib.toLong(propertiesDict.get('max_mem')) lparProfile.sharingMode = propertiesDict.get('sharing_mode') if lparProfile.sharingMode and lparProfile.sharingMode not in ibm_fsm.LPAR_SHARING_MODES: logger.warn('Unsupported sharing mode: %s. Setting to None.' % lparProfile.sharingMode) lparProfile.sharingMode = None lparProfile.cpuMode = propertiesDict.get('proc_mode') if lparProfile.cpuMode and ibm_fsm.LPAR_CPU_MODES.has_key(lparProfile.cpuMode): lparProfile.cpuMode = ibm_fsm.LPAR_CPU_MODES.get(lparProfile.cpuMode) else: logger.warn('Unsupported CPU mode %s. Setting to None' % lparProfile.cpuMode) lparProfile.cpuMode = None lparProfile.uncapWeight = ibm_hmc_lib.toInteger(propertiesDict.get('uncap_weight')) lparProfile.connMonEnabled = ibm_hmc_lib.toInteger(propertiesDict.get('conn_monitoring')) lparProfile.maxVirtSlots = ibm_hmc_lib.toInteger(propertiesDict.get('max_virtual_slots')) lparProfile.ioPoolIds = propertiesDict.get('lpar_io_pool_ids') lparProfile.virtSerialAdapters = propertiesDict.get('virtual_serial_adapters') return {lparId : lparProfile}
def _parsePool(self, buffer): """ This fucntion performs parsing of the command output 'lshwres -r proc --level pool -m <Managed System Name>' and sets the values for IbmProcessorPool @param buffer: input buffer @type buffer: String @return: instance of IbmProcessorPool class """ if buffer: propertiesDict = self.buildPropertiesDict(buffer) procPool = ibm_hmc_lib.IbmProcessorPool() procPool.name = propertiesDict.get('pool_id') if procPool.name is None or procPool.name == "": procPool.name = "0" procPool.physCpuAvail = ibm_hmc_lib.toFloat( propertiesDict.get('curr_avail_pool_proc_units')) procPool.physCpuConf = ibm_hmc_lib.toFloat( propertiesDict.get('configurable_pool_proc_units')) procPool.physCpuPendingAvail = ibm_hmc_lib.toFloat( propertiesDict.get('pend_avail_pool_proc_units')) return procPool
def _parseCpuParameters(self, output): """ This procedure parses and sets the values of the Processor Configuration for the Managed System @param output: output of 'lshwres -r proc --level sys <Managed System>' command @type output: String @param managedSysDo: data object of ManagedSystemDo @type managedSysDo: ManagedSystemDo class instace """ if output: propertiesDict = self.buildPropertiesDict(output) cpuParameters = ibm_hmc_lib.ManagedSystemProcessorParameters() cpuParameters.minCpuPerVirtualCpu = ibm_hmc_lib.toFloat(propertiesDict.get('min_proc_units_per_virtual_proc')) cpuParameters.curCpuAvail = ibm_hmc_lib.toFloat(propertiesDict.get('curr_avail_sys_proc_units')) cpuParameters.maxCpuPerLpar = ibm_hmc_lib.toInteger(propertiesDict.get('max_procs_per_lpar')) cpuParameters.maxVirtCpuPerLpar = ibm_hmc_lib.toInteger(propertiesDict.get('max_virtual_procs_per_lpar')) cpuParameters.instCpuUnits = ibm_hmc_lib.toFloat(propertiesDict.get('installed_sys_proc_units')) cpuParameters.pendingAvailCpuUnits = ibm_hmc_lib.toFloat(propertiesDict.get('pend_avail_sys_proc_units')) cpuParameters.maxSharedCpuPools = ibm_hmc_lib.toInteger(propertiesDict.get('max_shared_proc_pools')) cpuParameters.maxOs400CpuUnits = ibm_hmc_lib.toInteger(propertiesDict.get('max_curr_procs_per_os400_lpar')) cpuParameters.configurableCpuUnits = ibm_hmc_lib.toFloat(propertiesDict.get('configurable_sys_proc_units')) return cpuParameters
def parsePhysicalVolumeParams(output, physVolume): if output: size = re.search("TOTAL\s+PPs\:\s+\d+\s*\(\s*(\d+)", output) if size: physVolume.pvSize = ibm_hmc_lib.toFloat(size.group(1).strip()) logger.debug('Physical Volume Size ' + str( physVolume.pvSize))
def _parseLparProfile(self, buffer): """ This function performs parsing of the command output lssysscfg -r prof -m '<Managed System Name>' bloc and sets the values for IbmLparProfileDo @param buffer: command output buffer @type buffer: String @return: instance of IbmLparProfileDo class """ if buffer: propertiesDict = self.buildPropertiesDict(buffer) lparId = ibm_hmc_lib.toInteger(propertiesDict.get('lpar_id')) if not lparId: raise ValueError('Failed to parse out Lpar Id for buffer %s' % buffer) lparProfile = ibm_fsm.IbmLparProfile() lparProfile.desNumHugePages = ibm_hmc_lib.toInteger( propertiesDict.get('desired_num_huge_pages')) lparProfile.minNumHugePages = ibm_hmc_lib.toInteger( propertiesDict.get('min_num_huge_pages')) lparProfile.maxNumHugePages = ibm_hmc_lib.toInteger( propertiesDict.get('max_num_huge_pages')) lparProfile.desCpu = ibm_hmc_lib.toInteger( propertiesDict.get('desired_procs')) lparProfile.minCpu = ibm_hmc_lib.toInteger( propertiesDict.get('min_procs')) lparProfile.maxCpu = ibm_hmc_lib.toInteger( propertiesDict.get('max_procs')) lparProfile.desPhysCpu = ibm_hmc_lib.toFloat( propertiesDict.get('desired_proc_units')) lparProfile.minPhysCpu = ibm_hmc_lib.toFloat( propertiesDict.get('min_proc_units')) lparProfile.maxPhysCpu = ibm_hmc_lib.toFloat( propertiesDict.get('max_proc_units')) lparProfile.desMem = ibm_hmc_lib.toLong( propertiesDict.get('desired_mem')) lparProfile.minMem = ibm_hmc_lib.toLong( propertiesDict.get('min_mem')) lparProfile.maxMem = ibm_hmc_lib.toLong( propertiesDict.get('max_mem')) lparProfile.sharingMode = propertiesDict.get('sharing_mode') if lparProfile.sharingMode and lparProfile.sharingMode not in ibm_fsm.LPAR_SHARING_MODES: logger.warn('Unsupported sharing mode: %s. Setting to None.' % lparProfile.sharingMode) lparProfile.sharingMode = None lparProfile.cpuMode = propertiesDict.get('proc_mode') if lparProfile.cpuMode and ibm_fsm.LPAR_CPU_MODES.has_key( lparProfile.cpuMode): lparProfile.cpuMode = ibm_fsm.LPAR_CPU_MODES.get( lparProfile.cpuMode) else: logger.warn('Unsupported CPU mode %s. Setting to None' % lparProfile.cpuMode) lparProfile.cpuMode = None lparProfile.uncapWeight = ibm_hmc_lib.toInteger( propertiesDict.get('uncap_weight')) lparProfile.connMonEnabled = ibm_hmc_lib.toInteger( propertiesDict.get('conn_monitoring')) lparProfile.maxVirtSlots = ibm_hmc_lib.toInteger( propertiesDict.get('max_virtual_slots')) lparProfile.ioPoolIds = propertiesDict.get('lpar_io_pool_ids') lparProfile.virtSerialAdapters = propertiesDict.get( 'virtual_serial_adapters') return {lparId: lparProfile}
def parsePhysicalVolumeParams(output, physVolume): if output: size = re.search("TOTAL\s+PPs\:\s+\d+\s*\(\s*(\d+)", output) if size: physVolume.pvSize = ibm_hmc_lib.toFloat(size.group(1).strip()) logger.debug('Physical Volume Size ' + str(physVolume.pvSize))