subnet create is not working with --use-default-subnet-pool

Bug #1668223 reported by Dr. Jens Harbott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
Fix Released
Undecided
Unassigned
neutron
Fix Released
Medium
Dr. Jens Harbott
python-openstackclient
Fix Released
Undecided
Unassigned

Bug Description

Seems like the option is not passed properly to the API:

$ openstack --debug subnet create --ip-version 6 --use-default-subnet-pool --ipv6-address-mode slaac --ipv6-ra-mode slaac --network mynet mysubnet
...
REQ: curl -g -i -X POST http://10.42.1.126:9696/v2.0/subnets -H "User-Agent: openstacksdk/0.9.13 keystoneauth1/2.18.0 python-requests/2.12.5 CPython/2.7.12" -H "Content-Type: application/json" -H "X-Auth-Token: {SHA1}c61b74f7c026e385b8953576101f854d86cb0d48" -d '{"subnet": {"network_id": "1f20da97-ddd4-40f8-b8d3-6321de8671a0", "ipv6_ra_mode": "slaac", "ip_version": 6, "name": "mysubnet", "ipv6_address_mode": "slaac"}}'
http://10.42.1.126:9696 "POST /v2.0/subnets HTTP/1.1" 400 146
RESP: [400] Content-Type: application/json Content-Length: 146 X-Openstack-Request-Id: req-299d7f52-d5ce-4873-979d-f63626f380ab Date: Mon, 27 Feb 2017 10:30:31 GMT Connection: keep-alive
RESP BODY: {"NeutronError": {"message": "Bad subnets request: a subnetpool must be specified in the absence of a cidr.", "type": "BadRequest", "detail": ""}}
...
HttpException: HttpException: Bad Request, Bad subnets request: a subnetpool must be specified in the absence of a cidr.

END return value: 1
$

Running the same command using the neutron CLI is working fine:

