nova/nova/tests/functional/db
Jay Pipes b10f11d7e8 placement: add nested resource providers
Adds initial support for storing the relationship between parent and
child resource providers. Nested resource providers are essential for
expressing certain types of resources -- in particular SR-IOV physical
functions and certain SR-IOV fully-programmable gate arrays. The
resources that these providers expose are of resource class
SRIOV_NET_VF and we will need a way of indicating that the physical
function providing these virtual function resources is tagged with
certain traits (representing vendor_id, product_id or the physical
network the PF is attached to).

The compute host is a resource provider which has an SR-IOV-enabled
physical function (NIC) as a child resource provider. The physical
function has an inventory containing some total amount of SRIOV_NET_VF
resources. These SRIOV_NET_VF resources are allocated to zero or more
consumers (instances) on the compute host.

                    compute host (parent resource provider)
                         |
                         |
                      SR-IOV PF  (child resource provider)
                         :
                        / \
                       /   \
                    VF1    VF2   (inventory of child provider)

The resource provider model gets two new fields:

 - root_provider_uuid: The "top" or "root" of the tree of nested
   providers
 - parent_provider_uuid: The immediate parent of the provider, or None
   if the provider is a root provider.

The database schema adds two new columns to the resource_providers
table that contain the internal integer IDs that correspond to the
user-facing UUID values:

 - root_provider_id
 - parent_provider_id

The root_provider_uuid field is non-nullable in the ResourceProvider
object definition, and this code includes an online data migration to
automatically populate the root_provider_id field with the value of the
resource_providers.id field for any resource providers already in the
DB.

The root_provider_id field value is populated automatically when a
provider is created. If the parent provider UUID is set, then the
root_provider_id is set to the root_provider_id value of the parent. If
parent is unset, root_provider_id is set to the value of the id
attribute of the provider being created. The corresponding UUID values
for root and parent provider are fetched in the queries that retrieves
resource provider data using two self-referential joins.

The root_provider_id column allows us to do extremely quick lookups of
an entire tree of providers without needing to perform any recursive
database queries.

Logic in this patch ensures that no resource provider can be deleted if
any of its children have any allocations active on them. We also check
to ensure that when created or updated, a resource provider's parent
provider UUID actually points to an existing provider.

It's important to point out that qualitative trait information is only
associated with a resource provider entity, not the resources that
resource provider has in its inventory. This is the reason why nested
resource providers are necessary. In the case of things like NUMA nodes
or SRIOV physical functions, if a compute host had multiple SRIOV
physical functions, each associated with a different network trait,
there would be no way to differentiate between the SRIOV_NET_VF
resources that those multiple SRIOV physical functions provided if the
containing compute host had a single inventory item containing the
total number of VFs exposed by both PFs.

Change-Id: I2d8df57f77a03cde898d9ec792c5d59b75f61204
blueprint: nested-resource-providers
Co-Authored-By: Moshe Levi <moshele@mellanox.com>
2017-11-28 15:29:28 -05:00
..
api placement: add nested resource providers 2017-11-28 15:29:28 -05:00
__init__.py Add second migrate_repo for cells v2 database migrations 2015-03-03 15:41:40 -05:00
test_aggregate.py Remove aggregate uuid generation on load from DB 2017-04-10 18:16:01 -04:00
test_aggregate_model.py Add aggregates tables to the API db. 2016-06-01 12:00:56 -05:00
test_allocation_candidates.py required traits for no sharing providers 2017-11-27 15:13:07 +00:00
test_archive.py cleanup mapping/reqspec after archive instance 2017-11-21 15:28:07 +01:00
test_build_request.py Support tag instances when boot(2/4) 2017-06-06 06:16:41 +00:00
test_cell_mapping.py Fix database poison warnings, part 25 2016-11-10 13:57:13 +00:00
test_compute_node.py Add ComputeNodeList.get_by_hypervisor_type() 2017-09-11 08:16:54 -07:00
test_connection_switch.py Add scatter gather utilities for cells 2017-06-29 19:41:20 +00:00
test_flavor.py Add Flavor.description attribute 2017-11-05 01:24:01 -05:00
test_flavor_model.py Add Flavor.description attribute 2017-11-05 01:24:01 -05:00
test_host_mapping.py Make discover_hosts only query for unmapped ComputeNode records 2017-05-15 10:50:01 -04:00
test_instance.py Add Flavor.description attribute 2017-11-05 01:24:01 -05:00
test_instance_group.py Add InstanceGroup._remove_members_in_db 2017-06-08 21:01:08 +00:00
test_instance_group_model.py Add instance groups tables to the API database 2016-06-23 00:28:50 +00:00
test_instance_mapping.py Add get_by_instance_uuids() to InstanceMappingList 2017-04-06 10:57:06 -07:00
test_keypair.py Cleanup some redundant USES_DB_SELF usage 2016-09-26 15:47:16 -04:00
test_quota.py Count instances to check quota 2017-07-18 17:31:15 +00:00
test_quota_model.py Add quota related tables to the api database. 2016-10-12 07:40:00 +00:00
test_quotas.py Add online migration to move quotas to API database 2017-07-24 18:36:46 -04:00
test_request_spec.py Merge "Remove unused conf" 2016-10-06 20:57:28 +00:00
test_resource_class_cache.py placement: Perform build list of standard classes once 2016-12-05 16:13:49 +00:00
test_resource_provider.py placement: add nested resource providers 2017-11-28 15:29:28 -05:00
test_security_group.py Add SecurityGroupList.get_counts() 2017-06-19 21:51:46 +00:00