zone/info works

This commit is contained in:
Sandy Walsh
2011-02-15 11:15:59 -08:00
parent 59758207d4
commit 0020f14f43
4 changed files with 16 additions and 6 deletions

View File

@@ -53,11 +53,11 @@ if __name__ == '__main__':
compute = service.Service.create(binary='nova-compute')
network = service.Service.create(binary='nova-network')
volume = service.Service.create(binary='nova-volume')
#volume = service.Service.create(binary='nova-volume')
scheduler = service.Service.create(binary='nova-scheduler')
#objectstore = service.Service.create(binary='nova-objectstore')
service.serve(compute, network, volume, scheduler)
service.serve(compute, network, scheduler)
apps = []
paste_config_file = wsgi.paste_config_file('nova-api.conf')

View File

@@ -76,13 +76,13 @@ class APIRouter(wsgi.Router):
LOG.debug(_("Including admin operations in API."))
server_members['pause'] = 'POST'
server_members['unpause'] = 'POST'
server_members["diagnostics"] = "GET"
server_members["actions"] = "GET"
server_members['diagnostics'] = 'GET'
server_members['actions'] = 'GET'
server_members['suspend'] = 'POST'
server_members['resume'] = 'POST'
mapper.resource("zone", "zones", controller=zones.Controller(),
collection={'detail': 'GET'})
collection={'detail': 'GET', 'info': 'GET'}),
mapper.resource("server", "servers", controller=servers.Controller(),
collection={'detail': 'GET'},

View File

@@ -42,7 +42,7 @@ class Controller(wsgi.Controller):
_serialization_metadata = {
'application/xml': {
"attributes": {
"zone": ["id", "api_url"]}}}
"zone": ["id", "api_url", "name", "capabilities"]}}}
def index(self, req):
"""Return all zones in brief"""
@@ -55,6 +55,11 @@ class Controller(wsgi.Controller):
"""Return all zones in detail"""
return self.index(req)
def info(self, req):
"""Return name and capabilities for this zone."""
return dict(zone=dict(name=FLAGS.zone_name,
capabilities=FLAGS.zone_capabilities))
def show(self, req, id):
"""Return data about the given zone id"""
zone_id = int(id)

View File

@@ -312,3 +312,8 @@ DEFINE_string('host', socket.gethostname(),
DEFINE_string('node_availability_zone', 'nova',
'availability zone of this node')
DEFINE_string('zone_name', 'nova', 'name of this zone')
DEFINE_string('zone_capabilities', 'xen, linux',
'comma-delimited list of tags which represent boolean'
' capabilities of this zone')