a10networks / a10-neutron-lbaas

A10 Networks, Openstack Neutron LBaaS Driver
Apache License 2.0
9 stars 19 forks source link

Deleting a pool that doesn't exist results in an error #109

Closed Cedev closed 8 years ago

Cedev commented 9 years ago

I attempted to create two pools that ended up in the ERROR state and were never created on the acos device (the device configuration had the wrong api version).

When deleting them (neutron lb-pool-delete), the client made requests to delete the service groups from the acos device

send: 'DELETE /axapi/v3/slb/service-group/8a8c6803-c784-496f-9e9e-3c7b07e3f2ae HTTP/1.1\r\nHost: 10.48.5.198\r\nContent-Length: 0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Age
nt: ACOS-Client-AGENT-1.2.7\r\nConnection: keep-alive\r\nContent-type: application/json\r\nAuthorization: A10 f7b2ef5a7fde51df51bd9cbc25fd8d\r\n\r\n'
reply: 'HTTP/1.1 404 Not Found\r\n'
header: Date: Tue, 06 Oct 2015 21:57:46 GMT
header: Server: Apache
header: Content-Length: 181
header: Connection: close
header: Content-Type: application/json
axapi_http: data = {
    "response": {
        "status": "fail",
        "err": {
            "msg": "Object specified does not exist (object: service-group)",
            "code": 1023443968,
            "from": "CM"
        }
    }
}

This error bubbled through the client and was handled by the neutron service

2015-10-06 22:57:46.990 ERROR neutron.api.v2.resource [req-f9e49a01-7da7-461a-9bef-9caeea8e869f admin 38dce949aca941e99e4d7705bce2f20d] delete failed
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     result = method(request=request, **args)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 490, in delete
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     obj_deleter(request.context, id, **kwargs)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/opt/stack/neutron-lbaas/neutron_lbaas/services/loadbalancer/plugin.py", line 243, in delete_pool
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     driver.delete_pool(context, p)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/opt/stack/neutron-lbaas/neutron_lbaas/services/loadbalancer/drivers/a10networks/driver_v1.py", line 155, in delete_pool
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     self.a10.pool.delete(context, pool)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/home/ubuntu/a10-neutron-lbaas/a10_neutron_lbaas/v1/handler_pool.py", line 63, in delete
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     c.client.slb.service_group.delete(self._meta_name(pool))
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/acos_client/v30/slb/service_group.py", line 108, in delete
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     self._delete(self.url_prefix + name)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/acos_client/v30/base.py", line 41, in _delete
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     return self._request('DELETE', action, params, **kwargs)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/acos_client/v30/base.py", line 32, in _request
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     self.auth_header, **kwargs)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/acos_client/v30/axapi_http.py", line 123, in request
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     acos_responses.raise_axapi_ex(r, method, api_url)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/acos_client/v30/responses.py", line 147, in raise_axapi_ex
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource     raise ex(code, response['response']['err']['msg'])
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource NotFound: 1023443968 Object specified does not exist (object: service-group)
2015-10-06 22:57:46.990 TRACE neutron.api.v2.resource

The pools still exist, but are now PENDING_DELETE

$ neutron lb-pool-list
+--------------------------------------+---------------+-------------+-------------+----------+----------------+----------------+
| id                                   | name          | provider    | lb_method   | protocol | admin_state_up | status         |
+--------------------------------------+---------------+-------------+-------------+----------+----------------+----------------+
| 4393fae6-342e-4d90-8d28-a449494d01f1 | swimming-pool | a10networks | ROUND_ROBIN | TCP      | True           | PENDING_DELETE |
| 8a8c6803-c784-496f-9e9e-3c7b07e3f2ae | swimming-pool | a10networks | ROUND_ROBIN | TCP      | True           | PENDING_DELETE |
+--------------------------------------+---------------+-------------+-------------+----------+----------------+----------------+

When deleting an object that doesn't exist the error should be suppressed and the call to delete the object should be successful.

Cedev commented 9 years ago

As a workaround, you can create a service-group on the device with the id for the name

#slb service-group 8a8c6803-c784-496f-9e9e-3c7b07e3f2ae tcp

And then delete the pool in neutron again

$ neutron lb-pool-delete  8a8c6803-c784-496f-9e9e-3c7b07e3f2ae
Deleted pool: 8a8c6803-c784-496f-9e9e-3c7b07e3f2ae