← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1404867] Re: Volume remains in-use status, if instance booted from volume is deleted in error state

 

Reviewed:  https://review.openstack.org/340614
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b3f39244a3eacd6fb141de61850cbd84fecdb544
Submitter: Zuul
Branch:    master

commit b3f39244a3eacd6fb141de61850cbd84fecdb544
Author: ankitagrawal <ankit11.agrawal@xxxxxxxxxxx>
Date:   Wed Sep 23 03:58:19 2015 -0700

    Clean up ports and volumes when deleting ERROR instance
    
    Usually, when instance.host = None, it means the instance was never
    scheduled. However, the exception handling routine in compute manager
    [1] will set instance.host = None and set instance.vm_state = ERROR
    if the instance fails to build on the compute host. If that happens, we
    end up with an instance with host = None and vm_state = ERROR which may
    have ports and volumes still allocated.
    
    This adds some logic around deleting the instance when it may have
    ports or volumes allocated.
    
      1. If the instance is not in ERROR or SHELVED_OFFLOADED state, we
         expect instance.host to be set to a compute host. So, if we find
         instance.host = None in states other than ERROR or
         SHELVED_OFFLOADED, we consider the instance to have failed
         scheduling and not require ports or volumes to be freed, and we
         simply destroy the instance database record and return. This is
         the "delete while booting" scenario.
    
      2. If the instance is in ERROR because of a failed build or is
         SHELVED_OFFLOADED, we expect instance.host to be None even though
         there could be ports or volumes allocated. In this case, run the
         _local_delete routine to clean up ports and volumes and delete the
         instance database record.
    
    Co-Authored-By: Ankit Agrawal <ankit11.agrawal@xxxxxxxxxxx>
    Co-Authored-By: Samuel Matzek <smatzek@xxxxxxxxxx>
    Co-Authored-By: melanie witt <melwittt@xxxxxxxxx>
    
    Closes-Bug: 1404867
    Closes-Bug: 1408527
    
    [1] https://github.com/openstack/nova/blob/55ea961/nova/compute/manager.py#L1927-L1929
    
    Change-Id: I4dc6c8bd3bb6c135f8a698af41f5d0e026c39117


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1404867

Title:
  Volume remains in-use status, if instance booted from volume is
  deleted in error state

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) pike series:
  In Progress
Status in OpenStack Compute (nova) queens series:
  In Progress

Bug description:
  If the instance is booted from volume and goes in to error state due to some reason.
  Volume from which instance is booted, remains in-use state even the instance is deleted.
  IMO, volume should be detached so that it can be used to boot other instance.

  Steps to reproduce:

  1. Log in to Horizon, create a new volume.
  2. Create an Instance using newly created volume.
  3. Verify instance is in active state.
  $ source devstack/openrc demo demo
  $ nova list
  +--------------------------------------+------+--------+------------+-------------+------------------+
  | ID                                   | Name | Status | Task State | Power State | Networks         |
  +--------------------------------------+------+--------+------------+-------------+------------------+
  | dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | ACTIVE | -          | Running     | private=10.0.0.3 |
  +--------------------------------------+------+--------+------------+-------------+------------------+

  Note:
  Use shelve-unshelve api to see the instance goes into error state.
  unshelving volumed back instance does not work and sets instance state to error state (ref: https://bugs.launchpad.net/nova/+bug/1404801)

  4. Shelve the instance
  $ nova shelve <instance-uuid>

  5. Verify the status is SHELVED_OFFLOADED.
  $ nova list
  +--------------------------------------+------+-------------------+------------+-------------+------------------+
  | ID                                   | Name | Status            | Task State | Power State | Networks         |
  +--------------------------------------+------+-------------------+------------+-------------+------------------+
  | dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | SHELVED_OFFLOADED | -          | Shutdown    | private=10.0.0.3 |
  +--------------------------------------+------+-------------------+------------+-------------+------------------+

  6. Unshelve the instance.
  $ nova unshelve <instance-uuid>

  5. Verify the instance is in Error state.
  $ nova list
  +--------------------------------------+------+-------------------+------------+-------------+------------------+
  | ID                                   | Name | Status            | Task State | Power State | Networks         |
  +--------------------------------------+------+-------------------+------------+-------------+------------------+
  | dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | Error             | unshelving | Spawning    | private=10.0.0.3 |
  +--------------------------------------+------+-------------------+------------+-------------+------------------+

  6. Delete the instance using Horizon.

  7. Verify that volume still in in-use state
  $ cinder list
  +--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
  |                  ID                  | Status | Name | Size | Volume Type | Bootable |             Attached to              |
  +--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
  | 4aeefd25-10aa-42c2-9a2d-1c89a95b4d4f | in-use | test |  1   | lvmdriver-1 |   true   | 8f7bdc24-1891-4bbb-8f0c-732b9cbecae7 |
  +--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+

  8. In Horizon, volume "Attached To" information is displayed as
  "Attached to None on /dev/vda".

  9. User is not able to delete this volume, or attached it to another
  instance as it is still in use.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1404867/+subscriptions


References