~rlane/nova/lp773690

« back to all changes in this revision

Viewing changes to nova/api/ec2/admin.py

  • Committer: rlane at wikimedia
  • Date: 2011-01-27 12:17:43 UTC
  • mfrom: (382.1.252 nova)
  • Revision ID: rlane@wikimedia.org-20110127121743-imwx28difrjvnzrq
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from nova import exception
27
27
from nova import log as logging
28
28
from nova.auth import manager
 
29
from nova.compute import instance_types
29
30
 
30
31
 
31
32
LOG = logging.getLogger('nova.api.ec2.admin')
62
63
        return {}
63
64
 
64
65
 
 
66
def instance_dict(name, inst):
 
67
    return {'name': name,
 
68
            'memory_mb': inst['memory_mb'],
 
69
            'vcpus': inst['vcpus'],
 
70
            'disk_gb': inst['local_gb'],
 
71
            'flavor_id': inst['flavorid']}
 
72
 
 
73
 
65
74
class AdminController(object):
66
75
    """
67
76
    API Controller for users, hosts, nodes, and workers.
70
79
    def __str__(self):
71
80
        return 'AdminController'
72
81
 
 
82
    def describe_instance_types(self, _context, **_kwargs):
 
83
        return {'instanceTypeSet': [instance_dict(n, v) for n, v in
 
84
                                    instance_types.INSTANCE_TYPES.iteritems()]}
 
85
 
73
86
    def describe_user(self, _context, name, **_kwargs):
74
87
        """Returns user data, including access and secret keys."""
75
88
        return user_dict(manager.AuthManager().get_user(name))