F5Networks / f5-openstack-agent

The F5 Agent for OpenStack Neutron allows you to deploy BIG-IP services in an OpenStack environment.
http://clouddocs.f5.com/products/openstack/agent/latest
Apache License 2.0
14 stars 38 forks source link

Unable to delete pool member #315

Closed alonsocamaro closed 7 years ago

alonsocamaro commented 8 years ago

OpenStack Release

Mitaka

Description

Hi all

I'm unable to delete a loadbalancer because a pool is using it but even after deleting the pool I cannot delete the loadbalancer anyway

root@node-1:~# neutron lbaas-loadbalancer-delete aa-pkg-lbaasv2-1
pool 346a15df-8272-4082-a35c-17f51b342c95 is using this loadbalancer
Neutron server returns request_ids: ['req-c690a5a3-3d0f-491b-82bc-1d0ea45debf6']
root@node-1:~# neutron lbaas-pool-delete 346a15df-8272-4082-a35c-17f51b342c95
Deleted pool: 346a15df-8272-4082-a35c-17f51b342c95
root@node-1:~# neutron lbaas-loadbalancer-delete aa-pkg-lbaasv2-1
pool 346a15df-8272-4082-a35c-17f51b342c95 is using this loadbalancer
Neutron server returns request_ids: ['req-340a4524-f744-4784-a261-905e090dfa6b']

Ultimately it seems that it is because the member of the pool is not really deleted

root@node-1:~# neutron lbaas-pool-show 346a15df-8272-4082-a35c-17f51b342c95
+---------------------+------------------------------------------------+
| Field               | Value                                          |
+---------------------+------------------------------------------------+
| admin_state_up      | True                                           |
| description         |                                                |
| healthmonitor_id    |                                                |
| id                  | 346a15df-8272-4082-a35c-17f51b342c95           |
| lb_algorithm        | ROUND_ROBIN                                    |
| listeners           |                                                |
| loadbalancers       | {"id": "303a988f-0021-4b43-93bb-512e75932366"} |
| members             | 5877883f-6427-4921-86a1-6f22f222a700           |
| name                | aa-pkg-lbaasv2-1                               |
| protocol            | HTTP                                           |
| session_persistence |                                                |
| tenant_id           | 1bcf7ba13bcb496196d72f481bfebb5c               |
+---------------------+------------------------------------------------+
root@node-1:~# neutron lbaas-member-show 5877883f-6427-4921-86a1-6f22f222a700 346a15df-8272-4082-a35c-17f51b342c95
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| address        | 10.0.3.210                           |
| admin_state_up | True                                 |
| id             | 5877883f-6427-4921-86a1-6f22f222a700 |
| name           |                                      |
| protocol_port  | 80                                   |
| subnet_id      | 1369bdf7-06b1-44cf-b7e8-6f75ac0805ad |
| tenant_id      | 1bcf7ba13bcb496196d72f481bfebb5c     |
| weight         | 1                                    |
+----------------+--------------------------------------+
root@node-1:~# neutron lbaas-member-delete 5877883f-6427-4921-86a1-6f22f222a700 346a15df-8272-4082-a35c-17f51b342c95
Deleted member: 5877883f-6427-4921-86a1-6f22f222a700
root@node-1:~# neutron lbaas-member-show 5877883f-6427-4921-86a1-6f22f222a700 346a15df-8272-4082-a35c-17f51b342c95
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| address        | 10.0.3.210                           |
| admin_state_up | True                                 |
| id             | 5877883f-6427-4921-86a1-6f22f222a700 |
| name           |                                      |
| protocol_port  | 80                                   |
| subnet_id      | 1369bdf7-06b1-44cf-b7e8-6f75ac0805ad |
| tenant_id      | 1bcf7ba13bcb496196d72f481bfebb5c     |
| weight         | 1                                    |
+----------------+--------------------------------------+

Am I doing anything wrong or is it this something should be investigated?

Thanks

Agent Version

9.0.2

Operating System

Mirantis 9

thomsonjames commented 8 years ago

Don't you find the same behavior when you use the default LBaaS? I believe this is just the way Openstack wants you to delete the objects.

alonsocamaro commented 8 years ago

Probably this is not something F5 specific but... I don't know...

Let's ask the question in a different way....

why the pool is not deleted in the first place when it is supposed to be deleted successfully?

thomsonjames commented 8 years ago

I have Mitaka running now with the 9.0.3 agent.

Here is a load balancer:

