summaryrefslogtreecommitdiffstats
path: root/nova/endpoint
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2010-08-06 14:27:48 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2010-08-06 14:27:48 -0700
commite6e5c8e0680b2aa8a243c3f82bcac8e484f78e3b (patch)
tree74f9692816affffedab0d03e9fba44fc75112d2f /nova/endpoint
parent024ad9951dcf33f5a3468e9a790f1636770b2837 (diff)
parent85b73194c2f8432a7e9ab5d24574746f209846ee (diff)
downloadnova-e6e5c8e0680b2aa8a243c3f82bcac8e484f78e3b.tar.gz
nova-e6e5c8e0680b2aa8a243c3f82bcac8e484f78e3b.tar.xz
nova-e6e5c8e0680b2aa8a243c3f82bcac8e484f78e3b.zip
merged trunk
Diffstat (limited to 'nova/endpoint')
-rw-r--r--nova/endpoint/cloud.py11
-rw-r--r--nova/endpoint/images.py22
2 files changed, 17 insertions, 16 deletions
diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py
index 00dabba28..23ad85cd3 100644
--- a/nova/endpoint/cloud.py
+++ b/nova/endpoint/cloud.py
@@ -294,17 +294,16 @@ class CloudController(object):
return v
@rbac.allow('projectmanager', 'sysadmin')
+ @defer.inlineCallbacks
def create_volume(self, context, size, **kwargs):
# TODO(vish): refactor this to create the volume object here and tell service to create it
- res = rpc.call(FLAGS.volume_topic, {"method": "create_volume",
+ result = yield rpc.call(FLAGS.volume_topic, {"method": "create_volume",
"args" : {"size": size,
"user_id": context.user.id,
"project_id": context.project.id}})
- def _format_result(result):
- volume = self._get_volume(context, result['result'])
- return {'volumeSet': [self.format_volume(context, volume)]}
- res.addCallback(_format_result)
- return res
+ # NOTE(vish): rpc returned value is in the result key in the dictionary
+ volume = self._get_volume(context, result['result'])
+ defer.returnValue({'volumeSet': [self.format_volume(context, volume)]})
def _get_address(self, context, public_ip):
# FIXME(vish) this should move into network.py
diff --git a/nova/endpoint/images.py b/nova/endpoint/images.py
index 12876da30..fe7cb5d11 100644
--- a/nova/endpoint/images.py
+++ b/nova/endpoint/images.py
@@ -21,14 +21,13 @@ Proxy AMI-related calls from the cloud controller, to the running
objectstore daemon.
"""
-import boto
-import boto.s3
+import boto.s3.connection
import json
-import random
import urllib
from nova import flags
from nova import utils
+from nova.auth import manager
FLAGS = flags.FLAGS
@@ -77,13 +76,16 @@ def deregister(context, image_id):
query_args=qs({'image_id': image_id}))
def conn(context):
- return boto.s3.connection.S3Connection (
- aws_access_key_id=str('%s:%s' % (context.user.access, context.project.name)),
- aws_secret_access_key=str(context.user.secret),
- is_secure=False,
- calling_format=boto.s3.connection.OrdinaryCallingFormat(),
- port=FLAGS.s3_port,
- host=FLAGS.s3_host)
+ access = manager.AuthManager().get_access_key(context.user,
+ context.project)
+ secret = str(context.user.secret)
+ calling = boto.s3.connection.OrdinaryCallingFormat()
+ return boto.s3.connection.S3Connection(aws_access_key_id=access,
+ aws_secret_access_key=secret,
+ is_secure=False,
+ calling_format=calling,
+ port=FLAGS.s3_port,
+ host=FLAGS.s3_host)
def qs(params):