diff options
| author | Ricardo Carrillo Cruz <emaildericky@gmail.com> | 2011-02-04 11:26:28 +0100 |
|---|---|---|
| committer | Ricardo Carrillo Cruz <emaildericky@gmail.com> | 2011-02-04 11:26:28 +0100 |
| commit | e35ca46173a5f3bf2d1460c19249fd0bf9f5b538 (patch) | |
| tree | 39eed216f35ae38d239e68ceec79ac1411110bd3 /nova/adminclient.py | |
| parent | 3ad22216eee67abfabb28efe2561f0fdcf10e6e1 (diff) | |
| parent | 5e4259ce6deb227b778acf23770e35f786c9c3d0 (diff) | |
| download | nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.gz nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.xz nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.zip | |
Fixed PEP8 test problems, complaining about too many blank lines at line 51
Diffstat (limited to 'nova/adminclient.py')
| -rw-r--r-- | nova/adminclient.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nova/adminclient.py b/nova/adminclient.py index b2609c8c4..3cdd8347f 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -190,6 +190,45 @@ class HostInfo(object): setattr(self, name, value) +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 NovaAdminClient(object): def __init__( @@ -373,3 +412,8 @@ 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)]) |
