allocation key is missing from the binding:profile of the neutron qos port when the server is created by a non-admin user
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Balazs Gibizer | ||
Stein |
Fix Committed
|
Medium
|
Balazs Gibizer | ||
Train |
Fix Committed
|
Medium
|
Balazs Gibizer |
Bug Description
Description
===========
When a server is create by a non-admin tenant with a qos neutron port Nova does not add the allocation key to the binding:profile of the port.
Steps to reproduce
==================
1) Set up a devstack with bandwidth inventory
* sudo ovs-vsctl add-br br-test
* devstack local conf:
[[post-
[DEFAULT]
service_plugins = router, placement, qos
[[post-
[ml2]
extension_drivers = port_security,qos
mechanism_drivers = openvswitch
tenant_
[ml2_type_vlan]
network_vlan_ranges = physnet0:1000:2000
[ovs]
bridge_mappings = public:
resource_
[ovs_driver]
vnic_type_blacklist = direct
* stack.sh
2) As admin user set up a network and a qos policy:
* openstack network create net-demo --provider-
* openstack subnet create subnet-demo --network net-demo --subnet-range 10.0.4.0/24
* openstack network qos policy create qp-demo --share
* openstack network qos rule create qp-demo --type minimum-bandwidth --min-kbps 1000 --egress
* openstack network qos rule create qp-demo --type minimum-bandwidth --min-kbps 1000 --ingress
3) As a normal user (demo in devstack) create a port with the qos policy and create a server with the port
* openstack port create port-normal-
* openstack --os-compute-
Expected result
===============
1) Server is reaching ACTIVE state
2) Bandwidth allocation is created in placement according to the qp-demo policy
3) The allocation key of the binding:profile of the port-normal-
Actual result
=============
1) and 2) are as expected but the binding:porfile of the neutron port does not have an allocation key.
Note that if the server is booted as admin user then both 1) 2) 3) are as expected.
Environment
===========
Devstack from master:
stack@aio:
d3403e5294 Merge "Fix unit of hw_rng:rate_period"
stack@aio:
2ffaa40b43 Merge "ovsdb monitor: handle modified ports"
Triage
======
Looking at the port-normal-
As demo:
stack@aio:~$ openstack port show port-normal-
+------
| Field | Value |
+------
| admin_state_up | UP |
| allowed_
| binding_host_id | None |
| binding_profile | None |
| binding_vif_details | None |
| binding_vif_type | None |
| binding_vnic_type | normal |
| created_at | 2019-10-
| data_plane_status | None |
| description | |
| device_id | |
| device_owner | |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address=
| id | b1593c18-
| location | cloud='', project.
| mac_address | fa:16:3e:8a:56:8a |
| name | port-normal-
| network_id | f32506ae-
| port_security_
| project_id | 05c189206e0d4e3
| propagate_
| qos_policy_id | f774c8b2-
| resource_request | None |
| revision_number | 1 |
| security_group_ids | fb5f417f-
| status | DOWN |
| tags | |
| trunk_details | None |
| updated_at | 2019-10-
+------
As admin:
stack@aio:~$ openstack port show port-normal-
+------
| Field | Value |
+------
| admin_state_up | UP |
| allowed_
| binding_host_id | aio |
| binding_profile | |
| binding_vif_details | bridge_
| binding_vif_type | ovs |
| binding_vnic_type | normal |
| created_at | 2019-10-
| data_plane_status | None |
| description | |
| device_id | f60856cc-
| device_owner | compute:nova |
| dns_assignment | None |
| dns_domain | None |
| dns_name | None |
| extra_dhcp_opts | |
| fixed_ips | ip_address=
| id | b1593c18-
| location | cloud='', project.domain_id=, project.
| mac_address | fa:16:3e:8a:56:8a |
| name | port-normal-
| network_id | f32506ae-
| port_security_
| project_id | 05c189206e0d4e3
| propagate_
| qos_policy_id | f774c8b2-
| resource_request | {u'required': [u'CUSTOM_
| revision_number | 4 |
| security_group_ids | fb5f417f-
| status | ACTIVE |
| tags | |
| trunk_details | None |
| updated_at | 2019-10-
+------
The placement allocation is correct:
stack@aio:~$ openstack --os-placement-
+------
| resource_provider | generation | resources | project_id | user_id |
+------
| 1110cf59-
| 40f2860b-
+------
So Nova was able to gather the resource_request field from the Neutron port with admin (service) credentials before the scheduling. But Nova failed to include the allocation key to the same port. I assume that this happens because Nova only adds allocation key to the port if the port has resource_request [1] but Nova checks the port at [1] with the user credentials not with the service credentials.
Changed in nova: | |
assignee: | nobody → Balazs Gibizer (balazs-gibizer) |
importance: | Undecided → Medium |
tags: | added: neutron |
Changed in nova: | |
status: | New → Triaged |
Changed in nova: | |
assignee: | Balazs Gibizer (balazs-gibizer) → Matt Riedemann (mriedem) |
Changed in nova: | |
assignee: | Matt Riedemann (mriedem) → Balazs Gibizer (balazs-gibizer) |
So during server create nova collects the ports' resource_request at [1] using and admin client. When nova updates the binding profile it it uses a non admin client [2] so here nova does not see that the port has resource request. This is the root cause of the bug.
[1] https:/ /github. com/openstack/ nova/blob/ 1bfa4626d13d0a7 3e63745cc4a864a e86d490daf/ nova/network/ neutronv2/ api.py# L1991 /github. com/openstack/ nova/blob/ 1bfa4626d13d0a7 3e63745cc4a864a e86d490daf/ nova/network/ neutronv2/ api.py# L966
[2] https:/