start/stop instance in EC2 API shouldn't return active/stopped status immediately

Bug #1373230 reported by Alex Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Alex Xu

Bug Description

Always see this error in the gate:

http://logs.openstack.org/73/122873/1/gate/gate-tempest-dsvm-neutron-full/e5a2bf6/logs/screen-n-cpu.txt.gz?level=ERROR#_2014-09-21_05_18_23_709

014-09-21 05:18:23.709 ERROR oslo.messaging.rpc.dispatcher [req-52e7fee5-65ee-4c4d-abcc-099b29352846 InstanceRunTest-2053569555 InstanceRunTest-179702724] Exception during message handling: Unexpected task state: expecting [u'powering-off'] but the actual state is deleting

Checking the EC2 API test in tempest,

    def test_run_stop_terminate_instance(self):
        # EC2 run, stop and terminate instance
        image_ami = self.ec2_client.get_image(self.images["ami"]
                                              ["image_id"])
        reservation = image_ami.run(kernel_id=self.images["aki"]["image_id"],
                                    ramdisk_id=self.images["ari"]["image_id"],
                                    instance_type=self.instance_type)
        rcuk = self.addResourceCleanUp(self.destroy_reservation, reservation)

        for instance in reservation.instances:
            LOG.info("state: %s", instance.state)
            if instance.state != "running":
                self.assertInstanceStateWait(instance, "running")

        for instance in reservation.instances:
            instance.stop()
            LOG.info("state: %s", instance.state)
            if instance.state != "stopped":
                self.assertInstanceStateWait(instance, "stopped")

        self._terminate_reservation(reservation, rcuk)

The test is wait for instance become to stopped. But check the ec2 api code
https://github.com/openstack/nova/blob/master/nova/api/ec2/cloud.py#L1075

it always return stopped status immediately. Actually start/stop action is async call.

Tags: api
Alex Xu (xuhj)
tags: added: api
summary: - start/stop instance in EC2 API shouldn't return active/stopped status
+ astart/stop instance in EC2 API shouldn't return active/stopped status
immediately
Changed in nova:
assignee: nobody → Alex Xu (xuhj)
Alex Xu (xuhj)
summary: - astart/stop instance in EC2 API shouldn't return active/stopped status
+ start/stop instance in EC2 API shouldn't return active/stopped status
immediately
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: New → In Progress
Alex Xu (xuhj)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/123635
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=42c7c7cfc96045930820c37b45f54ba717da117e
Submitter: Jenkins
Branch: master

commit 42c7c7cfc96045930820c37b45f54ba717da117e
Author: He Jie Xu <email address hidden>
Date: Wed Sep 24 13:54:06 2014 +0800

    Fix start/stop return active/stopped immediately in EC2 API

    start/stop action is async. But the EC2 API is hard code the status
    as start/stop finished immediately.

    This patch fix start action return pending status, and stop action
    return stopping status.

    Change-Id: I0cf6db1dcb17c48a12fd62b0d707afd124b96b26
    Closes-Bug: #1373230

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.