Example #1
0
def _get_cpu_core_stats(first_sample, last_sample):
    interval = last_sample.timestamp - first_sample.timestamp

    def compute_cpu_usage(cpu_core, mode):
        first_core_sample = first_sample.cpuCores.getCoreSample(cpu_core)
        last_core_sample = last_sample.cpuCores.getCoreSample(cpu_core)
        if not first_core_sample or not last_core_sample:
            raise MissingSample()
        jiffies = (last_core_sample[mode] -
                   first_core_sample[mode]) % JIFFIES_BOUND
        return ("%.2f" % (jiffies / interval))

    cpu_core_stats = {}
    for node_index, numa_node in six.iteritems(numa.topology()):
        cpu_cores = numa_node['cpus']
        for cpu_core in cpu_cores:
            try:
                user_cpu_usage = compute_cpu_usage(cpu_core, 'user')
                system_cpu_usage = compute_cpu_usage(cpu_core, 'sys')
            except MissingSample:
                # Only collect data when all required samples already present
                continue
            core_stat = {
                'nodeIndex': int(node_index),
                'cpuUser': user_cpu_usage,
                'cpuSys': system_cpu_usage,
            }
            core_stat['cpuIdle'] = ("%.2f" % max(
                0.0, 100.0 - float(core_stat['cpuUser']) -
                float(core_stat['cpuSys'])))
            cpu_core_stats[str(cpu_core)] = core_stat
    return cpu_core_stats
Example #2
0
def _get_cpu_core_stats(first_sample, last_sample):
    interval = last_sample.timestamp - first_sample.timestamp

    def compute_cpu_usage(cpu_core, mode):
        first_core_sample = first_sample.cpuCores.getCoreSample(cpu_core)
        last_core_sample = last_sample.cpuCores.getCoreSample(cpu_core)
        if not first_core_sample or not last_core_sample:
            raise MissingSample()
        jiffies = (
            last_core_sample[mode] - first_core_sample[mode]
        ) % JIFFIES_BOUND
        return ("%.2f" % (jiffies / interval))

    cpu_core_stats = {}
    for node_index, numa_node in six.iteritems(numa.topology()):
        cpu_cores = numa_node['cpus']
        for cpu_core in cpu_cores:
            try:
                user_cpu_usage = compute_cpu_usage(cpu_core, 'user')
                system_cpu_usage = compute_cpu_usage(cpu_core, 'sys')
            except MissingSample:
                # Only collect data when all required samples already present
                continue
            core_stat = {
                'nodeIndex': int(node_index),
                'cpuUser': user_cpu_usage,
                'cpuSys': system_cpu_usage,
            }
            core_stat['cpuIdle'] = (
                "%.2f" % max(0.0,
                             100.0 -
                             float(core_stat['cpuUser']) -
                             float(core_stat['cpuSys'])))
            cpu_core_stats[str(cpu_core)] = core_stat
    return cpu_core_stats
Example #3
0
 def testNumaTopology(self):
     # 2 x AMD 6272 (with Modules)
     numa.update()
     t = numa.topology()
     expectedNumaInfo = {
         '0': {
             'cpus': [0, 1, 2, 3, 4, 5, 6, 7],
             'totalMemory': '49141',
             'hugepages': {
                 4: {
                     'totalPages': '2500'
                 },
                 2048: {
                     'totalPages': '100'
                 }
             }
         },
         '1': {
             'cpus': [8, 9, 10, 11, 12, 13, 14, 15],
             'totalMemory': '49141',
             'hugepages': {
                 4: {
                     'totalPages': '2'
                 },
                 2048: {
                     'totalPages': '1'
                 }
             }
         },
         '2': {
             'cpus': [16, 17, 18, 19, 20, 21, 22, 23],
             'totalMemory': '49141',
             'hugepages': {
                 4: {
                     'totalPages': '0'
                 },
                 2048: {
                     'totalPages': '0'
                 }
             }
         },
         '3': {
             'cpus': [24, 25, 26, 27, 28, 29, 30, 31],
             'totalMemory': '49141',
             'hugepages': {
                 4: {
                     'totalPages': '2500'
                 },
                 2048: {
                     'totalPages': '100'
                 }
             }
         }
     }
     self.assertEqual(t, expectedNumaInfo)
