'used_ips' field of 'net-ip-availability-list' command increased by 1 when subnet added into router,In fact, Before subnet added into the router ,'total_ips' of network does not contain 'gateway_ip'.

Bug #1585907 reported by xiewj
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Won't Fix
Medium
Unassigned

Bug Description

In Mitaka,

'used_ips' field of 'net-ip-availability-list' command increased by 1 when subnet added into router,In fact, Before subnet added into the router ,'total_ips' of network does not contain 'gateway_ip'.

The experimental process is as follows:
Field 'used_ips' of 'net-ip-availability-list' command increased by 1 when subnet added into router.
[root@localhost devstack]# neutron net-create net_test
Created a new network:
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2016-05-26T14:44:36 |
| description | |
| id | 83dc21b4-715b-4f74-9db6-012ccf13c8ef |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 4950 |
| name | net_test |
| provider:network_type | vxlan |
| provider:physical_network | |
| provider:segmentation_id | 1040 |
| qos_policy_id | |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| tenant_id | ee4bd2aeeac74bb3ad2b094fc5292cbf |
| updated_at | 2016-05-26T14:44:36 |
| vlan_transparent | False |
+---------------------------+--------------------------------------+
[root@localhost devstack]# neutron subnet-create net_test 105.1.1.0/24 --allocation_pool start=105.1.1.6,end=105.1.1.10
Created a new subnet:
+-------------------+---------------------------------------------+
| Field | Value |
+-------------------+---------------------------------------------+
| allocation_pools | {"start": "105.1.1.6", "end": "105.1.1.10"} |
| cidr | 105.1.1.0/24 |
| created_at | 2016-05-26T14:46:01 |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | 105.1.1.1 |
| host_routes | |
| id | 63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | |
| network_id | 83dc21b4-715b-4f74-9db6-012ccf13c8ef |
| subnetpool_id | |
| tenant_id | ee4bd2aeeac74bb3ad2b094fc5292cbf |
| updated_at | 2016-05-26T14:46:01 |
+-------------------+---------------------------------------------+
[root@localhost devstack]# ip netns |grep 83dc21b4-715b-4f74-9db6-012ccf13c8ef
qdhcp-83dc21b4-715b-4f74-9db6-012ccf13c8ef

[root@localhost devstack]# ip netns exec qdhcp-83dc21b4-715b-4f74-9db6-012ccf13c8ef ifconfig -a
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
        inet 127.0.0.1 netmask 255.0.0.0
        inet6 ::1 prefixlen 128 scopeid 0x10<host>
        loop txqueuelen 0 (Local Loopback)
        RX packets 0 bytes 0 (0.0 B)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 0 bytes 0 (0.0 B)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

tap99d84483-f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 105.1.1.6 netmask 255.255.255.0 broadcast 105.1.1.255
        inet6 fe80::f816:3eff:fe22:54c8 prefixlen 64 scopeid 0x20<link>
        ether fa:16:3e:22:54:c8 txqueuelen 0 (Ethernet)
        RX packets 0 bytes 0 (0.0 B)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 8 bytes 648 (648.0 B)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@localhost devstack]# neutron net-ip-availability-list
+--------------------------------------+-------------------+-----------+----------+
| network_id | network_name | total_ips | used_ips |
+--------------------------------------+-------------------+-----------+----------+ |
| 83dc21b4-715b-4f74-9db6-012ccf13c8ef | net_test | 5 | 1 | |
+--------------------------------------+-------------------+-----------+----------+

[root@localhost devstack]# neutron router-interface-add router_az_01 subnet=63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118
Added interface cce9d5dd-91ae-4c42-acf7-bd8b654717c0 to router router_az_01.

[root@localhost devstack]# neutron net-ip-availability-list
+--------------------------------------+-------------------+-----------+----------+
| network_id | network_name | total_ips | used_ips |
+--------------------------------------+-------------------+-----------+----------+ |
| 83dc21b4-715b-4f74-9db6-012ccf13c8ef | net_test | 5 | 2 ||
+--------------------------------------+-------------------+-----------+----------+

[root@localhost devstack]# neutron router-show router_az_01
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | zone-2 |
| description | |
| distributed | False |
| external_gateway_info | |
| ha | False |
| id | c42405f9-7599-4a4f-a91d-62651ba04519 |
| name | router_az_01 |
| routes | |
| status | ACTIVE |
| tenant_id | ee4bd2aeeac74bb3ad2b094fc5292cbf |
+-------------------------+--------------------------------------+
[root@localhost devstack]# ip netns exec qrouter-c42405f9-7599-4a4f-a91d-62651ba04519 ifconfig -a
qr-cce9d5dd-91: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 105.1.1.1 netmask 255.255.255.0 broadcast 105.1.1.255
        inet6 fe80::f816:3eff:fe5d:726 prefixlen 64 scopeid 0x20<link>
        ether fa:16:3e:5d:07:26 txqueuelen 0 (Ethernet)
        RX packets 0 bytes 0 (0.0 B)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 10 bytes 864 (864.0 B)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@localhost devstack]#

