summaryrefslogtreecommitdiffstats
path: root/nova/adminclient.py
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2011-01-25 17:51:49 -0800
committerTodd Willey <todd@ansolabs.com>2011-01-25 17:51:49 -0800
commitbe28eceff7b0a7a1dc33c3ade3ab221c6b1c8acd (patch)
treed0d71f4baae6f8da19e8e5389144d45123df5a66 /nova/adminclient.py
parentbbea3a093f3e9be5052a2e64b6d5d0b909ae33ee (diff)
parent5e4259ce6deb227b778acf23770e35f786c9c3d0 (diff)
Merge trunk.
Diffstat (limited to 'nova/adminclient.py')
-rw-r--r--nova/adminclient.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/nova/adminclient.py b/nova/adminclient.py
index 0cdb8c6fb..9b43995fe 100644
--- a/nova/adminclient.py
+++ b/nova/adminclient.py
@@ -190,9 +190,47 @@ class HostInfo(object):
setattr(self, name, value)
-class SimpleResponse(object):
+class InstanceType(object):
+ """
+ Information about a Nova instance type, as parsed through SAX.
+
+ **Fields include**
+
+ * name
+ * vcpus
+ * disk_gb
+ * memory_mb
+ * flavor_id
+
+ """
+
def __init__(self, connection=None):
self.connection = connection
+ self.name = None
+ self.vcpus = None
+ self.disk_gb = None
+ self.memory_mb = None
+ self.flavor_id = None
+
+ def __repr__(self):
+ return 'InstanceType:%s' % self.name
+
+ def startElement(self, name, attrs, connection):
+ return None
+
+ def endElement(self, name, value, connection):
+ if name == "memoryMb":
+ self.memory_mb = str(value)
+ elif name == "flavorId":
+ self.flavor_id = str(value)
+ elif name == "diskGb":
+ self.disk_gb = str(value)
+ else:
+ setattr(self, name, str(value))
+
+
+class SimpleResponse(object):
+ def __init__(self):
self.status = None
self.message = ''
@@ -389,6 +427,11 @@ class NovaAdminClient(object):
def get_hosts(self):
return self.apiconn.get_list('DescribeHosts', {}, [('item', HostInfo)])
+ def get_instance_types(self):
+ """Grabs the list of all users."""
+ return self.apiconn.get_list('DescribeInstanceTypes', {},
+ [('item', InstanceType)])
+
def block_ips(self, cidr):
"""Block incoming traffic from specified hosts."""
return self.apiconn.get_object('BlockExternalAddresses',