Support creating from existing neutron subnetpool

Registered by hongbin on 2017-01-26

Right now, Kuryr has an option (neutron.pool.name) to specify the name of subnetpool, however, it is only used for handling overlapping cidr. This BP proposes to extend this option to support existing subnetpool. The logic is as following:

1. If pool name is specified, check if there is a subnetpool with the given name. If yes, use it. If no, create it.
2. When the pool is released, don't delete the subnetpool if it is a pre-existed subnetpool.

The implementation should be similar as existing-neutron-network (https://review.openstack.org/#/c/298387/).

Blueprint information

Status:
Complete
Approver:
Antoni Segura Puimedon
Priority:
Medium
Drafter:
hongbin
Direction:
Approved
Assignee:
hongbin
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
hongbin on 2017-03-23
Completed by
hongbin on 2017-03-23

Related branches

Sprints

Whiteboard

Currently, creating two networks with the same cidr will give a error:

  $ docker network create --driver=kuryr --ipam-driver=kuryr --subnet 10.2.0.0/16 --gateway=10.2.0.1 --ip-range 10.2.0.0/24 foo
  $ docker network create --driver=kuryr --ipam-driver=kuryr --subnet 10.2.0.0/16 --gateway=10.2.0.1 --ip-range 10.2.0.0/24 foo2
  Error response from daemon: IpamDriver.RequestPool: Another pool with same cidr exist. ipam and network options not used to pass pool name

This error is because 'foo' and 'foo2' will try to create subnetpool with the same name (kuryrPool-10.2.0.0/24). Right now, Neutron doesn't allow two subnetpool with the same name, which causes the error. We can walk around this name-collision issue by using the option 'neutron.pool.name'. For example:

  $ docker network create --driver=kuryr --ipam-driver=kuryr --subnet 10.2.0.0/16 --gateway=10.2.0.1 --ip-range 10.2.0.0/24 -o neutron.pool.name=neutron_pool1 --ipam-opt=neutron.pool.name=neutron_pool1 foo2

In summary, the option 'neutron.pool.name' is currently used to specify a custom name for the subnetpool to be created.

This proposal is about extending this option to specify an existing subnetpool. I expect the usage pattern is as following:

  $ neutron net-create test
  $ neutron subnetpool-create --pool-prefix 10.2.0.0/16 testpool
  $ neutron subnet-create --subnetpool testpool test 10.2.0.0/24
  $ docker network create -d kuryr --ipam-driver=kuryr --subnet 10.2.0.0/24 --gateway 10.2.0.1 -o neutron.net.name=test -o neutron.pool.name=testpool --ipam-opt neutron.pool.name=testpool foo

The goal is allow users to pre-create resources (network/subnetpool/subnet) in their tenants and let Kuryr to create network from existing resources.

Gerrit topic: https://review.openstack.org/#q,topic:bp/existing-subnetpool,n,z

Addressed by: https://review.openstack.org/426595
    [WIP] Support creating from existing subnetpool

Addressed by: https://review.openstack.org/426623
    Add prefix to specified name of subnetpool

Gerrit topic: https://review.openstack.org/#q,topic:bug/1659434,n,z

Addressed by: https://review.openstack.org/424889
    [WIP] Support creating network with pool uuid

Addressed by: https://review.openstack.org/441638
    Add support for specified v6 subnetpool

Addressed by: https://review.openstack.org/446706
    [WIP] Process v6 pool's uuid option in create_network

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.