Public bug reported:

When we calls metering-label-rules POST API with wrong
metering_label_id, we catch 500 from Neutron server.


$ curl -g -i -X POST 
http://127.0.0.1:9696/v2.0/metering/metering-label-rules.json -H "User-Agent: 
python-neutronclient" -H "Content-Type: application/json" -H "Accept: 
application/json" -H "X-Auth-Token: $TOKEN" -d '{"metering_label_rule": 
{"remote_ip_prefix": "10.0.0.0/24", "direction": "ingress", 
"metering_label_id": "43e7dfd6-0deb-427b-9abc-5eaf5ada5040"}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 150
X-Openstack-Request-Id: req-7242ca76-283a-4589-ae69-7214622b804b
Date: Thu, 13 Oct 2016 09:22:43 GMT

{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}

Error log:

2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     self._affected_rows = 
self._read_query_result(unbuffered=unbuffered)
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in 
_read_query_result
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     result.read()
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in 
read
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     first_packet = 
self.connection._read_packet()
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in 
_read_packet
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     packet.check_error()
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in 
check_error
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     
err.raise_mysql_exception(self._data)
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in 
raise_mysql_exception
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     raise 
errorclass(errno, errval)
2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource DBReferenceError: 
(pymysql.err.IntegrityError) (1452, u'Cannot add or update a child row: a 
foreign key constraint fails (`neutron`.`meteringlabelrules`, CONSTRAINT 
`meteringlabelrules_ibfk_1` FOREIGN KEY (`metering_label_id`) REFERENCES 
`meteringlabels` (`id`) ON DELETE CASCADE)') [SQL: u'INSERT INTO 
meteringlabelrules (id, direction, remote_ip_prefix, metering_label_id, 
excluded) VALUES (%(id)s, %(direction)s, %(remote_ip_prefix)s, 
%(metering_label_id)s, %(excluded)s)'] [parameters: {'remote_ip_prefix': 
u'10.0.0.0/24', 'direction': u'ingress', 'metering_label_id': 
u'43e7dfd6-0deb-427b-9abc-5eaf5ada5040', 'id': 
'ee5358b7-7326-42d2-be37-829b97f945af', 'excluded': 0}]

** Affects: neutron
     Importance: Low
     Assignee: Hirofumi Ichihara (ichihara-hirofumi)
         Status: In Progress


** Tags: metering

** Changed in: neutron
     Assignee: (unassigned) => Hirofumi Ichihara (ichihara-hirofumi)

** Tags added: metering

** Changed in: neutron
   Importance: Undecided => Low

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

Title:
  Post metering-label-rules API returns 500 when the body has wrong
  metering_label_id

Status in neutron:
  In Progress

Bug description:
  When we calls metering-label-rules POST API with wrong
  metering_label_id, we catch 500 from Neutron server.

  
  $ curl -g -i -X POST 
http://127.0.0.1:9696/v2.0/metering/metering-label-rules.json -H "User-Agent: 
python-neutronclient" -H "Content-Type: application/json" -H "Accept: 
application/json" -H "X-Auth-Token: $TOKEN" -d '{"metering_label_rule": 
{"remote_ip_prefix": "10.0.0.0/24", "direction": "ingress", 
"metering_label_id": "43e7dfd6-0deb-427b-9abc-5eaf5ada5040"}}'
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json
  Content-Length: 150
  X-Openstack-Request-Id: req-7242ca76-283a-4589-ae69-7214622b804b
  Date: Thu, 13 Oct 2016 09:22:43 GMT

  {"NeutronError": {"message": "Request Failed: internal server error
  while processing your request.", "type": "HTTPInternalServerError",
  "detail": ""}}

  Error log:

  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     self._affected_rows 
= self._read_query_result(unbuffered=unbuffered)
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in 
_read_query_result
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     result.read()
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in 
read
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     first_packet = 
self.connection._read_packet()
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in 
_read_packet
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     packet.check_error()
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in 
check_error
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     
err.raise_mysql_exception(self._data)
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource   File 
"/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in 
raise_mysql_exception
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource     raise 
errorclass(errno, errval)
  2016-10-13 09:22:43.156 TRACE neutron.api.v2.resource DBReferenceError: 
(pymysql.err.IntegrityError) (1452, u'Cannot add or update a child row: a 
foreign key constraint fails (`neutron`.`meteringlabelrules`, CONSTRAINT 
`meteringlabelrules_ibfk_1` FOREIGN KEY (`metering_label_id`) REFERENCES 
`meteringlabels` (`id`) ON DELETE CASCADE)') [SQL: u'INSERT INTO 
meteringlabelrules (id, direction, remote_ip_prefix, metering_label_id, 
excluded) VALUES (%(id)s, %(direction)s, %(remote_ip_prefix)s, 
%(metering_label_id)s, %(excluded)s)'] [parameters: {'remote_ip_prefix': 
u'10.0.0.0/24', 'direction': u'ingress', 'metering_label_id': 
u'43e7dfd6-0deb-427b-9abc-5eaf5ada5040', 'id': 
'ee5358b7-7326-42d2-be37-829b97f945af', 'excluded': 0}]

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to