summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorSandy Walsh <sandy.walsh@rackspace.com>2011-06-01 12:39:31 -0700
committerSandy Walsh <sandy.walsh@rackspace.com>2011-06-01 12:39:31 -0700
commitb05dcdc69387ecd54e40063e66355961d39b4430 (patch)
tree03b03357502cb878e2ee31b253588cd1d9801c7f /nova/api
parent3bf3255f91aab28aa6915a2836dad77f17312e03 (diff)
downloadnova-b05dcdc69387ecd54e40063e66355961d39b4430.tar.gz
nova-b05dcdc69387ecd54e40063e66355961d39b4430.tar.xz
nova-b05dcdc69387ecd54e40063e66355961d39b4430.zip
reservation id's properly forwarded to child zones on create
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/create_instance_controller.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/nova/api/openstack/create_instance_controller.py b/nova/api/openstack/create_instance_controller.py
index c79638bd9..786d74e37 100644
--- a/nova/api/openstack/create_instance_controller.py
+++ b/nova/api/openstack/create_instance_controller.py
@@ -116,6 +116,8 @@ class OpenstackCreateInstanceController(common.OpenstackController):
zone_blob = env['server'].get('blob')
reservation_id = env['server'].get('reservation_id')
+ LOG.exception("******* CREATE_INSTANCE RES_ID=%s of %s" % (reservation_id, env))
+
inst_type = instance_types.get_instance_type_by_flavor_id(flavor_id)
extra_values = {
'instance_type': inst_type,
@@ -221,6 +223,34 @@ class OpenstackCreateInstanceController(common.OpenstackController):
raise exception.RamdiskNotFoundForImage(image_id=image_id)
return kernel_id, ramdisk_id
+
+ def _get_injected_files(self, personality):
+ """
+ Create a list of injected files from the personality attribute
+
+ At this time, injected_files must be formatted as a list of
+ (file_path, file_content) pairs for compatibility with the
+ underlying compute service.
+ """
+ injected_files = []
+
+ for item in personality:
+ try:
+ path = item['path']
+ contents = item['contents']
+ except KeyError as key:
+ expl = _('Bad personality format: missing %s') % key
+ raise exc.HTTPBadRequest(explanation=expl)
+ except TypeError:
+ expl = _('Bad personality format')
+ raise exc.HTTPBadRequest(explanation=expl)
+ try:
+ contents = base64.b64decode(contents)
+ except TypeError:
+ expl = _('Personality content for %s cannot be decoded') % path
+ raise exc.HTTPBadRequest(explanation=expl)
+ injected_files.append((path, contents))
+ return injected_files
class ServerCreateRequestXMLDeserializer(object):