Merge "Add IPv6 support to namespace subnet driver"

This commit is contained in:
Zuul 2020-03-18 15:53:20 +00:00 committed by Gerrit Code Review
commit b7aab69c8f
2 changed files with 13 additions and 1 deletions

View File

@ -181,10 +181,11 @@ class NamespacePodSubnetDriver(default_subnet.DefaultPodSubnetDriver):
# create subnet with namespace as name
subnet_pool_id = oslo_cfg.CONF.namespace_subnet.pod_subnet_pool
ip_version = utils.get_subnetpool_version(subnet_pool_id)
try:
neutron_subnet = (os_net
.create_subnet(network_id=net_id,
ip_version=4,
ip_version=ip_version,
name=subnet_name,
enable_dhcp=False,
subnetpool_id=subnet_pool_id,

View File

@ -201,6 +201,17 @@ def get_subnet_cidr(subnet_id):
return subnet_obj.cidr
@MEMOIZE
def get_subnetpool_version(subnetpool_id):
os_net = clients.get_network_client()
try:
subnetpool_obj = os_net.get_subnet_pool(subnetpool_id)
except os_exc.ResourceNotFound:
LOG.exception("Subnetpool %s not found!", subnetpool_id)
raise
return subnetpool_obj.ip_version
def extract_pod_annotation(annotation):
obj = objects.base.VersionedObject.obj_from_primitive(annotation)
# FIXME(dulek): This is code to maintain compatibility with Queens. We can