Merge "Dynamic creds does not support create subnet with ipv6"
This commit is contained in:
commit
64055edffb
|
@ -12,6 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ipaddress
|
||||
|
||||
import netaddr
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
@ -275,14 +277,16 @@ class DynamicCredentialProvider(cred_provider.CredentialProvider):
|
|||
name=subnet_name,
|
||||
tenant_id=tenant_id,
|
||||
enable_dhcp=self.network_resources['dhcp'],
|
||||
ip_version=4)
|
||||
ip_version=(ipaddress.ip_network(
|
||||
six.text_type(subnet_cidr)).version))
|
||||
else:
|
||||
resp_body = self.subnets_admin_client.\
|
||||
create_subnet(network_id=network_id,
|
||||
cidr=str(subnet_cidr),
|
||||
name=subnet_name,
|
||||
tenant_id=tenant_id,
|
||||
ip_version=4)
|
||||
ip_version=(ipaddress.ip_network(
|
||||
six.text_type(subnet_cidr)).version))
|
||||
break
|
||||
except lib_exc.BadRequest as e:
|
||||
if 'overlaps with another subnet' not in str(e):
|
||||
|
|
Loading…
Reference in New Issue