Ubuntu

metadata ami-launch-index always returning "1"

Reported by David Britton on 2012-02-17
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Undecided
Mike Milner
nova (Ubuntu)
Undecided
Unassigned

Bug Description

ii nova-api 2012.1~e4~20120210.12574-0ubuntu1 OpenStack Compute - API frontend

# curl -s http://169.254.169.254/2008-02-01/meta-data/ami-launch-index
1

This should be zero indexed like on amazon:

# curl -s http://169.254.169.254/2008-02-01/meta-data/ami-launch-index
0

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nova (Ubuntu):
status: New → Confirmed
Mike Milner (milner) wrote :

I've confirmed this also affects launching multiple instances in one call. Every instance will have an ami-launch index of 1.

Looking through the code I believe this comes from the following function in nova/compute/api.py :

def create_db_entry_for_new_instance(self, context, instance_type, image,
            base_options, security_group, block_device_mapping, num=1):

The num=1 default parameter gets saved as the launch_index parameter of the new instance. The num parameter is not passed for a single instance or multiple instances so the ami-launch-index will always be one.

summary: - metadata ami-launch-index coming back off-by-one
+ metadata ami-launch-index always returning "1"
Mike Milner (milner) on 2012-02-22
Changed in nova:
assignee: nobody → Mike Milner (milner)

Fix proposed to branch: master
Review: https://review.openstack.org/4459

Changed in nova:
status: New → In Progress

Reviewed: https://review.openstack.org/4459
Committed: http://github.com/openstack/nova/commit/e3530a06c4d84e101e07bbe22075a0e2b3a72086
Submitter: Jenkins
Branch: master

commit e3530a06c4d84e101e07bbe22075a0e2b3a72086
Author: Mike Milner <email address hidden>
Date: Thu Feb 23 15:13:51 2012 -0400

    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

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → essex-4

Reviewed: https://review.openstack.org/4715
Committed: http://github.com/openstack/nova/commit/09e664c0f00326d3dea8c04ac661ca0a05bbf0f5
Submitter: Jenkins
Branch: milestone-proposed

commit 09e664c0f00326d3dea8c04ac661ca0a05bbf0f5
Author: Mike Milner <email address hidden>
Date: Thu Feb 23 15:13:51 2012 -0400

    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

Changed in nova:
status: Fix Committed → Fix Released
Mike Milner (milner) on 2012-03-14
tags: added: canonistack
Changed in nova (Ubuntu):
status: Confirmed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers