diff options
author | Aaron Rosen <arosen@nicira.com> | 2013-02-15 10:49:12 -0800 |
---|---|---|
committer | Aaron Rosen <arosen@nicira.com> | 2013-02-20 11:33:46 -0800 |
commit | c3ed3dfcf99e9162616960bad5c7b7a36d3b2453 (patch) | |
tree | 27a60cd70cfcfef5f24476f194affe1bf0594410 /nova/utils.py | |
parent | d562012f34eadfe6b68dd5ebe06a2fa565de3b2e (diff) | |
download | nova-c3ed3dfcf99e9162616960bad5c7b7a36d3b2453.tar.gz nova-c3ed3dfcf99e9162616960bad5c7b7a36d3b2453.tar.xz nova-c3ed3dfcf99e9162616960bad5c7b7a36d3b2453.zip |
Add Nova quantum security group proxy
Implements blueprint nova-quantum-security-group-proxy
Change-Id: I21d70f1dc8e61d6412d14e30ab2aa1a83a711de2
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 |