summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorMike Milner <mike.milner@canonical.com>2012-02-23 15:13:51 -0400
committerMike Milner <mike.milner@canonical.com>2012-02-23 21:34:52 -0400
commite3530a06c4d84e101e07bbe22075a0e2b3a72086 (patch)
tree7fd3f10776ea91582b6652524be8ba1577cca5b4 /nova/compute
parent7c4e31e639c0a96778fb7a158f6e5106bc3f2abb (diff)
Include launch_index when creating instances.
Fixes bug 934534. The launch_index column in the database is used as the ami-launch-index value provided by the metadata service. If launch_index is not specified it defaults to 1. This is incorrect for the single instance case (should be 0) and doesn't correctly handle multi-instance starts. This branch changes the default launch_index to 0 (to handle the single instance case) and adds the launch_index in the schedulers for multi-instance starts. Change-Id: Ifc45abf4cd9f50f732ba4a4b68c0a6242a6c9710
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 0aee6dc2f..d900fb77f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -462,7 +462,7 @@ class API(base.Base):
#NOTE(bcwaldon): No policy check since this is only used by scheduler and
# the compute api. That should probably be cleaned up, though.
def create_db_entry_for_new_instance(self, context, instance_type, image,
- base_options, security_group, block_device_mapping, num=1):
+ base_options, security_group, block_device_mapping):
"""Create an entry in the DB for this new instance,
including any related table updates (such as security group,
etc).
@@ -483,8 +483,8 @@ class API(base.Base):
security_group_name)
security_groups.append(group['id'])
- instance = dict(launch_index=num, **base_options)
- instance = self.db.instance_create(context, instance)
+ base_options.setdefault('launch_index', 0)
+ instance = self.db.instance_create(context, base_options)
instance_id = instance['id']
instance_uuid = instance['uuid']