a10networks / a10-neutron-lbaas

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

lbaasv1 compatibility with 3.0 api #155

Open Cedev opened 8 years ago

Cedev commented 8 years ago

When lbaasv1 tries to disassociate a health monitor from a 4.1 box, it doesn't. We send

POST /axapi/v3/slb/service-group/4b0652e5-760a-43ac-9ff9-09446c767f29 HTTP/1.1
Host: 10.48.5.198
Content-Length: 94
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: ACOS-Client-AGENT-1.2.7
Connection: keep-alive
Content-type: application/json
Authorization: A10 491b9e02267d5a3fe8b06b41ec517d

{"service-group": {"health-check-disable": 0, "name": "4b0652e5-760a-43ac-9ff9-09446c767f29"}}

This is generated from the call

        c.client.slb.service_group.update(pool_name, health_monitor="",
                                          health_monitor_disabled=True)

The box responds with

{
    "service-group": {
        "reset-on-server-selection-fail": 0,
        "protocol": "tcp",
        "name": "4b0652e5-760a-43ac-9ff9-09446c767f29",
        "backup-server-event-log": 0,
        "traffic-replication-mirror-sa-da-repl": 0,
        "uuid": "274aad54-a2ad-11e5-9344-fa163e04a247",
        "stats-data-action": "stats-data-enable",
        "sample-rsp-time": 0,
        "traffic-replication-mirror-ip-repl": 0,
        "lb-method": "round-robin",
        "stateless-auto-switch": 0,
        "member-list": [
            {
                "member-priority": 1,
                "uuid": "2a3c54cc-a2ad-11e5-9344-fa163e04a247",
                "name": "_0203f_1_2_3_4_neutron",
                "a10-url": "/axapi/v3/slb/service-group/4b0652e5-760a-43ac-9ff9-09446c767f29/member/_0203f_1_2_3_4_neutron+80",
                "member-state": "enable",
                "port": 80,
                "member-stats-data-disable": 1
            }
        ],
        "priority-affinity": 0,
        "traffic-replication-mirror-da-repl": 0,
        "extended-stats": 0,
        "traffic-replication-mirror": 0,
        "health-check": "fa08674b-f11a-4975-81e7-5094",
        "traffic-replication-mirror-sa-repl": 0
    }
}

The service group is still associated with the health-check.

Disassociating a health monitor from a service group in the 3.0 api is different than in the 2.1 api.

dougwig commented 8 years ago

It needs to send "health-check": "". Is that getting stripped by the acas-client library?

Cedev commented 8 years ago

This would be easy to do once we've done #187, but it needs to be fixed in master without the orchestration changes first anyway.

Cedev commented 8 years ago

The fix is to change the v1 handler_hm to call client.slb.service_group.update(pool_name, health_monitor="", health_check_disable=True)

In v2 handler_hm we call update with health_check_disable=True

    def _disable_health_monitor(self, c, context, hm):
        c.client.slb.service_group.update(
            self._pool_name(context, pool=hm.pool),
            health_monitor="", health_check_disable=True)

In v1 (since this unreleased code in master) we call update with health_monitor_disabled=True

    def _dissociate(self, c, context, hm, pool_id):
        """Remove a pool association"""

        pool_name = self._pool_name(context, pool_id)
        c.client.slb.service_group.update(pool_name, health_monitor="",
                                          health_monitor_disabled=True)

The 3.0 api acos client expects health_check_disable

        # If we explicitly disable health checks, ensure it happens
        # Else, we implicitly disable health checks if not specified.
        health_check_disable = 1 if kwargs.get("health_check_disable", False) else 0

        # When enabling/disabling a health monitor, you can't specify
        # health-check-disable and health-check at the same time.
        if hm_name is None:
            params["service-group"]["health-check-disable"] = health_check_disable
        else:
            params["service-group"]["health-check"] = hm_name