nova/nova/tests/unit/virt/libvirt
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
..
storage tests: refactors and cleans up test_rbd.py 2018-01-30 02:26:07 -08:00
volume Merge "trivial: Don't use 'Test' prefix for non-TestCase classes" 2018-02-20 00:52:02 +00:00
__init__.py
fake_imagebackend.py libvirt: update logic to configure device for scsi controller 2017-07-03 03:23:53 -04:00
fake_libvirt_utils.py Change livesnapshot to true by default 2017-09-22 12:37:58 -04:00
fake_os_brick_connector.py Switch to using os-brick 2015-07-27 10:47:22 -07:00
fakelibvirt.py Fix fake libvirt XML generation for disks 2018-01-03 10:42:01 +00:00
test_blockinfo.py Modify the test case of get_disk_mapping_rescue_with_config 2018-01-12 14:08:51 +08:00
test_compat.py Workaround for race condition in libvirt 2015-03-14 20:17:41 -03:00
test_config.py libvirt: Allow to specify granular CPU feature flags 2018-04-05 16:05:27 +02:00
test_designer.py libvirt: conditionally set script path for ethernet vif types 2017-03-21 14:12:39 -04:00
test_driver.py libvirt: Allow to specify granular CPU feature flags 2018-04-05 16:05:27 +02:00
test_fakelibvirt.py conf: Deprecate 'keymap' options 2018-03-07 10:18:23 +00:00
test_firewall.py Don't modify objects directly 2018-01-30 16:35:02 +00:00
test_guest.py Merge "libvirt: add method to configure migration speed" 2017-10-19 03:36:53 +00:00
test_host.py Encode libvirt domain XML in UTF-8 2018-02-08 15:45:59 -05:00
test_imagebackend.py Fix unit test failures when direct IO not supported 2017-12-17 04:24:01 +00:00
test_imagecache.py Move the dac_admin privsep code to a new location. 2017-09-18 23:14:11 +10:00
test_migration.py libvirt: QEMU native LUKS decryption for encrypted volumes 2018-01-23 10:47:05 +00:00
test_utils.py qemu-img do not use cache=none if no O_DIRECT support 2017-11-29 22:33:39 +00:00
test_vif.py Merge "Update plugs Contrail methods to work with privsep" 2018-02-21 22:38:34 +00:00