Comment 2 for bug 1499796

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kuryr (master)

Reviewed: https://review.openstack.org/227962
Committed: https://git.openstack.org/cgit/openstack/kuryr/commit/?id=2b03783273e5b8a71f361b6650d058081acbded0
Submitter: Jenkins
Branch: master

commit 2b03783273e5b8a71f361b6650d058081acbded0
Author: Taku Fukushima <email address hidden>
Date: Sat Sep 26 01:38:15 2015 +0900

    Fix /NetworkDriver.CreateEndpoint to return allocated IP addreses

    The current /NetworkDriver.CreateEnpoint returns Address or AddressIPv6
    given by users in the request. However libnetwork as of Docker 1.8.0
    doesn't give any Interfaces property, thus IP addresses returned are
    allocated with Neutron's IPAM mechanism. So Kuryr should return the
    allocated IP addresses properly if there's no IP addresses specified by
    default.

    This patch makes Kuryr return allocated IP addresses correctly but
    libnetwork requires Address and AddressIPv6 to be CIDR as well as
    they're in the request. So Kuryr retrieves the subnets associated with
    the allocated IP addresses, which are given in "subnet_id" in the top
    level scope or "subnet_id"s in a list under the "fixed_ips" property,
    take the prefix lengthof the subnet and combine it with the "ip_address"
    of the same entry in "fixed_ips".

    For example, the following two types of ports are supported.

        {
            "status": "ACTIVE",
            "name": "",
            "allowed_address_pairs": [],
            "admin_state_up": true,
            "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
            "tenant_id": "",
            "extra_dhcp_opts": [],
            "device_owner": "network:router_gateway",
            "mac_address": "fa:16:3e:58:42:ed",
            "fixed_ips": [{
                "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062",
                "ip_address": "172.24.4.2"
            }],
            "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
            "security_groups": [],
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824"
        }

    and

        {
            "status": "ACTIVE",
            "name": "",
            "allowed_address_pairs": [],
            "admin_state_up": true,
            "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",
            "tenant_id": "",
            "extra_dhcp_opts": [],
            "device_owner": "network:router_gateway",
            "mac_address": "fa:16:3e:58:42:ed",
            "fixed_ips": [],
            "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062",
            "ip_address": "172.24.4.2"
            "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",
            "security_groups": [],
            "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824"
        }

    Change-Id: If71f6225ec83c38798ae970ab30bf48979db30aa
    Signed-off-by: Taku Fukushima <email address hidden>
    Closes-Bug: #1499796