Exemple #1
0
 def testCpuTopologyPPC64(self):
     # PPC64 4 sockets, 5 cores, 1 threads per core
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 20)
     self.assertEqual(t.cores, 20)
     self.assertEqual(t.sockets, 4)
Exemple #2
0
 def testCpuTopologyS390X(self):
     # S390 1 socket, 4 cores, 1 threads per core
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #3
0
 def testCpuTopologyX86_64_intel_e31220(self):
     # 1 x Intel E31220 (normal Multi-core)
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #4
0
 def testCpuTopologyX86_64_amd_6272(self):
     # 2 x AMD 6272 (with Modules)
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 32)
     self.assertEqual(t.cores, 16)
     self.assertEqual(t.sockets, 2)
Exemple #5
0
 def test_getCpuTopology(self):
     capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
     t = numa.cpu_topology(capsData)
     self.assertEqual(t.threads, 8)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
     self.assertEqual(t.online_cpus, [0, 1, 2, 3, 4, 5, 6, 7])
Exemple #6
0
    def _recoverExistingVms(self):
        start_time = vdsm.common.time.monotonic_time()
        try:
            self.log.debug('recovery: started')

            # Starting up libvirt might take long when host under high load,
            # we prefer running this code in external thread to avoid blocking
            # API response.
            mog = min(config.getint('vars', 'max_outgoing_migrations'),
                      numa.cpu_topology().cores)
            migration.SourceThread.ongoingMigrations.bound = mog

            recovery.all_domains(self)

            # recover stage 3: waiting for domains to go up
            self._waitForDomainsUp()

            self._recovery = False

            # Now if we have VMs to restore we should wait pool connection
            # and then prepare all volumes.
            # Actually, we need it just to get the resources for future
            # volumes manipulations
            self._waitForStoragePool()

            self._preparePathsForRecoveredVMs()

            self.log.info('recovery: completed in %is',
                          vdsm.common.time.monotonic_time() - start_time)

        except:
            self.log.exception("recovery: failed")
            raise
Exemple #7
0
    def _recoverExistingVms(self):
        start_time = utils.monotonic_time()
        try:
            self.log.debug('recovery: started')

            # Starting up libvirt might take long when host under high load,
            # we prefer running this code in external thread to avoid blocking
            # API response.
            mog = min(config.getint('vars', 'max_outgoing_migrations'),
                      numa.cpu_topology().cores)
            migration.SourceThread.setMaxOutgoingMigrations(mog)

            recovery.all_vms(self)

            # recover stage 3: waiting for domains to go up
            self._waitForDomainsUp()

            recovery.clean_vm_files(self)

            self._recovery = False

            # Now if we have VMs to restore we should wait pool connection
            # and then prepare all volumes.
            # Actually, we need it just to get the resources for future
            # volumes manipulations
            self._waitForStoragePool()

            self._preparePathsForRecoveredVMs()

            self.log.info('recovery: completed in %is',
                          utils.monotonic_time() - start_time)

        except:
            self.log.exception("recovery: failed")
            raise
Exemple #8
0
 def testCpuTopologyX86_64_intel_e5649(self):
     # 2 x Intel E5649 (with Hyperthreading)
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 24)
     self.assertEqual(t.cores, 12)
     self.assertEqual(t.sockets, 2)
Exemple #9
0
 def test_getCpuTopology(self):
     numa.update()
     t = numa.cpu_topology()
     self.assertEqual(t.threads, 8)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
     self.assertEqual(t.online_cpus, [0, 1, 2, 3, 4, 5, 6, 7])
Exemple #10
0
 def test_getCpuTopology(self):
     capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
     t = numa.cpu_topology(capsData)
     self.assertEqual(t.threads, 8)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
     self.assertEqual(t.online_cpus,
                      ['0', '1', '2', '3', '4', '5', '6', '7'])
Exemple #11
0
 def test_getCpuTopology(self):
     capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out")
     t = numa.cpu_topology(capsData)
     self.assertEqual(t.threads, 8)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
     self.assertEqual(t.online_cpus,
                      ['0', '1', '2', '3', '4', '5', '6', '7'])
