Public bug reported:

For routed provider network using the segments plugin, we see that the segments 
are created in placement as resource providers.
Every time something happens to segment, subnet or port the segment plugin 
checks and updates placement accordingly checking the `reserved` and `total` 
fields for the resource class IPV4_ADDRESS.
When looking at the resource provider inventory however we see the `used` field 
is always 0.

While there exists alternatives to query the number of used IPs, e.g. with 
ip_availability, it seems inconsistent.
At the moment this doesn't look like a severe bug, since the aggregates are 
requested regardless when activating the filter in nova, only the field seems 
not correct.

Checking the code this seems expected for all ports owned by anything
other than `compute:*` and `network:dhcp`: See [1] and [2]


Reproducer:
```
# Create network, segment, subnet
openstack network create test-network-segment
openstack network segment create --network test-network-segment 
--physical-network test --network-type flat test-network-segment-segment-1
openstack subnet create --subnet-range 10.102.16.0/24 --network-segment 
test-network-segment-segment-1 --network test-network-segment 
test-network-segment-subnet-1
openstack resource provider inventory list 7b889e33-9748-4306-87a2-be37832b492c 
# new RP for that segment
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| IPV4_ADDRESS   |              1.0 |        1 |        1 |        2 |         
1 |   254 |    0 |
+----------------+------------------+----------+----------+----------+-----------+-------+------+

# Create port without any device_owner
openstack port create --network test-network-segment --fixed-ip 
subnet=test-network-segment-subnet-1,ip-address=10.102.16.10  
test-network-segment-port-1
openstack resource provider inventory list 7b889e33-9748-4306-87a2-be37832b492c
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| IPV4_ADDRESS   |              1.0 |        1 |        1 |        3 |         
1 |   254 |    0 |
+----------------+------------------+----------+----------+----------+-----------+-------+------+
# Works as expected, reserved is increased by one


# Create Port with device_owner nova:
openstack port create --network test-network-segment --fixed-ip 
subnet=test-network-segment-subnet-1,ip-address=10.102.16.12 --device-owner 
'compute:none' test-network-segment-port-2

openstack resource provider inventory list 7b889e33-9748-4306-87a2-be37832b492c
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
+----------------+------------------+----------+----------+----------+-----------+-------+------+
| IPV4_ADDRESS   |              1.0 |        1 |        1 |        3 |         
1 |   254 |    0 |
+----------------+------------------+----------+----------+----------+-----------+-------+------+
```


Expected behavior:
Inventory is updated based on the information in neutron, e.g. when a user 
creates a port it will properly allocate this port as being used in placement.


In case it is expected to have this mapping over additional resources specified 
in compute flavors, I didn't find documentation of how to set this up properly.

Versions:
We are running on yoga, but the code didn't change much.

Severity: low, more cosmetic in most cases

[1] 
https://opendev.org/openstack/neutron/src/commit/7804950a5915779d749dffb8ae57cef546e93481/neutron/services/segments/plugin.py#L505
[2] 
https://opendev.org/openstack/neutron/src/commit/7804950a5915779d749dffb8ae57cef546e93481/neutron/services/segments/plugin.py#L292

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2100479

Title:
  Segments plugin: Not updating used IP addresses

Status in neutron:
  New

Bug description:
  For routed provider network using the segments plugin, we see that the 
segments are created in placement as resource providers.
  Every time something happens to segment, subnet or port the segment plugin 
checks and updates placement accordingly checking the `reserved` and `total` 
fields for the resource class IPV4_ADDRESS.
  When looking at the resource provider inventory however we see the `used` 
field is always 0.

  While there exists alternatives to query the number of used IPs, e.g. with 
ip_availability, it seems inconsistent.
  At the moment this doesn't look like a severe bug, since the aggregates are 
requested regardless when activating the filter in nova, only the field seems 
not correct.

  Checking the code this seems expected for all ports owned by anything
  other than `compute:*` and `network:dhcp`: See [1] and [2]

  
  Reproducer:
  ```
  # Create network, segment, subnet
  openstack network create test-network-segment
  openstack network segment create --network test-network-segment 
--physical-network test --network-type flat test-network-segment-segment-1
  openstack subnet create --subnet-range 10.102.16.0/24 --network-segment 
test-network-segment-segment-1 --network test-network-segment 
test-network-segment-subnet-1
  openstack resource provider inventory list 
7b889e33-9748-4306-87a2-be37832b492c # new RP for that segment
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | IPV4_ADDRESS   |              1.0 |        1 |        1 |        2 |        
 1 |   254 |    0 |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+

  # Create port without any device_owner
  openstack port create --network test-network-segment --fixed-ip 
subnet=test-network-segment-subnet-1,ip-address=10.102.16.10  
test-network-segment-port-1
  openstack resource provider inventory list 
7b889e33-9748-4306-87a2-be37832b492c
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | IPV4_ADDRESS   |              1.0 |        1 |        1 |        3 |        
 1 |   254 |    0 |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  # Works as expected, reserved is increased by one

  
  # Create Port with device_owner nova:
  openstack port create --network test-network-segment --fixed-ip 
subnet=test-network-segment-subnet-1,ip-address=10.102.16.12 --device-owner 
'compute:none' test-network-segment-port-2

  openstack resource provider inventory list 
7b889e33-9748-4306-87a2-be37832b492c
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | resource_class | allocation_ratio | min_unit | max_unit | reserved | 
step_size | total | used |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  | IPV4_ADDRESS   |              1.0 |        1 |        1 |        3 |        
 1 |   254 |    0 |
  
+----------------+------------------+----------+----------+----------+-----------+-------+------+
  ```

  
  Expected behavior:
  Inventory is updated based on the information in neutron, e.g. when a user 
creates a port it will properly allocate this port as being used in placement.

  
  In case it is expected to have this mapping over additional resources 
specified in compute flavors, I didn't find documentation of how to set this up 
properly.

  Versions:
  We are running on yoga, but the code didn't change much.

  Severity: low, more cosmetic in most cases

  [1] 
https://opendev.org/openstack/neutron/src/commit/7804950a5915779d749dffb8ae57cef546e93481/neutron/services/segments/plugin.py#L505
  [2] 
https://opendev.org/openstack/neutron/src/commit/7804950a5915779d749dffb8ae57cef546e93481/neutron/services/segments/plugin.py#L292

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2100479/+subscriptions


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to