Use uuids in services and os-hypervisors APIs
We currently leak database id fields (primary keys) out of the compute REST API for services and compute_nodes which are all in a cell database (the 'nova' database in a cells v2 deployment). These are in the os-services and os-hypervisors APIs, respectively.
For example, to delete a service record, you must issue a DELETE request to /os-services/
The os-hypervisors API exposes the id in GET (index) requests and uses it in the "show" and "uptime" methods to look up the ComputeNode object by that id.
This is gross but functional in a single-cell deployment. However, in a multi-cell deployment, we have no context on which cell we should query to get service/node details from, since you could have multiple cells each with a nova-compute service and compute node with id 1, so which cell do you pick to delete the service or show details about the hypervisor?
This blueprint proposes to add a microversion to the compute REST API which replaces the usage of the id field with a uuid field. The uuid would be returned instead of the id in GET responses and also taken as input for the id in CRUD APIs.
Then when a request to delete a service is made, if the uuid is provided we can simply iterate cells until we find the service, or error with a 404.
Before the microversion, if an id is passed and there is only one cell, or no duplicates in multiple cells, we'll continue to honor the request. But if an id is passed on the request (before the microversion) and we cannot uniquely identify the record out of multiple cells, we error with a 400. This is similar behavior to how creating a server works when a network or port is not provided and there are multiple networks available to the project, we fail with a 400 "NetworkAmbiguous" error.
The compute_nodes table already has a uuid field. The services table, however, does not, so as part of this blueprint we'll need to add a uuid column to that table and corresponding versioned object.
Blueprint information
- Status:
- Complete
- Approver:
- Sean Dague
- Priority:
- Medium
- Drafter:
- Matt Riedemann
- Direction:
- Approved
- Assignee:
- Matt Riedemann
- Definition:
- Approved
- Series goal:
- Accepted for pike
- Implementation:
- Implemented
- Milestone target:
- pike-3
- Started by
- Matt Riedemann
- Completed by
- Matt Riedemann
Related branches
Related bugs
Bug #1690845: hypervisor show/uptime may give inaccurate results when using multiple cells and a duplicate id | Confirmed |
Sprints
Whiteboard
LGTM (dansmith 8-Mar-2017)
I'm going to remove os-pci from this blueprint since that API isn't even exposed:
http://
-- mriedem 20170317
Gerrit topic: https:/
Addressed by: https:/
Use uuids in services and os-hypervisors APIs (spec)
Addressed by: https:/
Add uuid to Service model
Addressed by: https:/
Add online data migration for populating services.uuid
Addressed by: https:/
db api: add get_service_by_uuid
Addressed by: https:/
objects: add Service.get_by_uuid method
Addressed by: https:/
db api: add compute_
Addressed by: https:/
objects: add ComputeNode.
Addressed by: https:/
Add uuid to service.update notification payload
Addressed by: https:/
Handle uuid in HostAPI.
Addressed by: https:/
Handle uuid in HostAPI.
Gerrit topic: https:/
Addressed by: https:/
Use uuid for id in Services API
Addressed by: https:/
WIP: Handle uuids in os-hypervisors API
Addressed by: https:/
Centralize compute_
Addressed by: https:/
Stop caching compute nodes in the request
Addressed by: https:/
Consolidate index and detail methods in HypervisorsCont
Addressed by: https:/
Support paging over compute nodes with a uuid marker
Addressed by: https:/
api-ref: fix description of service_
REST API changes are done for this blueprint with microversion 2.53. Now just need to complete the python-novaclient changes. -- mriedem 20170719
The python-novaclient support for microversion 2.53 is merged now so I'm going to mark this complete. -- mriedem 20170726
Work Items
Dependency tree
* Blueprints in grey have been implemented.