diff options
| author | Todd Willey <todd@ansolabs.com> | 2011-01-26 01:19:42 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-01-26 01:19:42 +0000 |
| commit | 5e4259ce6deb227b778acf23770e35f786c9c3d0 (patch) | |
| tree | 98036d4c8a3ccbbf4d18985bc7b5aa3cfd433330 /nova/api | |
| parent | 4854a64703a18dd2f07122dbd42122ac07efd371 (diff) | |
| parent | 687886beeb7519e79b792ff6c42eaab75e664336 (diff) | |
Add DescribeInstanceTypes to admin api. This lets the dashboard know what sizes can be launched (using the -t flag in euca-run-instances, for example) and what resources they provide.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/admin.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/api/ec2/admin.py b/nova/api/ec2/admin.py index 78ff1b3e0..d7e899d12 100644 --- a/nova/api/ec2/admin.py +++ b/nova/api/ec2/admin.py @@ -26,6 +26,7 @@ from nova import db from nova import exception from nova import log as logging from nova.auth import manager +from nova.compute import instance_types LOG = logging.getLogger('nova.api.ec2.admin') @@ -62,6 +63,14 @@ def host_dict(host): return {} +def instance_dict(name, inst): + return {'name': name, + 'memory_mb': inst['memory_mb'], + 'vcpus': inst['vcpus'], + 'disk_gb': inst['local_gb'], + 'flavor_id': inst['flavorid']} + + class AdminController(object): """ API Controller for users, hosts, nodes, and workers. @@ -70,6 +79,10 @@ class AdminController(object): def __str__(self): return 'AdminController' + def describe_instance_types(self, _context, **_kwargs): + return {'instanceTypeSet': [instance_dict(n, v) for n, v in + instance_types.INSTANCE_TYPES.iteritems()]} + def describe_user(self, _context, name, **_kwargs): """Returns user data, including access and secret keys.""" return user_dict(manager.AuthManager().get_user(name)) |
