nova/nova/objects
Stephen Finucane 8da70ef95e hardware: Differentiate between shared and dedicated CPUs
Start making use of the new fields added to the 'NUMACell' object and
store things differently. There are a lot of mechanical changes required
to fix these. The bulk of these fall into one of three categories:

- Migrating 'NUMACell.cpuset' values to 'NUMACell.pcpuset' where
  necessary (hint: if we were testing something to do with a instance
  NUMA topology with pinning, we need to migrate the field)
- Configuring the 'cpu_shared_set' and 'cpu_dedicated_set' config
  options (from the '[compute]' group) and changing calls to
  'nova.virt.hardware.get_vcpu_pin_set' to '_get_vcpu_available'
  and/or '_get_pcpu_available'. This is necessary because the
  '_get_guest_numa_config' function has changed to call the latter
  instead of the former.
- Removing checks for 'NUMACell.cpu_usage' for pinned tests, since this
  no longer counts usage of pinned CPUs (that's handled by the
  'pinned_cpus' field on the same object)

The only serious deviation from this is the
'test_get_guest_config_numa_host_instance_cpu_pinning_realtime' test,
which has to have configuration added to ensure the guest looks like it
has CPU pinning configured. This test was pretty much broken before.

It's useful to understand the lifecycle of the 'NUMATopology' object in
order to understand the upgrade impacts of this change, in so far as it
relates to the libvirt virt driver. We generate a 'NUMATopology' object
on the compute node in the 'LibvirtDriver._get_host_numa_topology'
method and report that as part of the 'ComputeNode' object provided to
the resource tracker from the 'LibvirtDriver.get_available_resource'
method. The 'NUMATopology' object generated by the driver *does not*
include any usage information, meaning the fields 'cpu_usage',
'pinned_cpus' and 'memory_usage' are set to empty values. Instead, these
are calculated by calling the 'hardware.numa_usage_from_instance_numa'
function. This happens in two places, in the resource tracker as part of
the 'ResourceTracker._update_usage' method, which is called by the
'ResourceTracker.update_usage' periodic task as well as by other
internal operations each time a instance is created, moved or destroyed,
and in the 'HostState._update_from_compute_node' method, which is called
by the 'HostState.update' method on the scheduler at startup.

As a result of the above, there isn't a significant upgrade impact for
this and it remains possible to run older Stein-based compute nodes
alongside newer Train-based compute nodes. There are two things that
make this possible. Firstly, at no point in this entire process does a
'NUMATopology' object make its way back to the compute node once it
leaves, by way of a 'ComputeNode' object. That's true for objects in
general and means we don't need to worry about the compute node seeing
these new object fields and not being able to understand them. Secondly,
we have checks in that crucial 'hardware.numa_usage_from_instance_numa'
function, which will check if 'pcpuset' is not set (meaning it's a
pre-Train compute node) and set this locally. Because the virt driver
doesn't set the usage-related fields, this is the only field we need to
care about.

Part of blueprint cpu-resources

