Reviewed: https://review.opendev.org/653947 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=14c76d31814b8e696349a1c00ba65ef2919b48af Submitter: Zuul Branch: master
commit 14c76d31814b8e696349a1c00ba65ef2919b48af Author: Oleg Bondarev <[email protected]> Date: Fri Apr 19 17:00:22 2019 +0400 Move subnet postcommit out of transaction for bulk create For auto-address IPv6 subnets postcommit has update port action if the net already has ports. This results in "cannot be called within a transaction" error for bulk IPv6 subnet create. Closes-Bug: #1822582 Change-Id: Ia32ec4c11c0793e7df07dcce19c122b3c7f865e1 ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1822582 Title: Bulk IPv6 subnet create error Status in neutron: Fix Released Bug description: When trying to create bulk IPv6 subnet from .json file on devstack( ubuntu server 16.04, latest openstack master version ), it throws an 500 internal server error. This only happens, when trying to create bulk IPv6 subnets in slaac and dhcp stateless modes and there is already another subnet on that specific network. It works fine with dhcp stateful. There is also no problem when trying to do this with "openstack subnet create" or without bulk .json file. Here are reproduction steps: $ . ~/devstack/openrc admin $ openstack network create n1 +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2019-04-01T11:49:40Z | | description | | | dns_domain | None | | id | 435383ce-4189-43d9-b6dd-ac947a5f711c | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | location | Munch({'project': Munch({'domain_id': 'default', 'id': u'c83b8eb6f6de41d1867c2ce1a9864b86', 'name': 'demo', 'domain_name': None}), 'cloud': '', 'region_name': 'RegionOne', 'zone': None}) | | mtu | 1450 | | name | n1 | | port_security_enabled | True | | project_id | c83b8eb6f6de41d1867c2ce1a9864b86 | | provider:network_type | vxlan | | provider:physical_network | None | | provider:segmentation_id | 29 | | qos_policy_id | None | | revision_number | 1 | | router:external | Internal | | segments | None | | shared | False | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2019-04-01T11:49:40Z | +---------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ $ export MY_TOKEN=$(openstack token issue -c id -f value) $ cat bulk_ipv4.json { "subnets": [ { "cidr": "192.168.0.0/24", "ip_version": 4, "network_id": "435383ce-4189-43d9-b6dd-ac947a5f711c", "enable_dhcp": true, "name": "subnet1" } ] } $ curl -H "X-Auth-Token: $MY_TOKEN" -X POST http://127.0.0.1:9696/v2.0/subnets -d @~/bulk_ipv4.json $ cat bulk_ipv6.json { "subnets": [ { "name": "subnet12_v6", "network_id": "435383ce-4189-43d9-b6dd-ac947a5f711c", "gateway_ip": "fd00:2:1234::1", "ip_version": 6, "cidr": "fd00:2:1234::/64", "enable_dhcp": true, "ipv6_ra_mode": "slaac", "ipv6_address_mode": "slaac" } ] } $ curl -H "X-Auth-Token: $MY_TOKEN" -X POST http://127.0.0.1:9696/v2.0/subnets -d @~/bulkv6.json | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 402 100 150 100 252 471 792 --:--:-- --:--:-- --:--:-- 794 { "NeutronError": { "message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": "" } } [Last few lines are from neutron server log] Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation self._create_subnet_postcommit(context, result, net_db, ipam_sub) Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py", line 233, in wrapped Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation return method(*args, **kwargs) Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/db/db_base_plugin_v2.py", line 730, in _create_subnet_postcommit Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation self.update_port(context, port_id, port_info) Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/common/utils.py", line 668, in inner Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation "transaction.") % f) Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation RuntimeError: Method <function update_port at 0x7f50c198ff50> cannot be called within a transaction. Apr 01 13:55:37 vm neutron-server[10148]: ERROR neutron.pecan_wsgi.hooks.translation To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1822582/+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