QunyingRan (ran-qunying)
Changed in neutron:
assignee: nobody → QunyingRan (ran-qunying)
Revision history for this message
Carl Baldwin (carl-baldwin) wrote :

Would you mind adding a port list showing all of the ports on the network just to be sure another one didn't sneak in there?

Changed in neutron:
status: New → Incomplete
importance: Undecided → Medium
tags: added: l3-ipam-dhcp
Revision history for this message
xiewj (36429515-3) wrote :
Download full text (4.0 KiB)

Don't mind,port list information after every step as follows(the network has only one subnet):

1.Before subnet added into the router, 'total_ips' of network does not contain 'gateway_ip','used_ips' of network does not contain 'gateway_ip'

[root@localhost devstack]# neutron net-show net_test
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | zone-1 |
| created_at | 2016-05-26T14:44:36 |
| description | |
| id | 83dc21b4-715b-4f74-9db6-012ccf13c8ef |
| ipv4_address_scope | |
| ipv6_address_scope | |
| mtu | 4950 |
| name | net_test |
| provider:network_type | vxlan |
| provider:physical_network | |
| provider:segmentation_id | 1040 |
| qos_policy_id | |
| router:external | False |
| shared | False |
| status | ACTIVE |
| subnets | 63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118 |
| tags | |
| tenant_id | ee4bd2aeeac74bb3ad2b094fc5292cbf |
| updated_at | 2016-05-26T14:44:36 |
| vlan_transparent | False |
+---------------------------+--------------------------------------+
[root@localhost devstack]# neutron port-list|grep 63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118
| 99d84483-f15f-4ec6-97ff-782dc865cc64 | | fa:16:3e:22:54:c8 | {"subnet_id": "63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118", "ip_address": "105.1.1.6"} |

[root@localhost devstack]# neutron net-ip-availability-list
+--------------------------------------+-------------------+-----------+----------+
| network_id | network_name | total_ips | used_ips |
+--------------------------------------+-------------------+-----------+----------+
| 83dc21b4-715b-4f74-9db6-012ccf13c8ef | net_test | 5 | 1 |
+--------------------------------------+-------------------+-----------+----------+

2.After subnet added into the router,'total_ips' of network does not contain 'gateway_ip',However,'used_ips' of network contains 'gateway_ip'

[root@localhost devstack]# neutron router-interface-add router_az_01 subnet=63aa67d0-55e4-4cb0-8dcb-cdc7d2c83118
Added interface 1fcae454-34a9-4b09-9428-c7824a653bf7 to router router_az_01.

[root@localhos...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/322387

Changed in neutron:
status: Incomplete → In Progress
Changed in neutron:
assignee: QunyingRan (ran-qunying) → Yan Songming (songmingyan)
Changed in neutron:
assignee: Yan Songming (songmingyan) → QunyingRan (ran-qunying)
QunyingRan (ran-qunying)
affects: neutron → python-neutronclient
Akihiro Motoki (amotoki)
affects: python-neutronclient → neutron
Revision history for this message
Akihiro Motoki (amotoki) wrote :

The bug reported looks valid.

'total_ips' is calculated based on the size of allocation_pools, but when 'used_ips' is calculated IP address allocated out of allocation_pools are included.

This can be reproduced like this.
A created port consumes IP address out of the allocation pool, but used_ips increases.

$ neutron net-create net1
$ neutron subnet-create --name subnet1 --allocation-pool start=10.1.1.11,end=10.1.1.19 net1 10.1.1.0/24
$ neutron port-create --fixed-ip ip_address=10.1.1.99 net1
$ neutron net-ip-availability-show net1
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| network_id | 4e3a85fb-b456-498a-bbc5-37b12b8c53da |
| network_name | net1 |
| subnet_ip_availability | {"used_ips": 2, "subnet_id": "1dca8b81-fb51-447d-9c58-e11d1adc90bd", "subnet_name": "subnet1", "ip_version": 4, "cidr": "10.1.1.0/24", "total_ips": 9} |
| tenant_id | 3b91ad8c9c624303aa38334f8fc5349e |
| total_ips | 9 |
| used_ips | 2 |
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+

Revision history for this message
Akihiro Motoki (amotoki) wrote :

We first need to have a consensus on what 'used_ips' means.

As my first impression, it looks better to exclude IP addresses outside of allocation pools when count used IPs. total_ips are calculated from the number of IP addresses in allocation pools, so it sounds reasonable to count the number of used IPs in a same range.

tags: added: usability
tags: added: needs-attention
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Armando Migliaccio (<email address hidden>) on branch: master
Review: https://review.openstack.org/322387
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

QunyingRan (ran-qunying)
Changed in neutron:
assignee: QunyingRan (ran-qunying) → nobody
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Bug closed due to lack of activity, please feel free to reopen if needed.

Changed in neutron:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.