summaryrefslogtreecommitdiffstats
path: root/nova/utils.py
diff options
context:
space:
mode:
authorTushar Patil <tushar.vitthal.patil@gmail.com>2011-07-11 13:34:39 -0700
committerTushar Patil <tushar.vitthal.patil@gmail.com>2011-07-11 13:34:39 -0700
commit2a6f97940f71c056b4bfb0cd9a86f5d676abc4e1 (patch)
treeacfae7cd5239939dd59dd8b9f766c489a725ae9d /nova/utils.py
parent6843421be9cdef1fc12d3480889bdcfd96821e1b (diff)
downloadnova-2a6f97940f71c056b4bfb0cd9a86f5d676abc4e1.tar.gz
nova-2a6f97940f71c056b4bfb0cd9a86f5d676abc4e1.tar.xz
nova-2a6f97940f71c056b4bfb0cd9a86f5d676abc4e1.zip
add optional parameter networks to the Create server OS API
Diffstat (limited to 'nova/utils.py')
-rw-r--r--nova/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/nova/utils.py b/nova/utils.py
index 8784a227d..22b3a29bf 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -775,6 +775,22 @@ def bool_from_str(val):
return val.lower() == 'true'
+def is_valid_ipv4(address):
+ """valid the address strictly as per format xxx.xxx.xxx.xxx.
+ where xxx is a value between 0 and 255.
+ """
+ parts = address.split(".")
+ if len(parts) != 4:
+ return False
+ for item in parts:
+ try:
+ if not 0 <= int(item) <= 255:
+ return False
+ except ValueError:
+ return False
+ return True
+
+
class Bootstrapper(object):
"""Provides environment bootstrapping capabilities for entry points."""