← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1822582] [NEW] Bulk IPv6 subnet create error

 

Public bug reported:

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

** 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/1822582

Title:
  Bulk IPv6 subnet create error

Status in neutron:
  New

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


Follow ups