summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-04-12 10:19:37 -0400
committerBrian Lamar <brian.lamar@rackspace.com>2011-04-12 10:19:37 -0400
commitcebc98176926f57016a508d5c59b11f55dfcf2b3 (patch)
tree0bbcbbf0b94e0b54a3afc62b89e63ce0e920757b /nova/compute
parentae30b0a83469b15d1986fdbbef4f1dee52d68c17 (diff)
Commit for merge of metadata_quotas preq.
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 5ec88adbd..e5065c3a5 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -497,10 +497,11 @@ class API(base.Base):
"""Reboot the given instance."""
self._cast_compute_message('reboot_instance', context, instance_id)
- def rebuild(self, context, instance_id, image_id, metadata=None):
+ def rebuild(self, context, instance_id, image_id, metadata=None,
+ files_to_inject=None):
"""Rebuild the given instance with the provided metadata."""
-
instance = db.api.instance_get(context, instance_id)
+
if instance["state"] == power_state.BUILDING:
msg = _("Instance already building")
raise exception.BuildInProgress(msg)
@@ -509,11 +510,22 @@ class API(base.Base):
self._check_metadata_quota(context, metadata)
self._check_metadata_item_length(context, metadata)
- self._cast_compute_message('rebuild_instance', context,
- instance_id, params={"image_id": image_id})
+ files_to_inject = files_to_inject or []
+ self._check_injected_file_quota(context, files_to_inject)
+ self._check_injected_file_format(context, files_to_inject)
self.db.instance_update(context, instance_id, {"metadata": metadata})
+ rebuild_params = {
+ "image_id": image_id,
+ "injected_files": files_to_inject,
+ }
+
+ self._cast_compute_message('rebuild_instance',
+ context,
+ instance_id,
+ params=rebuild_params)
+
def revert_resize(self, context, instance_id):
"""Reverts a resize, deleting the 'new' instance in the process"""
context = context.elevated()