$ neutron --debug subnet-create --name subnet6 --ip_version 6 --use-default-subnetpool --ipv6-address-mode slaac --ipv6-ra-mode slaac mynet
...
DEBUG: keystoneauth.session REQ: curl -g -i -X POST http://10.42.1.126:9696/v2.0/subnets.json -H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}dd78a0939a35913dad4181aaf5f68e0c9277d74e" -d '{"sub
net": {"use_default_subnetpool": true, "network_id": "1f20da97-ddd4-40f8-b8d3-6321de8671a0", "ipv6_ra_mode": "slaac", "ip_version": 6, "ipv6_address_mode": "slaac", "name": "subnet6"}}'
DEBUG: keystoneauth.session RESP: [201] Content-Type: application/json Content-Length: 735 X-Openstack-Request-Id: req-13f0bc2a-e4e5-43dc-b048-e63acef8f131 Date: Mon, 27 Feb 2017 10:46:32 GMT Connection: keep-alive
RESP BODY: {"subnet": {"service_types": [], "description": "", "enable_dhcp": true, "tags": [], "network_id": "1f20da97-ddd4-40f8-b8d3-6321de8671a0", "tenant_id": "6de6f29dcf904ab8a12e8ca558f532e9", "created_at": "2017-02-27T10:46:31Z", "dns_nameservers": [], "updated_at":
 "2017-02-27T10:46:31Z", "gateway_ip": "2001:db8:1234::1", "ipv6_ra_mode": "slaac", "allocation_pools": [{"start": "2001:db8:1234::2", "end": "2001:db8:1234:0:ffff:ffff:ffff:ffff"}], "host_routes": [], "revision_number": 2, "ip_version": 6, "ipv6_address_mode": "slaac", "c
idr": "2001:db8:1234::/64", "project_id": "6de6f29dcf904ab8a12e8ca558f532e9", "id": "ebb07be0-3f8d-4219-afbd-f81ca352954d", "subnetpool_id": "4c1661ba-b24c-4fda-8815-3f1fd29281af", "name": "subnet6"}}
...

So somehow this attribute is missing from the OSC's request:

"use_default_subnetpool": true

Changed in python-openstackclient:
assignee: nobody → Dr. Jens Rosenboom (j-rosenboom-j)
Changed in python-openstacksdk:
assignee: nobody → Dr. Jens Rosenboom (j-rosenboom-j)
Changed in python-openstackclient:
status: New → Invalid
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

OSC does handle the attribute correctly, but it is being ignored by python-openstacksdk.

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

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

Changed in python-openstacksdk:
status: New → In Progress
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

The attribute is also missing in the Neutron api-ref at

https://developer.openstack.org/api-ref/networking/v2/?expanded=create-subnet-detail

Changed in python-openstackclient:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → nobody
Changed in neutron:
assignee: nobody → Dr. Jens Rosenboom (j-rosenboom-j)
Changed in python-openstackclient:
status: Invalid → In Progress
assignee: nobody → Dr. Jens Rosenboom (j-rosenboom-j)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstacksdk (master)

Reviewed: https://review.openstack.org/438441
Committed: https://git.openstack.org/cgit/openstack/python-openstacksdk/commit/?id=0d044b2ecd432f82b7551f7e44ff501d2235f3f1
Submitter: Jenkins
Branch: master

commit 0d044b2ecd432f82b7551f7e44ff501d2235f3f1
Author: Jens Rosenboom <email address hidden>
Date: Mon Feb 27 12:09:39 2017 +0100

    Add missing attribute to Subnet resource

    The use_default_subnet_pool attribute was missing, leading to errors when
    trying to create a subnet using the default subnet pool.

    Change-Id: I72c0be77d96f3891748cdd69c382211dc20dbf5e
    Partial-Bug: 1668223

tags: added: api-ref
Changed in neutron:
status: New → Confirmed
importance: Undecided → Medium
Changed in python-openstacksdk:
status: In Progress → Fix Released
Changed in neutron:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.openstack.org/438514
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=3e6356a4d87351c84a29e3a44f60f0544e2947b6
Submitter: Jenkins
Branch: master

commit 3e6356a4d87351c84a29e3a44f60f0544e2947b6
Author: Jens Rosenboom <email address hidden>
Date: Mon Feb 27 15:37:50 2017 +0100

    Fix handling the use_default_subnet_pool attribute

    The attribute formerly wasn't working because it is lacking support in
    the SDK. The patch to add it[1] introduced a modified spelling, so we
    should be matching this here.

    Also make sure that the attribute is not shown when displaying subnet
    objects, as it is meant to be invisible[2].

    [1] I72c0be77d96f3891748cdd69c382211dc20dbf5e
    [2] http://git.openstack.org/cgit/openstack/neutron/tree/neutron/extensions/default_subnetpools.py#n23

    Change-Id: Ic125b818a6082d76a1114fe89e0b1fcf4c7356b0
    Partial-Bug: 1668223

Changed in python-openstackclient:
status: In Progress → Fix Released
Changed in python-openstacksdk:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → nobody
Changed in python-openstackclient:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-lib (master)

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

Changed in neutron:
assignee: nobody → Dr. Jens Harbott (j-harbott)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-openstackclient (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/503016

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-openstackclient (master)

Reviewed: https://review.openstack.org/503016
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=104d6d0e316e74cb8a700dea09aa3566a6d8e069
Submitter: Jenkins
Branch: master

commit 104d6d0e316e74cb8a700dea09aa3566a6d8e069
Author: Jens Harbott <email address hidden>
Date: Tue Sep 12 14:21:49 2017 +0000

    Fix output for subnet show

    The use_default_subnet_pool column is never returned by the API, it is
    only being used in the request to create a subnet. So make sure that we
    do not show it when displaying a subnet.

    Change-Id: Ie021149cceb8f89b779ad0f3c13ac60420509671
    Related-Bug: 1668223

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-openstackclient (feature/osc4)

Related fix proposed to branch: feature/osc4
Review: https://review.openstack.org/504105

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-openstackclient (feature/osc4)
Download full text (9.3 KiB)

Reviewed: https://review.openstack.org/504105
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=5309bf5f873aba4e994c9011a893987c40d56eda
Submitter: Jenkins
Branch: feature/osc4

commit c7671dd9a41a7e3dcf5086bb180630c3b4ee0978
Author: OpenStack Proposal Bot <email address hidden>
Date: Wed Sep 13 13:02:59 2017 +0000

    Updated from global requirements

    Change-Id: Ibeed9c623a6ef1c641c121a2b5ee75920346056f

commit 95378bb37d2ba29c7055c9510dd2b5e5513e281f
Author: OpenStack Proposal Bot <email address hidden>
Date: Wed Sep 13 00:15:31 2017 +0000

    Updated from global requirements

    Change-Id: I30be8748ef78604eb63c61e1dcf5fc5a740822aa

commit 760e91abcf01180651447373e37dc99fafba8f30
Author: Gage Hugo <email address hidden>
Date: Tue Sep 12 16:19:49 2017 -0500

    Correct import of keystoneauth1 session

    keystoneclient.session has been long deprecated in favor of
    keystoneauth1.session. This change corrects the import in the
    tests to use the correct library's session.

    Change-Id: Ic24ebde59e4b9eb70d6f14c1e0536f8d24f0de73

commit ce468209c4664eb3680abcaddecc103e0a636e72
Author: Dean Troyer <email address hidden>
Date: Sat Sep 9 08:48:58 2017 -0500

    Skip Volume v1 functional tests if v1 not present

    Volume v1 is gone in Queens

    Just skip it for now until DevStack does not create a v1 endpoint

    Change-Id: I2aa2f78b0d5c8ac2048c922c7835e5c4574028cc

commit 104d6d0e316e74cb8a700dea09aa3566a6d8e069
Author: Jens Harbott <email address hidden>
Date: Tue Sep 12 14:21:49 2017 +0000

    Fix output for subnet show

    The use_default_subnet_pool column is never returned by the API, it is
    only being used in the request to create a subnet. So make sure that we
    do not show it when displaying a subnet.

    Change-Id: Ie021149cceb8f89b779ad0f3c13ac60420509671
    Related-Bug: 1668223

commit 8f4440a6de4425afb77f647ae2dca9452b1166f0
Author: OpenStack Proposal Bot <email address hidden>
Date: Wed Sep 6 03:15:36 2017 +0000

    Updated from global requirements

    Change-Id: I1c5bc67d82b7a123530a7e8a6af5ca4f7faf53f0

commit de2af66c1622115dcb28aca88aa62ce5b177c771
Author: OpenStack Proposal Bot <email address hidden>
Date: Fri Sep 1 12:47:11 2017 +0000

    Updated from global requirements

    Change-Id: If52bacff8458010d2762bfac5ecea29f5fb54f01

commit ff91e26983578bf1b77e1d68fb1ae26067eed7ea
Author: lihaijing <email address hidden>
Date: Wed Aug 23 11:23:27 2017 +0800

    Update image cli doc and fix some typos

    Change-Id: I0a8d095e51a96804c97612e28fac2d00aa94c638
    Closes-Bug: #1711284

commit e62587625f80b4496b2b092be7efb00153d43a23
Author: OpenStack Proposal Bot <email address hidden>
Date: Thu Aug 24 11:48:43 2017 +0000

    Updated from global requirements

    Change-Id: I45705bad68f0615dbf09d46a2a487b9fed1abb10

commit c1404f14b88c38e3a6fb0a9dc12946241de2fd80
Author: Akihiro Motoki <email address hidden>
Date: Wed Aug 23 21:15:24 2017 +0000

    Convert remaining network functional tests to JSON

    Change-Id: Ib7dff...

Read more...

tags: added: in-feature-osc4
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.openstack.org/503000
Committed: https://git.openstack.org/cgit/openstack/neutron-lib/commit/?id=c315d5802d0aa5fa597db7cee7aa82c24c2ae4c2
Submitter: Jenkins
Branch: master

commit c315d5802d0aa5fa597db7cee7aa82c24c2ae4c2
Author: Jens Harbott <email address hidden>
Date: Tue Sep 12 13:27:01 2017 +0000

    Add the default-subnetpools extension to api-ref

    Add a section about it in the subnet documentation and show the
    ``use_default_subnetpool`` is an optional parameter for the subnet create
    and bulk-create requests.

    Change-Id: I145bc3c86d6e0a4a062879dee8075199473d9904
    Closes-Bug: 1668223

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-lib 1.11.0

This issue was fixed in the openstack/neutron-lib 1.11.0 release.

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.