diff options
author | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-07-08 18:47:46 +0200 |
---|---|---|
committer | Balazs Gibizer <balazs.gibizer@est.tech> | 2021-08-21 10:25:00 +0200 |
commit | d6cd4420bb33501e267b10ccc3a1f26ab2c8c85b (patch) | |
tree | 8608bdd4b1b8d1547fc7b674b0caa1afadc53b0c /nova/network | |
parent | ec6f8f63f9c03d4572a7ad59f940c4dd7cf3ba66 (diff) | |
download | nova-d6cd4420bb33501e267b10ccc3a1f26ab2c8c85b.tar.gz |
Parse extended resource request from the port data
The format of the value of the resource_request field of the port has
been changed by the port-resource-request-groups Neutron API extension.
This patch adds a new factory method for RequestGroup to parse the data
and create the RequestGroup objects corresponding to the request. Also
the neutron interface of nova changed to use the new factory if the new
neutron API extension is present.
Note that we have to keep the old logic in place to support the scenario
when Nova is upgraded first and therefore Neutron is still using the old
resource_request format.
Also note that some of the so far skipped functional tests started to
pass as they are negative tests resulting in an unsuccessful operation due to
not related reasons and the code already works good enough to hit those
negative code paths.
blueprint: qos-minimum-guaranteed-packet-rate
Change-Id: If7b80c8725d9a8183d2df05c824461e8ee5f45d0
Diffstat (limited to 'nova/network')
-rw-r--r-- | nova/network/neutron.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/nova/network/neutron.py b/nova/network/neutron.py index cf5d366ab9..eab727881e 100644 --- a/nova/network/neutron.py +++ b/nova/network/neutron.py @@ -2065,6 +2065,8 @@ class API: tunneled = False neutron = get_client(context, admin=True) + has_extended_resource_request_extension = ( + self._has_extended_resource_request_extension(context, neutron)) resource_requests = [] for request_net in requested_networks: @@ -2111,13 +2113,26 @@ class API: resource_requests.extend(dp_request_groups) if resource_request: - # NOTE(gibi): explicitly orphan the RequestGroup by setting - # context=None as we never intended to save it to the DB. - resource_requests.append( - objects.RequestGroup.from_port_request( - context=None, - port_uuid=request_net.port_id, - port_resource_request=resource_request)) + if has_extended_resource_request_extension: + # need to handle the new resource request format + # NOTE(gibi): explicitly orphan the RequestGroup by + # setting context=None as we never intended to save it + # to the DB. + resource_requests.extend( + objects.RequestGroup.from_extended_port_request( + context=None, + port_resource_request=resource_request)) + else: + # keep supporting the old format of the + # resource_request + # NOTE(gibi): explicitly orphan the RequestGroup by + # setting context=None as we never intended to save it + # to the DB. + resource_requests.append( + objects.RequestGroup.from_port_request( + context=None, + port_uuid=request_net.port_id, + port_resource_request=resource_request)) elif request_net.network_id and not request_net.auto_allocate: network_id = request_net.network_id |