summaryrefslogtreecommitdiffstats
path: root/nova/adminclient.py
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2011-01-17 19:40:35 -0500
committerTodd Willey <todd@ansolabs.com>2011-01-17 19:40:35 -0500
commit3403e773f5a38c5d415e4ab66799c6e239223a0d (patch)
tree3fda3e2053329e1bfbb2e7ca565aae8ccd7309bb /nova/adminclient.py
parent8e6684a58eea3ecacdde99e1940d2ae351b8465c (diff)
Stubbed-out code for working with provider-firewalls.
Diffstat (limited to 'nova/adminclient.py')
-rw-r--r--nova/adminclient.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/adminclient.py b/nova/adminclient.py
index b2609c8c4..90ad4d9dd 100644
--- a/nova/adminclient.py
+++ b/nova/adminclient.py
@@ -190,6 +190,22 @@ class HostInfo(object):
setattr(self, name, value)
+class SimpleResponse(object):
+ def __init__(self, connection=None):
+ self.connection = connection
+ self.status = None
+ self.message = ''
+
+ def __repr__(self):
+ return 'Status:%s' % self.status
+
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ setattr(self, name.lower(), str(value))
+
+
class NovaAdminClient(object):
def __init__(
@@ -373,3 +389,8 @@ class NovaAdminClient(object):
def get_hosts(self):
return self.apiconn.get_list('DescribeHosts', {}, [('item', HostInfo)])
+
+ def block_ips(self, cidr):
+ """Block incoming traffic from specified hosts."""
+ return self.apiconn.get_object('BlockExternalAddresses',
+ {'Cidr': cidr}, SimpleResponse)