Merge "Libvirt: Correct PERF_EVENTS_CPU_FLAG_MAPPING"

This commit is contained in:
Jenkins 2016-09-08 14:01:08 +00:00 committed by Gerrit Code Review
commit 27b29847ca
4 changed files with 23 additions and 13 deletions

View File

@ -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.

View File

@ -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):

View File

@ -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',
}

View File

@ -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.