[root@server1 ~(keystone_admin)]# neutron lbaas-loadbalancer-show 330e0398-0d27-4042-a558-ba100f417274 +---------------------+------------------------------------------------+ | Field | Value | +---------------------+------------------------------------------------+ | admin_state_up | True | | description | | | id | 330e0398-0d27-4042-a558-ba100f417274 | | listeners | {"id": "169927e3-cf4d-4942-a063-0b98ddcbe75d"} | | name | lb1 | | operating_status | ONLINE | | pools | {"id": "944645ba-d919-4b17-bd96-38d46ba3061b"} | | provider | f5networks | | provisioning_status | ACTIVE | | tenant_id | 5ca8171d93b743f9a776d54f440d8f40 | | vip_address | 10.22.0.19 | | vip_port_id | 07763244-8016-4fcc-8efe-7f896796fb71 | | vip_subnet_id | a3e2e6c7-6050-409a-9ead-61239153cb23 | +---------------------+------------------------------------------------+

To delete this, you must delete the pool, then the listener, then the load balancer object.

[root@server1 ~(keystone_admin)]# neutron lbaas-pool-delete 944645ba-d919-4b17-bd96-38d46ba3061b Deleted pool: 944645ba-d919-4b17-bd96-38d46ba3061b

[root@server1 ~(keystone_admin)]# neutron lbaas-listener-delete 169927e3-cf4d-4942-a063-0b98ddcbe75d Deleted listener: 169927e3-cf4d-4942-a063-0b98ddcbe75d

[root@server1 ~(keystone_admin)]# neutron lbaas-loadbalancer-delete lb1 Deleted loadbalancer: lb1

alonsocamaro commented 8 years ago

Yes, I'm aware of the right order on how to delete things.

I have been able to delete all load balancers I have created with the exception of this one I point above. Please note that the problem is that the pool member is not really being deleted.

Could you please take a second look to this?

Thanks

       Ulises 
acme58 commented 8 years ago

I have exactly the same problem but I did not notice this for at least a week so right now I can't remember how I got there. I will try to reproduce this again.

chen23 commented 8 years ago

I've had similar issues, I opened a similar issue here: https://github.com/F5Networks/f5-openstack-lbaasv2-driver/issues/254

My workaround was to use the mysql client.

alonsocamaro commented 8 years ago

With respect of the workaround published in https://github.com/F5Networks/f5-openstack-agent/issues/393 it didn't work for me straight away:

mysql> describe lbaas_pools;
+---------------------+-----------------------------------------------------+------+-----+---------+-------+
| Field               | Type                                                | Null | Key | Default | Extra |
+---------------------+-----------------------------------------------------+------+-----+---------+-------+
| tenant_id           | varchar(255)                                        | YES  | MUL | NULL    |       |
| id                  | varchar(36)                                         | NO   | PRI | NULL    |       |
| name                | varchar(255)                                        | YES  |     | NULL    |       |
| description         | varchar(255)                                        | YES  |     | NULL    |       |
| protocol            | enum('HTTP','HTTPS','TCP')                          | NO   |     | NULL    |       |
| lb_algorithm        | enum('ROUND_ROBIN','LEAST_CONNECTIONS','SOURCE_IP') | NO   |     | NULL    |       |
| healthmonitor_id    | varchar(36)                                         | YES  | UNI | NULL    |       |
| admin_state_up      | tinyint(1)                                          | NO   |     | NULL    |       |
| provisioning_status | varchar(16)                                         | NO   |     | NULL    |       |
| operating_status    | varchar(16)                                         | NO   |     | NULL    |       |
| loadbalancer_id     | varchar(36)                                         | YES  | MUL | NULL    |       |
+---------------------+-----------------------------------------------------+------+-----+---------+-------+
11 rows in set (0.04 sec)

mysql> select * from lbaas_pools;
+----------------------------------+--------------------------------------+---------+-------------+----------+--------------+------------------+----------------+---------------------+------------------+--------------------------------------+
| tenant_id                        | id                                   | name    | description | protocol | lb_algorithm | healthmonitor_id | admin_state_up | provisioning_status | operating_status | loadbalancer_id                      |
+----------------------------------+--------------------------------------+---------+-------------+----------+--------------+------------------+----------------+---------------------+------------------+--------------------------------------+
| 8e9b22cab67040689dcf86f74275a911 | df0ac5b0-47ee-4f55-b5af-d442be69e4b2 | test190 |             | HTTP     | ROUND_ROBIN  | NULL             |              1 | PENDING_DELETE      | ONLINE           | 44649dbb-741c-4003-9512-45122f84291d |
+----------------------------------+--------------------------------------+---------+-------------+----------+--------------+------------------+----------------+---------------------+------------------+--------------------------------------+
1 row in set (0.00 sec)

mysql> delete from lbaas_pools where id="df0ac5b0-47ee-4f55-b5af-d442be69e4b2";
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`neutron`.`lbaas_members`, CONSTRAINT `lbaas_members_ibfk_1` FOREIGN KEY (`pool_id`) REFERENCES `lbaas_pools` (`id`))

With the following trick I could get rid of the row / the pool


mysql>     SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.02 sec)

mysql> delete from lbaas_pools where id="df0ac5b0-47ee-4f55-b5af-d442be69e4b2";
Query OK, 1 row affected (0.01 sec)
dflanigan commented 7 years ago

Issue resolved by merge #448