summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2011-01-03 14:29:39 -0500
committerTodd Willey <todd@ansolabs.com>2011-01-03 14:29:39 -0500
commitb9fda9cfdb8d93ad9b9d4e9d9508bf742b6cb922 (patch)
tree062d449a89c06b9fe49d5ae2b91c3710f60efe0d /nova/api
parentd88c746332430ff71dd5ef56d42ab416b351c807 (diff)
parent8543aba27ae8a28c854b12f0a875275b2874f69b (diff)
downloadnova-b9fda9cfdb8d93ad9b9d4e9d9508bf742b6cb922.tar.gz
nova-b9fda9cfdb8d93ad9b9d4e9d9508bf742b6cb922.tar.xz
nova-b9fda9cfdb8d93ad9b9d4e9d9508bf742b6cb922.zip
pep8 fixes
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py3
-rw-r--r--nova/api/openstack/__init__.py2
-rw-r--r--nova/api/openstack/auth.py3
-rw-r--r--nova/api/openstack/images.py10
-rw-r--r--nova/api/openstack/servers.py10
5 files changed, 22 insertions, 6 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index f67f23b05..9fb6307a8 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -213,7 +213,8 @@ class CloudController(object):
for host in hosts:
rv['availabilityZoneInfo'].append({'zoneName': '|- %s' % host,
'zoneState': ''})
- hsvcs = [service for service in services if service['host'] == host]
+ hsvcs = [service for service in services \
+ if service['host'] == host]
for svc in hsvcs:
delta = now - (svc['updated_at'] or svc['created_at'])
alive = (delta.seconds <= FLAGS.service_down_time)
diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py
index 66aceee2d..ea6dff004 100644
--- a/nova/api/openstack/__init__.py
+++ b/nova/api/openstack/__init__.py
@@ -93,6 +93,8 @@ class APIRouter(wsgi.Router):
logging.debug("Including admin operations in API.")
server_members['pause'] = 'POST'
server_members['unpause'] = 'POST'
+ server_members["diagnostics"] = "GET"
+ server_members["actions"] = "GET"
server_members['suspend'] = 'POST'
server_members['resume'] = 'POST'
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index e24e58fd3..1dfdd5318 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -55,7 +55,8 @@ class AuthMiddleware(wsgi.Middleware):
if not user:
return faults.Fault(webob.exc.HTTPUnauthorized())
- req.environ['nova.context'] = context.RequestContext(user, user)
+ project = self.auth.get_project(FLAGS.default_project)
+ req.environ['nova.context'] = context.RequestContext(user, project)
return self.application
def has_authentication(self, req):
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index ba35fbc78..867ee5a7e 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -25,7 +25,7 @@ import nova.image.service
from nova.api.openstack import common
from nova.api.openstack import faults
-
+from nova.compute import api as compute_api
FLAGS = flags.FLAGS
@@ -127,9 +127,11 @@ class Controller(wsgi.Controller):
raise faults.Fault(exc.HTTPNotFound())
def create(self, req):
- # Only public images are supported for now, so a request to
- # make a backup of a server cannot be supproted.
- raise faults.Fault(exc.HTTPNotFound())
+ context = req.environ['nova.context']
+ env = self._deserialize(req.body, req)
+ instance_id = env["image"]["serverId"]
+ name = env["image"]["name"]
+ return compute_api.ComputeAPI().snapshot(context, instance_id, name)
def update(self, req, id):
# Users may not modify public images, and that's all that
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 845183258..c5cbe21ef 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -218,3 +218,13 @@ class Controller(wsgi.Controller):
logging.error(_("compute.api::resume %s"), readable)
return faults.Fault(exc.HTTPUnprocessableEntity())
return exc.HTTPAccepted()
+
+ def diagnostics(self, req, id):
+ """Permit Admins to retrieve server diagnostics."""
+ ctxt = req.environ["nova.context"]
+ return self.compute_api.get_diagnostics(ctxt, id)
+
+ def actions(self, req, id):
+ """Permit Admins to retrieve server actions."""
+ ctxt = req.environ["nova.context"]
+ return self.compute_api.get_actions(ctxt, id)