summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-03-05 13:26:37 +0000
committerGerrit Code Review <review@openstack.org>2013-03-05 13:26:37 +0000
commit1a83c02299dc9331ec5e973145ff22ebb6efcd22 (patch)
treedcef42c5f44ea3ea9c731ec1a9bb6f4ba300cc5a /nova/utils.py
parent899d518aec818bc7609f523baa6bc1dfd45d2ece (diff)
parent481c314d6a54965fe6e0972995c6ad9afa86a908 (diff)
downloadnova-1a83c02299dc9331ec5e973145ff22ebb6efcd22.tar.gz
nova-1a83c02299dc9331ec5e973145ff22ebb6efcd22.tar.xz
nova-1a83c02299dc9331ec5e973145ff22ebb6efcd22.zip
Merge "Standarize ip validation along the code"
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 764fa9070..5afdf52fd 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -945,14 +945,16 @@ def is_valid_boolstr(val):
def is_valid_ipv4(address):
"""Verify that address represents a valid IPv4 address."""
try:
- addr = netaddr.IPAddress(address)
- return addr.version == 4
+ return netaddr.valid_ipv4(address)
except Exception:
return False
def is_valid_ipv6(address):
- return netaddr.valid_ipv6(address)
+ try:
+ return netaddr.valid_ipv6(address)
+ except Exception:
+ return False
def is_valid_ipv6_cidr(address):