Libvirt: Correct PERF_EVENTS_CPU_FLAG_MAPPING
History: libvirt 1.3.3 had added perf event support for cmt, mbmt, mbml support when we landing the spec https://blueprints.launchpad.net/nova/+spec/support-perf-event . For the event cmt, mbmt, mbml, we requires that libvirt to expose some some specify cpu features, but libvirt 2.0.0 only has that expose merged `cpu_map.xml: add cmt/mbm feature to x86 (Qiaowei Ren)`, the capabilities changed to: <feature name='mbm_total'/> <feature name='mbm_local'/> <feature name='cmt'/> Need to adopt this to let nova driver discover these features when enable cmt, mbmt, mbml event. That is to say: even libvirt 1.3.3 has support perf event, but nova cannot get noticed since libvirt don't expose cpu features until 2.0.0. This patch bump MIN_LIBVIRT_PERF_VERSION to 2.0.0, see: https://libvirt.org/formatdomain.html#elementsPerf Closes-Bug: #1620445 Change-Id: Ie896cfd478f4528903ca5dd56c61680837b646b7
This commit is contained in:
parent
ed435f2680
commit
a2d0b8d1b0
@ -448,7 +448,8 @@ Related options:
|
||||
This is a performance event list which could be used as monitor. These events
|
||||
will be passed to libvirt domain xml while creating a new instances.
|
||||
Then event statistics data can be collected from libvirt. The minimum
|
||||
libvirt version is 1.3.3.
|
||||
libvirt version is 2.0.0. For more information about `Performance monitoring
|
||||
events`, refer https://libvirt.org/formatdomain.html#elementsPerf .
|
||||
|
||||
* Possible values:
|
||||
A string list.
|
||||
|
@ -5623,7 +5623,6 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
|
||||
@mock.patch.object(host.Host, "get_capabilities")
|
||||
def _test_get_guest_with_perf(self, caps, events, mock_get_caps):
|
||||
self.flags(enabled_perf_events=['cmt'], group='libvirt')
|
||||
mock_get_caps.return_value = caps
|
||||
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
@ -5641,21 +5640,31 @@ class LibvirtConnTestCase(test.NoDBTestCase):
|
||||
|
||||
@mock.patch.object(fakelibvirt, 'VIR_PERF_PARAM_CMT', True,
|
||||
create=True)
|
||||
@mock.patch.object(fakelibvirt, 'VIR_PERF_PARAM_MBMT', True,
|
||||
create=True)
|
||||
@mock.patch.object(fakelibvirt, 'VIR_PERF_PARAM_MBML', True,
|
||||
create=True)
|
||||
@mock.patch.object(host.Host, 'has_min_version', return_value=True)
|
||||
def test_get_guest_with_perf_supported(self,
|
||||
mock_min_version):
|
||||
self.flags(enabled_perf_events=['cmt'], group='libvirt')
|
||||
self.flags(enabled_perf_events=['cmt', 'mbml', 'mbmt'],
|
||||
group='libvirt')
|
||||
caps = vconfig.LibvirtConfigCaps()
|
||||
caps.host = vconfig.LibvirtConfigCapsHost()
|
||||
caps.host.cpu = vconfig.LibvirtConfigCPU()
|
||||
caps.host.cpu.arch = "x86_64"
|
||||
caps.host.topology = self._fake_caps_numa_topology()
|
||||
feature = vconfig.LibvirtConfigGuestCPUFeature()
|
||||
feature.name = 'cqm'
|
||||
feature.policy = cpumodel.POLICY_REQUIRE
|
||||
caps.host.cpu.features = set([feature])
|
||||
|
||||
self._test_get_guest_with_perf(caps, ['cmt'])
|
||||
features = []
|
||||
for f in ('cmt', 'mbm_local', 'mbm_total'):
|
||||
feature = vconfig.LibvirtConfigGuestCPUFeature()
|
||||
feature.name = f
|
||||
feature.policy = cpumodel.POLICY_REQUIRE
|
||||
features.append(feature)
|
||||
|
||||
caps.host.cpu.features = set(features)
|
||||
|
||||
self._test_get_guest_with_perf(caps, ['cmt', 'mbml', 'mbmt'])
|
||||
|
||||
@mock.patch.object(host.Host, 'has_min_version')
|
||||
def test_get_guest_with_perf_libvirt_unsupported(self, mock_min_version):
|
||||
|
@ -310,12 +310,12 @@ MIN_QEMU_OTHER_ARCH = {arch.S390: MIN_QEMU_S390_VERSION,
|
||||
}
|
||||
|
||||
# perf events support
|
||||
MIN_LIBVIRT_PERF_VERSION = (1, 3, 3)
|
||||
MIN_LIBVIRT_PERF_VERSION = (2, 0, 0)
|
||||
LIBVIRT_PERF_EVENT_PREFIX = 'VIR_PERF_PARAM_'
|
||||
|
||||
PERF_EVENTS_CPU_FLAG_MAPPING = {'cmt': 'cqm',
|
||||
'mbml': 'cqm_mbm_local',
|
||||
'mbmt': 'cqm_mbm_total',
|
||||
PERF_EVENTS_CPU_FLAG_MAPPING = {'cmt': 'cmt',
|
||||
'mbml': 'mbm_local',
|
||||
'mbmt': 'mbm_total',
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,4 +3,4 @@ features:
|
||||
- Add perf event support for libvirt driver.
|
||||
This can be done by adding new configure option
|
||||
'enabled_perf_events' in libvirt section of
|
||||
nova.conf. This feature requires libvirt>=1.3.3.
|
||||
nova.conf. This feature requires libvirt>=2.0.0.
|
||||
|
Loading…
Reference in New Issue
Block a user