Example #4
0
 def testNumaTopology(self):
     # 2 x AMD 6272 (with Modules)
     t = numa.topology()
     expectedNumaInfo = {
         '0': {'cpus': [0, 1, 2, 3, 4, 5, 6, 7], 'totalMemory': '49141'},
         '1': {'cpus': [8, 9, 10, 11, 12, 13, 14, 15],
               'totalMemory': '49141'},
         '2': {'cpus': [16, 17, 18, 19, 20, 21, 22, 23],
               'totalMemory': '49141'},
         '3': {'cpus': [24, 25, 26, 27, 28, 29, 30, 31],
               'totalMemory': '49141'}}
     self.assertEqual(t, expectedNumaInfo)
Example #5
0
 def __init__(self):
     self.nodesMemSample = {}
     numaTopology = numa.topology()
     for nodeIndex in numaTopology:
         nodeMemSample = {}
         memInfo = numa.memory_by_cell(int(nodeIndex))
         nodeMemSample['memFree'] = memInfo['free']
         # in case the numa node has zero memory assigned, report the whole
         # memory as used
         nodeMemSample['memPercent'] = 100
         if int(memInfo['total']) != 0:
             nodeMemSample['memPercent'] = 100 - \
                 int(100.0 * int(memInfo['free']) / int(memInfo['total']))
         self.nodesMemSample[nodeIndex] = nodeMemSample
Example #6
0
 def __init__(self):
     self.nodesMemSample = {}
     numaTopology = numa.topology()
     for nodeIndex in numaTopology:
         nodeMemSample = {}
         memInfo = numa.memory_by_cell(int(nodeIndex))
         nodeMemSample['memFree'] = memInfo['free']
         # in case the numa node has zero memory assigned, report the whole
         # memory as used
         nodeMemSample['memPercent'] = 100
         if int(memInfo['total']) != 0:
             nodeMemSample['memPercent'] = 100 - \
                 int(100.0 * int(memInfo['free']) / int(memInfo['total']))
         self.nodesMemSample[nodeIndex] = nodeMemSample