Exemple #12
0
 def testCpuTopologyS390X(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # S390 1 socket, 4 cores, 1 threads per core
     path = os.path.join(dirName, "caps_libvirt_s390x.out")
     t = numa.cpu_topology(open(path).read())
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #13
0
 def testCpuTopologyPPC64(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # PPC64 4 sockets, 5 cores, 1 threads per core
     path = os.path.join(dirName, "caps_libvirt_ibm_S822L.out")
     t = numa.cpu_topology(open(path).read())
     self.assertEqual(t.threads, 20)
     self.assertEqual(t.cores, 20)
     self.assertEqual(t.sockets, 4)
Exemple #14
0
 def testCpuTopologyS390X(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # S390 1 socket, 4 cores, 1 threads per core
     path = os.path.join(dirName, "caps_libvirt_s390x.out")
     t = numa.cpu_topology(open(path).read())
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #15
0
 def testCpuTopologyPPC64(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # PPC64 4 sockets, 5 cores, 1 threads per core
     path = os.path.join(dirName, "caps_libvirt_ibm_S822L.out")
     t = numa.cpu_topology(open(path).read())
     self.assertEqual(t.threads, 20)
     self.assertEqual(t.cores, 20)
     self.assertEqual(t.sockets, 4)
Exemple #16
0
 def testCpuTopologyX86_64(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # 2 x Intel E5649 (with Hyperthreading)
     path = os.path.join(dirName, "caps_libvirt_intel_E5649.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 24)
     self.assertEqual(t.cores, 12)
     self.assertEqual(t.sockets, 2)
     # 2 x AMD 6272 (with Modules)
     path = os.path.join(dirName, "caps_libvirt_amd_6274.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 32)
     self.assertEqual(t.cores, 16)
     self.assertEqual(t.sockets, 2)
     # 1 x Intel E31220 (normal Multi-core)
     path = os.path.join(dirName, "caps_libvirt_intel_E31220.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #17
0
 def testCpuTopologyX86_64(self):
     testPath = os.path.realpath(__file__)
     dirName = os.path.split(testPath)[0]
     # 2 x Intel E5649 (with Hyperthreading)
     path = os.path.join(dirName, "caps_libvirt_intel_E5649.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 24)
     self.assertEqual(t.cores, 12)
     self.assertEqual(t.sockets, 2)
     # 2 x AMD 6272 (with Modules)
     path = os.path.join(dirName, "caps_libvirt_amd_6274.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 32)
     self.assertEqual(t.cores, 16)
     self.assertEqual(t.sockets, 2)
     # 1 x Intel E31220 (normal Multi-core)
     path = os.path.join(dirName, "caps_libvirt_intel_E31220.out")
     with open(path) as p:
         t = numa.cpu_topology(p.read())
     self.assertEqual(t.threads, 4)
     self.assertEqual(t.cores, 4)
     self.assertEqual(t.sockets, 1)
Exemple #18
0
def _assign_shared(cif, target_vm=None):
    """
    Assign all CPUs from shared pool to all VMs with no policy or to
    a specific VM with no policy.

    :param target_vm: A VM instance, CPUs of which are to be configured with
      shared pool CPU set. If None, all VMs with no specific policy will be
      reconfigured with current shared pool CPU set.
    :type target_vm: vdsm.virt.VM or None
    """
    numa.update()
    core_cpus = numa.core_cpus()
    cpu_topology = numa.cpu_topology()
    cpu_list_length = max(cpu_topology.online_cpus) + 1

    with _shared_pool_lock:
        shared_cpus = _shared_pool(cif, cpu_topology.online_cpus, core_cpus)
        shared_str = ','.join(map(str, shared_cpus))
        cpuset = libvirt_cpuset_spec(shared_cpus, cpu_list_length)
        if target_vm is None:
            vms_to_update = cif.getVMs().values()
        else:
            vms_to_update = [target_vm]
        for vm in vms_to_update:
            if vm.cpu_policy() not in (CPU_POLICY_NONE, CPU_POLICY_MANUAL):
                continue
            try:
                for vcpu in range(vm.get_number_of_cpus()):
                    if (vm.cpu_policy() == CPU_POLICY_MANUAL
                            and vcpu in vm.manually_pinned_cpus()):
                        continue
                    vm.log.debug('configuring vCPU=%d with cpuset="%s"', vcpu,
                                 shared_str)
                    try:
                        vm.pin_vcpu(vcpu, cpuset)
                    except virdomain.NotConnectedError:
                        vm.log.warning(
                            "Cannot reconfigure CPUs, domain not connected.")
                    except libvirt.libvirtError as e:
                        if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
                            vm.log.warning('Cannot reconfigure CPUs,'
                                           ' domain does not exist anymore.')
                        else:
                            raise
            except:
                vm.log.exception(
                    'Failed to update CPU set of the VM to match shared pool')
Exemple #19
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['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
Exemple #20
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
Exemple #21
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())

    # 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
Exemple #22
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
Exemple #23
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
Exemple #24
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