DB call method get_all_by_resource_provider_uuid queries all
Inventories and filters them by provider's uuid from ResourceProvider,
but query list is not valid (contains inventories for all providers),
the correct way to load ResourceProvider is to use query join. Replace
joinedload with contains_eager to avoid redundant joins.
As result last updated provider overwrites all provider's inventories
with wrong data.
Closes-Bug: #1572555
Change-Id: I49fb1bf63400280635c202dea8f870d727a91e81
CellsV2 requires that aggregates be available in the API db. Create
the 'aggregates', 'aggregate_metadata' and 'aggregate_hosts' tables in the
API db.
blueprint cells-aggregate-api-db
Change-Id: I19fa3a28181831c5cd7b19cd2a5a2ea0d40e45f8
This just mirrors the DB schema baked in the cell DB up to the API DB.
Related to blueprint generic-resource-pools
Change-Id: I8324a8b9c5ba640e48b6d6e426f7d8073a1b962b
Now that there's a serialized instance object on the BuildRequest object
and in the build_requests table a lot of fields/columns are no longer
necessary. To prepare for removal of the columns from the db at a later
time references to them have been removed. This starts a deprecation
timer so that they can be removed in Ocata at the earliest.
Note that the BuildRequest object was never passed over the wire, and is
just created and immediately destroyed at this point so there is no need
to handle backwards compatibility for these changes.
Change-Id: Ie86ba66d5f73c153b68bef83661d4c8bdb0ae9dc
Now that a serialized Instance object is being stored in the
build_requests table most of the other columns are no longer necessary
and should be deprecated. By first allowing them to be nullable they can
then be removed from the BuildRequest object and then removed in Ocata.
Also remove a UniqueConstraint that is no longer necessary.
Change-Id: I92fa2381c43e5e05d95bbcf9a7bb4306d3b3b856
Partially-implements: bp add-buildrequest-obj
This adds the keypairs table to the API database and the corresponding
model.
Related to cells-keypairs-api-db
Change-Id: I5f6d88fee47dd87de2867d3947d65b04f0b21e8f
New fields keep needing to be added to build_requests in order to
capture all of the relevant instance information necessary. At this
point it's simpler to just embed a serialized Instance object in the db.
A column for that is added, as well as an instance_uuid column for
indexed lookups.
Change-Id: I1628ddd8cb75b4d0a7bbcd2720536c2e0bfc6043
Partially-implements: bp add-buildrequest-obj
Right now InstanceMapping exposes the cell_mappings.id db field which is
just an implementation detail of the db relationship and should not be
exposed in the object. It is also useless as a way to look up the actual
CellMapping through that object interface. And InstanceMapping is only
looked up in order to find a CellMapping.
So the CellMapping should be joined during the db query and loaded on
the InstanceMapping object by default.
Change-Id: Ia8691b76bba310327bfe0995964525409794d1af
Some api database models did not have backrefs setup for their
relationships which affected how queries were done and the result sets
were handled. This diverged from how it's done elsewhere in Nova which
led to many questions on reviews. So backrefs have been added to bring
this in line with the rest of the models.
back_populates is used in one spot which is functionally equivalent to
backref except that it requires the relationship to be defined on both
sides. Since one side was already defined I used back_populate here to
minimize changes.
Change-Id: If653143738c91771e845ceb127e60cead8d40fae
This makes the Flavor object get operations attempt to first load the
flavor from the api database, falling back to the main one if the
requested flavor is not found.
Note that I had to add backrefs for projects and extra_specs to the
Flavors model, which didn't have them yet. This is tested by the
code that tests loading from the actual DB models.
Related to blueprint flavor-cell-api
Co-Authored-By: Lalit Dagre <lalitdagre@gmail.com>
Change-Id: Ibc239a3d0ac0d22494919554024d1ba07a632218
In order to indicate that an instance boot request has been received,
but the instance has not yet been scheduled to a cell, it should be
mapped to a null cell_id. This will mean that an instance list/show will
need to fetch the instance details from the BuildRequest object rather
than looking for the instance in a cell database. A migration is added
and the InstanceMapping object is modified to make this possible.
Partially-implements: bp cells-scheduling-interaction
Change-Id: Iee768512314f11a13e2a85a1e7d5442864ddbc4b
The build_requests table is a placeholder in the api database that
stores enough information about a boot request to hydrate an Instance if
necessary. It will be populated early in the boot process so that instance
creation can be deferred until after scheduling.
Partially-implements: bp cells-scheduling-interaction
Change-Id: I8755e57c0ea9afd1c83751dea75cca640e304ab0
Creates the tables "flavors", "flavor_extra_specs" and "flavor_projects"
in the API database for cellsV2.
Co-Authored-By: Lalit Dagre <lalitdagre@gmail.com>
Change-Id: I6cdba5cc98a9f1595ef89244c47e9f63805451e7
Implements: blueprint flavor-cell-api
In order to use the request spec for an instance boot during later
scheduling operations, like resize/migrate, it needs to be persisted.
This adds a db migration to store the request spec and methods to the
object to create/save/get the request spec.
The RequestSpec object is also important for cells v2 so that boot
requests can have their information persisted before the creation of an
instance record in the database.
Change-Id: I94cd50ad29e10eb320d1d78f3081db6519815ff9
Implements: bp persist-request-spec
This patch creates the host_mappings table in the API database for cellsv2.
This table will contain mapping of compute hosts to cells.
Change-Id: I1bd35434ce186e1fb49d56c621bff3f09aa90138
Implements: blueprint cells-host-mapping
This creates the instance_mappings table for cells v2. This table will
contain a mapping for which cell an instance belongs to. project_id is
included so that it is easy to get a full listing of instances for a
project.
Change-Id: Ic5a2f0add7455ff030fa8acc41b9304205ced715
bp: cells-instance-mapping
This creates the first new table for cells v2. This table will hold
information on how nova-api can communicate with each cell.
Change-Id: Ib224c5b22a350c6e22a95df2bc03ad96683b4c96
bp: cells-v2-mapping