nova/nova/tests/unit/virt
Kashyap Chamarthy 6b601b7cf6 libvirt: Allow to specify granular CPU feature flags
The recent "Meltdown" CVE fixes have resulted in a critical performance
penalty[*] that will impact every Nova guest with certain CPU models.

I.e. assume you have applied all the "Meltdown" CVE fixes, and performed
a cold reboot (explicit stop & start) of all Nova guests, for the
updates to take effect.  Now, if any guests that are booted with certain
named virtual CPU models (e.g. "IvyBridge", "Westmere", etc), then those
guests, will incur noticeable performance degradation[*], while being
protected from the CVE itself.

To alleviate this guest performance impact, it is now important to
specify an obscure Intel CPU feature flag, 'PCID' (Process-Context ID)
-- for the virtual CPU models that don't already include it (more on
this below).  To that end, this change will allow Nova to explicitly
specify CPU feature flags via a new configuration attribute,
`cpu_model_extra_flags`, e.g. in `nova.conf`:

    ...
    [libvirt]
    cpu_mode = custom
    cpu_model = IvyBridge
    cpu_model_extra_flags = pcid
    ...

NB: In the first iteration, the choices for `cpu_model_extra_flags` is
restricted to only 'pcid' (the option is case-insensitive) -- to address
the earlier mentioned guest performance degradation.  A future patch
will remove this restriction, allowing to add / remove multiple CPU
feature flags, thus making way for other useful features.

Some have asked: "Why not simply hardcode the 'PCID' CPU feature flag
into Nova?"  That's not graceful, and more importantly, impractical:

  (1) Not every Intel CPU model has 'PCID':

       - The only Intel CPU models that include the 'PCID' capability
         are: "Haswell", "Broadwell", and "Skylake" variants.

       - The libvirt / QEMU Intel CPU models: "Nehalem", "Westmere",
         "SandyBridge", and "IvyBridge" will *not* expose the 'PCID'
         capability, even if the host CPUs by the same name include it.
         I.e. 'PCID' needs to be explicitly when using the said virtual
         CPU models.

  (2) Magically adding new CPU feature flags under the user's feet
      impacts live migration.

[*] https://groups.google.com/forum/m/#!topic/mechanical-sympathy/L9mHTbeQLNU

Closes-Bug: #1750829
Change-Id: I6bb956808aa3df58747c865c92e5b276e61aff44
BluePrint: libvirt-cpu-model-extra-flags
2018-04-05 16:05:27 +02:00
..
disk Merge "Don't launch guestfs in a thread pool if guestfs.debug is enabled" 2018-01-31 13:30:44 +00:00
hyperv Merge "hyper-v: Logs tips on PortBindingFailed" 2018-03-07 16:29:24 +00:00
image Use assert(Not)Equal instead of assertTrue(A == X) 2016-06-03 16:53:15 +01:00
ironic ironic: stop lying to the RT when ironic is down 2018-03-20 19:13:07 +00:00
libvirt libvirt: Allow to specify granular CPU feature flags 2018-04-05 16:05:27 +02:00
powervm remove unnecessary conf imports 2018-03-09 14:30:10 -05:00
vmwareapi Merge "VMware: fix TypeError while get console log" 2018-03-20 01:59:40 +00:00
xenapi Move resource class fields 2018-03-13 09:01:30 +00:00
__init__.py
fakelibosinfo.py Fix misuse of assertTrue in console and virt tests 2016-02-22 16:09:21 +09:00
test_block_device.py Preserve multiattach flag when refreshing connection_info 2018-03-20 15:16:20 -04:00
test_configdrive.py force_config_drive: StrOpt -> BoolOpt 2015-11-11 19:59:22 +00:00
test_driver.py Remove usage of parameter enforce_type 2017-04-17 20:23:19 +08:00
test_events.py
test_fake.py
test_firewall.py remove get_nw_info_for_instance from compute.utils 2017-06-13 13:30:06 +02:00
test_hardware.py Merge "Add unit tests for EmulatorThreadsTestCase" 2018-03-22 07:26:58 +00:00
test_imagecache.py Remove mox from tests/unit/virt/test_imagecache.py 2016-06-16 23:40:01 +00:00
test_images.py qemu-img do not use cache=none if no O_DIRECT support 2017-11-29 22:33:39 +00:00
test_netutils.py Remove unnecessary code 2017-07-28 06:01:21 +00:00
test_osinfo.py Do not attempt to load osinfo if we do not have os_distro 2017-03-23 22:07:03 -04:00
test_virt_drivers.py Pass user context to virt driver when detaching volume 2018-03-03 06:11:12 -05:00
test_virt.py Rename block_device_info_get_root 2018-01-11 20:46:13 +00:00