Example #7
0
 def __init__(self):
     self.nodesMemSample = {}
     numaTopology = numa.topology()
     for nodeIndex in numaTopology:
         nodeMemSample = {}
         # work around libvirt bug (if not built with numactl)
         if len(numaTopology) == 1:
             idx = -1
         else:
             idx = int(nodeIndex)
         memInfo = numa.memory_by_cell(idx)
         nodeMemSample['memFree'] = memInfo['free']
         # in case the numa node has zero memory assigned, report the whole
         # memory as used
         nodeMemSample['memPercent'] = 100
         if int(memInfo['total']) != 0:
             nodeMemSample['memPercent'] = 100 - \
                 int(100.0 * int(memInfo['free']) // int(memInfo['total']))
         self.nodesMemSample[nodeIndex] = nodeMemSample
Example #8
0
 def __init__(self):
     self.nodesMemSample = {}
     numaTopology = numa.topology()
     for nodeIndex in numaTopology:
         nodeMemSample = {}
         # work around libvirt bug (if not built with numactl)
         if len(numaTopology) == 1:
             idx = -1
         else:
             idx = int(nodeIndex)
         memInfo = numa.memory_by_cell(idx)
         nodeMemSample['memFree'] = memInfo['free']
         # in case the numa node has zero memory assigned, report the whole
         # memory as used
         nodeMemSample['memPercent'] = 100
         if int(memInfo['total']) != 0:
             nodeMemSample['memPercent'] = 100 - \
                 int(100.0 * int(memInfo['free']) // int(memInfo['total']))
         self.nodesMemSample[nodeIndex] = nodeMemSample
Example #9
0
 def test_topology(self):
     capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
     result = numa.topology(capsData)
     # only check cpus, memory does not come from file
     expected = [0, 1, 2, 3, 4, 5, 6, 7]
     self.assertEqual(expected, result['0']['cpus'])
Example #10
0
def get():
    numa.update()
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(
        [str(cpu_id) for cpu_id in cpu_topology.online_cpus])

    caps['cpuTopology'] = [{
        'cpu_id': cpu.cpu_id,
        'numa_cell_id': cpu.numa_cell_id,
        'socket_id': cpu.socket_id,
        'die_id': cpu.die_id,
        'core_id': cpu.core_id,
    } for cpu in numa.cpu_info()]

    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(_getFlagsAndFeatures())
    caps['vdsmToCpusAffinity'] = list(taskset.get(os.getpid()))

    caps.update(dsaversion.version_info())

    proxy = supervdsm.getProxy()
    net_caps = proxy.network_caps()
    caps.update(net_caps)
    caps['ovnConfigured'] = proxy.is_ovn_configured()

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['realtimeKernel'] = osinfo.runtime_kernel_flags().realtime
    caps['kernelArgs'] = osinfo.kernel_args()
    caps['nestedVirtualization'] = osinfo.nested_virtualization().enabled
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] // 1024)
    caps['reservedMem'] = str(
        config.getint('vars', 'host_mem_reserve') +
        config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    caps['rngSources'] = rngsources.list_available()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    caps['liveSnapshot'] = 'true'
    caps['liveMerge'] = 'true'
    caps['kdumpStatus'] = osinfo.kdump_status()
    caps["deferred_preallocation"] = True

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    # TODO This needs to be removed after adding engine side support
    # and adding gdeploy support to enable libgfapi on RHHI by default
    caps['additionalFeatures'] = ['libgfapi_supported']
    if osinfo.glusterEnabled:
        from vdsm.gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    caps['hostedEngineDeployed'] = _isHostedEngineDeployed()
    caps['hugepages'] = hugepages.supported()
    caps['kernelFeatures'] = osinfo.kernel_features()
    caps['vncEncrypted'] = _isVncEncrypted()
    caps['backupEnabled'] = True
    caps['coldBackupEnabled'] = True
    caps['clearBitmapsEnabled'] = True
    caps['fipsEnabled'] = _getFipsEnabled()
    try:
        caps['boot_uuid'] = osinfo.boot_uuid()
    except Exception:
        logging.exception("Can not find boot uuid")
    caps['tscFrequency'] = _getTscFrequency()
    caps['tscScaling'] = _getTscScaling()

    try:
        caps["connector_info"] = managedvolume.connector_info()
    except se.ManagedVolumeNotSupported as e:
        logging.info("managedvolume not supported: %s", e)
    except se.ManagedVolumeHelperFailed as e:
        logging.exception("Error getting managedvolume connector info: %s", e)

    # Which domain versions are supported by this host.
    caps["domain_versions"] = sc.DOMAIN_VERSIONS

    caps["supported_block_size"] = backends.supported_block_size()
    caps["cd_change_pdiv"] = True
    caps["refresh_disk_supported"] = True

    return caps
Example #11
0
def get():
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(cpu_topology.online_cpus)
    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(cpuinfo.flags() +
                                machinetype.compatible_cpu_models())

    caps.update(_getVersionInfo())

    net_caps = supervdsm.getProxy().network_caps()
    caps.update(net_caps)

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['realtimeKernel'] = osinfo.runtime_kernel_flags().realtime
    caps['kernelArgs'] = osinfo.kernel_args()
    caps['nestedVirtualization'] = osinfo.nested_virtualization().enabled
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] / 1024)
    caps['reservedMem'] = str(config.getint('vars', 'host_mem_reserve') +
                              config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    caps['rngSources'] = rngsources.list_available()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    liveSnapSupported = _getLiveSnapshotSupport(cpuarch.effective())
    if liveSnapSupported is not None:
        caps['liveSnapshot'] = str(liveSnapSupported).lower()
    caps['liveMerge'] = str(getLiveMergeSupport()).lower()
    caps['kdumpStatus'] = osinfo.kdump_status()

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    caps['additionalFeatures'] = []
    if osinfo.glusterEnabled:
        from vdsm.gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    caps['containers'] = containersconnection.is_supported()
    caps['hostedEngineDeployed'] = _isHostedEngineDeployed()
    return caps
Example #12
0
def _get_mapping_pcpu_to_pnode():
    pcpu_to_pnode = {}
    for node_index, numa_node in numa.topology().iteritems():
        for pcpu_id in numa_node['cpus']:
            pcpu_to_pnode[pcpu_id] = int(node_index)
    return pcpu_to_pnode
Example #13
0
 def test_topology(self):
     numa.update()
     result = numa.topology()
     # only check cpus, memory does not come from file
     expected = [0, 1, 2, 3, 4, 5, 6, 7]
     self.assertEqual(expected, result['0']['cpus'])
Example #14
0
def get():
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(cpu_topology.online_cpus)
    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(cpuinfo.flags() +
                                machinetype.compatible_cpu_models())

    caps.update(_getVersionInfo())

    net_caps = supervdsm.getProxy().network_caps()
    caps.update(net_caps)

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['realtimeKernel'] = osinfo.runtime_kernel_flags().realtime
    caps['kernelArgs'] = osinfo.kernel_args()
    caps['nestedVirtualization'] = osinfo.nested_virtualization().enabled
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] // 1024)
    caps['reservedMem'] = str(
        config.getint('vars', 'host_mem_reserve') +
        config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    caps['rngSources'] = rngsources.list_available()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    caps['liveSnapshot'] = 'true'
    caps['liveMerge'] = 'true'
    caps['kdumpStatus'] = osinfo.kdump_status()

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    # TODO This needs to be removed after adding engine side support
    # and adding gdeploy support to enable libgfapi on RHHI by default
    caps['additionalFeatures'] = ['libgfapi_supported']
    if osinfo.glusterEnabled:
        from vdsm.gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    caps['containers'] = containersconnection.is_supported()
    caps['hostedEngineDeployed'] = _isHostedEngineDeployed()
    caps['hugepages'] = hugepages.supported()
    caps['kernelFeatures'] = osinfo.kernel_features()
    return caps
Example #15
0
def get():
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(cpu_topology.online_cpus)
    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(cpuinfo.flags() +
                                machinetype.compatible_cpu_models())

    caps.update(_getVersionInfo())

    net_caps = supervdsm.getProxy().network_caps()
    caps.update(net_caps)

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['kernelArgs'] = osinfo.kernel_args()
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] / 1024)
    caps['reservedMem'] = str(
        config.getint('vars', 'host_mem_reserve') +
        config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    caps['rngSources'] = rngsources.available_sources()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    liveSnapSupported = _getLiveSnapshotSupport(cpuarch.effective())
    if liveSnapSupported is not None:
        caps['liveSnapshot'] = str(liveSnapSupported).lower()
    caps['liveMerge'] = str(getLiveMergeSupport()).lower()
    caps['kdumpStatus'] = osinfo.kdump_status()

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    caps['additionalFeatures'] = []
    if osinfo.glusterEnabled:
        from gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    return caps
Example #16
0
File: caps.py Project: kanalun/vdsm
def get():
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(cpu_topology.online_cpus)
    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(cpuinfo.flags() +
                                machinetype.compatible_cpu_models())

    caps.update(_getVersionInfo())

    # TODO: Version requests by engine to ease handling of compatibility.
    netinfo_data = netinfo_cache.get(compatibility=30600)
    caps.update(netinfo_data)

    super_caps_networks = supervdsm.getProxy().caps_networks()
    caps.update(super_caps_networks)

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = storage.hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] / 1024)
    caps['reservedMem'] = str(config.getint('vars', 'host_mem_reserve') +
                              config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    # Verify that our libvirt supports virtio RNG (since 10.0.2-31)
    requiredVer = LooseVersion('0.10.2-31')
    if 'libvirt' not in caps['packages2']:
        libvirtVer = None
    else:
        libvirtVer = LooseVersion(
            '-'.join((caps['packages2']['libvirt']['version'],
                      caps['packages2']['libvirt']['release'])))

    if libvirtVer is None:
        logging.debug('VirtioRNG DISABLED: unknown libvirt version')
    elif libvirtVer < requiredVer:
        logging.debug('VirtioRNG DISABLED: libvirt version %s required >= %s',
                      libvirtVer, requiredVer)
    else:
        caps['rngSources'] = vmdevices.core.Rng.available_sources()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    liveSnapSupported = _getLiveSnapshotSupport(cpuarch.effective())
    if liveSnapSupported is not None:
        caps['liveSnapshot'] = str(liveSnapSupported).lower()
    caps['liveMerge'] = str(getLiveMergeSupport()).lower()
    caps['kdumpStatus'] = osinfo.kdump_status()

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    caps['additionalFeatures'] = []
    if osinfo.glusterEnabled:
        from gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    return caps
Example #17
0
 def test_topology(self):
     capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
     result = numa.topology(capsData)
     # only check cpus, memory does not come from file
     expected = [0, 1, 2, 3, 4, 5, 6, 7]
     self.assertEqual(expected, result['0']['cpus'])
Example #18
0
File: caps.py Project: nirs/vdsm
def get():
    caps = {}
    cpu_topology = numa.cpu_topology()

    caps['kvmEnabled'] = str(os.path.exists('/dev/kvm')).lower()

    if config.getboolean('vars', 'report_host_threads_as_cores'):
        caps['cpuCores'] = str(cpu_topology.threads)
    else:
        caps['cpuCores'] = str(cpu_topology.cores)

    caps['cpuThreads'] = str(cpu_topology.threads)
    caps['cpuSockets'] = str(cpu_topology.sockets)
    caps['onlineCpus'] = ','.join(cpu_topology.online_cpus)
    caps['cpuSpeed'] = cpuinfo.frequency()
    caps['cpuModel'] = cpuinfo.model()
    caps['cpuFlags'] = ','.join(cpuinfo.flags() +
                                machinetype.compatible_cpu_models())

    caps.update(_getVersionInfo())

    net_caps = supervdsm.getProxy().network_caps()
    caps.update(net_caps)

    try:
        caps['hooks'] = hooks.installed()
    except:
        logging.debug('not reporting hooks', exc_info=True)

    caps['operatingSystem'] = osinfo.version()
    caps['uuid'] = host.uuid()
    caps['packages2'] = osinfo.package_versions()
    caps['realtimeKernel'] = osinfo.runtime_kernel_flags().realtime
    caps['kernelArgs'] = osinfo.kernel_args()
    caps['nestedVirtualization'] = osinfo.nested_virtualization().enabled
    caps['emulatedMachines'] = machinetype.emulated_machines(
        cpuarch.effective())
    caps['ISCSIInitiatorName'] = _getIscsiIniName()
    caps['HBAInventory'] = hba.HBAInventory()
    caps['vmTypes'] = ['kvm']

    caps['memSize'] = str(utils.readMemInfo()['MemTotal'] // 1024)
    caps['reservedMem'] = str(config.getint('vars', 'host_mem_reserve') +
                              config.getint('vars', 'extra_mem_reserve'))
    caps['guestOverhead'] = config.get('vars', 'guest_ram_overhead')

    caps['rngSources'] = rngsources.list_available()

    caps['numaNodes'] = dict(numa.topology())
    caps['numaNodeDistance'] = dict(numa.distances())
    caps['autoNumaBalancing'] = numa.autonuma_status()

    caps['selinux'] = osinfo.selinux_status()

    caps['liveSnapshot'] = 'true'
    caps['liveMerge'] = 'true'
    caps['kdumpStatus'] = osinfo.kdump_status()

    caps['hostdevPassthrough'] = str(hostdev.is_supported()).lower()
    # TODO This needs to be removed after adding engine side support
    # and adding gdeploy support to enable libgfapi on RHHI by default
    caps['additionalFeatures'] = ['libgfapi_supported']
    if osinfo.glusterEnabled:
        from vdsm.gluster.api import glusterAdditionalFeatures
        caps['additionalFeatures'].extend(glusterAdditionalFeatures())
    caps['hostedEngineDeployed'] = _isHostedEngineDeployed()
    caps['hugepages'] = hugepages.supported()
    caps['kernelFeatures'] = osinfo.kernel_features()
    caps['vncEncrypted'] = _isVncEncrypted()
    caps['backupEnabled'] = False

    try:
        caps["connector_info"] = managedvolume.connector_info()
    except se.ManagedVolumeNotSupported as e:
        logging.info("managedvolume not supported: %s", e)
    except se.ManagedVolumeHelperFailed as e:
        logging.exception("Error getting managedvolume connector info: %s", e)

    return caps