From e3530a06c4d84e101e07bbe22075a0e2b3a72086 Mon Sep 17 00:00:00 2001 From: Mike Milner Date: Thu, 23 Feb 2012 15:13:51 -0400 Subject: 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 --- nova/compute/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nova/compute') 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'] -- cgit