Change-Id: I492803eaacc34c69af073689f9159449557919db
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-09-18 00:21:10 +01:00
..
__init__.py object: Introduce Resource and ResourceList objs 2019-09-13 08:50:35 +00:00
agent.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
aggregate.py DB API changes to get non-matching aggregates from metadata 2019-09-12 16:56:32 -05:00
bandwidth_usage.py Stop handling 'update_cells' on 'BandwidthUsage.create' 2019-05-20 10:29:16 +01:00
base.py object: Introduce Resource and ResourceList objs 2019-09-13 08:50:35 +00:00
block_device.py Remove 'bdm_(update_or_create|destroy)_at_top' 2019-04-16 18:26:17 +01:00
build_request.py Add Instance.hidden field 2019-08-07 17:56:01 -04:00
cell_mapping.py Fix using template cell urls with nova-manage 2019-01-17 14:18:14 -08:00
compute_node.py hacking: Resolve W503 (line break occurred before a binary operator) 2019-06-24 14:24:06 -05:00
console_auth_token.py Merge "objects: Remove ConsoleAuthToken.to_dict" 2019-09-06 18:51:31 +00:00
diagnostics.py Added nova objects for intance diagnostics 2017-05-30 00:39:44 +04:00
dns_domain.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
ec2.py objects: Remove unused ec2 objects 2019-07-10 16:15:20 +01:00
external_event.py API microversion 2.76: Add 'power-update' external event 2019-08-15 13:19:44 -04:00
fields.py Merge "object: Introduce Resource and ResourceList objs" 2019-09-15 06:33:06 +00:00
fixed_ip.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
flavor.py Merge "Remove old flavor_create db api method" 2018-03-20 18:11:06 +00:00
floating_ip.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
host_mapping.py Warn for duplicate host mappings during discover_hosts 2019-06-13 17:18:16 +00:00
hv_spec.py objects: Move 'hv_type' to 'fields.HVType' 2016-11-25 16:19:43 +00:00
image_meta.py Add extra spec parameter and image property for memory encryption 2019-09-01 15:17:31 +01:00
instance.py object: Introduce Resource and ResourceList objs 2019-09-13 08:50:35 +00:00
instance_action.py Add InstanceAction/Event create() method 2019-08-07 17:56:01 -04:00
instance_fault.py Remove 'instance_fault_create_at_top' 2019-04-29 17:54:17 +01:00
instance_group.py Avoid unnecessary joins in InstanceGroup.get_hosts 2019-05-23 11:14:55 -04:00
instance_info_cache.py Remove 'instance_info_cache_update_at_top' 2019-04-29 17:55:41 +01:00
instance_mapping.py hacking: Resolve W503 (line break occurred before a binary operator) 2019-06-24 14:24:06 -05:00
instance_numa.py objects: Add 'InstanceNUMATopology.cpu_pinning' property 2019-09-18 00:19:33 +01:00
instance_pci_requests.py [FUP] Follow-up patch for SR-IOV live migration 2019-07-02 13:52:01 -05:00
keypair.py Drop migrate_keypairs_to_api_db data migration 2019-04-03 11:42:48 -04:00
migrate_data.py New objects for NUMA live migration 2019-09-12 17:34:34 -04:00
migration.py Set user_id/project_id from context when creating a Migration 2019-09-12 16:52:26 +00:00
migration_context.py object: Introduce Resource and ResourceList objs 2019-09-13 08:50:35 +00:00
monitor_metric.py Fix MonitorMetric obj_make_compatible 2016-09-12 14:10:41 +00:00
network.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
network_metadata.py Assorted cleanups from numa-aware-vswitches series 2018-07-27 09:49:12 -07:00
network_request.py Merge "Remove DictCompat from NetworkRequest" 2016-06-30 10:23:36 +00:00
numa.py hardware: Differentiate between shared and dedicated CPUs 2019-09-18 00:21:10 +01:00
pci_device.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
pci_device_pool.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
quotas.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
request_spec.py Note about Destination.forbidden_aggregates 2019-09-12 20:18:01 +00:00
resource.py libvirt: Enable driver discovering PMEM namespaces 2019-09-13 08:50:35 +00:00
security_group.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
security_group_rule.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
selection.py Move the to_dict() method to the Selection object 2017-12-07 15:01:09 +00:00
service.py NUMA live migration support 2019-09-12 17:34:34 -04:00
tag.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
task_log.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
trusted_certs.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
vcpu_model.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
virt_cpu_topology.py cleanup NovaObjectDictCompat from virt_cpu_topology 2015-08-05 08:56:30 +05:30
virt_device_metadata.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
virtual_interface.py Populate InstanceMapping.user_id during migrations and schedules 2019-03-08 19:01:25 -05:00
volume_usage.py Transform volume.usage notification 2018-10-09 06:28:11 +00:00