def test_get_emulated_machines(self): capsData = self._readCaps("caps_libvirt_intel_i73770_nosnap.out") result = set(machinetype.emulated_machines('x86_64', capsData)) expected = {'rhel6.3.0', 'rhel6.1.0', 'rhel6.2.0', 'pc', 'rhel5.4.0', 'rhel5.4.4', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0', 'rhel5.5.0'} self.assertEqual(expected, result)
def testEmulatedMachines(self): capsData = self._readCaps("caps_libvirt_amd_6274.out") machines = set(machinetype.emulated_machines(cpuarch.X86_64, capsData)) expectedMachines = {'pc-1.0', 'pc', 'isapc', 'pc-0.12', 'pc-0.13', 'pc-0.10', 'pc-0.11', 'pc-0.14', 'pc-0.15'} self.assertEqual(machines, expectedMachines)
def test_get_emulated_machinesWithTwoQEMUInstalled(self): capsData = self._readCaps("caps_libvirt_multiqemu.out") result = set(machinetype.emulated_machines('x86_64', capsData)) expected = { 'pc-i440fx-rhel7.1.0', 'rhel6.3.0', 'pc-q35-rhel7.0.0', 'rhel6.1.0', 'rhel6.6.0', 'rhel6.2.0', 'pc', 'pc-q35-rhel7.1.0', 'q35', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0', 'pc-i440fx-rhel7.0.0' } self.assertEqual(expected, result)
def test_get_emulated_machinesCanonical(self): capsData = self._readCaps("caps_libvirt_intel_E5606.out") result = set(machinetype.emulated_machines('x86_64', capsData)) expected = { 'pc-i440fx-rhel7.1.0', 'rhel6.3.0', 'pc-q35-rhel7.0.0', 'rhel6.1.0', 'rhel6.6.0', 'rhel6.2.0', 'pc', 'pc-q35-rhel7.1.0', 'q35', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0', 'pc-i440fx-rhel7.0.0' } self.assertEqual(expected, result)
def test_get_emulated_machinesWithTwoQEMUInstalled(self): capsData = self._readCaps("caps_libvirt_multiqemu.out") result = set(machinetype.emulated_machines('x86_64', capsData)) expected = {'pc-i440fx-rhel7.1.0', 'rhel6.3.0', 'pc-q35-rhel7.0.0', 'rhel6.1.0', 'rhel6.6.0', 'rhel6.2.0', 'pc', 'pc-q35-rhel7.1.0', 'q35', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0', 'pc-i440fx-rhel7.0.0'} self.assertEqual(expected, result)
def test_get_emulated_machinesCanonical(self): capsData = self._readCaps("caps_libvirt_intel_E5606.out") result = set(machinetype.emulated_machines('x86_64', capsData)) expected = {'pc-i440fx-rhel7.1.0', 'rhel6.3.0', 'pc-q35-rhel7.0.0', 'rhel6.1.0', 'rhel6.6.0', 'rhel6.2.0', 'pc', 'pc-q35-rhel7.1.0', 'q35', 'rhel6.4.0', 'rhel6.0.0', 'rhel6.5.0', 'pc-i440fx-rhel7.0.0'} self.assertEqual(expected, result)
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
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
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
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
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
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