diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-02-21 00:17:29 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-02-21 00:17:29 +0000 |
commit | 20422f46e8a506a751844c94f0f7b25bf8220e2b (patch) | |
tree | d09d2a3f6715760b75e0680ac9a17916c3e15722 /nova/utils.py | |
parent | 043f6c35538f146de3c30f175db6571ad35574a2 (diff) | |
parent | c3ed3dfcf99e9162616960bad5c7b7a36d3b2453 (diff) | |
download | nova-20422f46e8a506a751844c94f0f7b25bf8220e2b.tar.gz nova-20422f46e8a506a751844c94f0f7b25bf8220e2b.tar.xz nova-20422f46e8a506a751844c94f0f7b25bf8220e2b.zip |
Merge "Add Nova quantum security group proxy"
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py index 2dcedb5d5..2c7d0b427 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -983,6 +983,15 @@ def is_valid_cidr(address): return True +def get_ip_version(network): + """Returns the IP version of a network (IPv4 or IPv6). Raises + AddrFormatError if invalid network.""" + if netaddr.IPNetwork(network).version == 6: + return "IPv6" + elif netaddr.IPNetwork(network).version == 4: + return "IPv4" + + def monkey_patch(): """If the Flags.monkey_patch set as True, this function patches a decorator |