sometimes instances stay in DELETE vm_state but are not marked as deleted

Bug #1187422 reported by Andrea Rosa
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Andrea Rosa

Bug Description

This is not a common case, but I verified that we can have a kind of partial deletion of instances.
What I saw is that instances have vm_state = DELETED but are not marked (in the DB) as deleted.

Looking at the code it's clear that the combination of vm_sate=DELETED and deleted=0 is a valid combination even if it should be a short lived one.
I think that if we find instances in that state during the _init_instance method we have to complete the deletion calling the self.conductor_api.instance_destroy(context, instance).
At this moment in the _init_instance method we are ignoring instances in that state:

def _init_instance(self, context, instance):
        '''Initialize this instance during service init.'''
        closing_vm_states = (vm_states.DELETED,
                             vm_states.SOFT_DELETED)

        # instance was supposed to shut down - don't attempt
        # recovery in any case
        if instance['vm_state'] in closing_vm_states:
            return

Changed in nova:
assignee: nobody → Andrea Rosa (andrea-rosa-m)
description: updated
tags: added: low-hanging-fruit
Revision history for this message
Andrea Rosa (andrea-rosa-m) wrote :

I think we need to perform the following actions to get to the point where we can consider the deletion completed:
- call the instance_destroy
- create the quota reservations for instnces, ram and cores quota usages
- commit the quota changes (quota_commit passing the reservations created at the previous step)
- call the block_device_mapping_destroy
- call the notify_about_instance_usage
- if vnc or spice are enabled, procced to the deletion of tokens

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/33265

Changed in nova:
status: New → In Progress
aeva black (tenbrae)
Changed in nova:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/33265
Committed: http://github.com/openstack/nova/commit/6e8737c3aa52889394e843272f3a7e5a3a5935c1
Submitter: Jenkins
Branch: master

commit 6e8737c3aa52889394e843272f3a7e5a3a5935c1
Author: Andrea Rosa <email address hidden>
Date: Mon Jun 10 15:35:53 2013 +0100

    Complete deletion when compute manager start-up.

    Sometimes instances stay in DELETED state (vm_state) but are not
    marked as deleted in the DB.
    The combination of vm_state=DELETED and deleted=0 is a valid
    combination but if we found it during the compute manager start-up that is
    an indication that something went wrong while we were deleting an instance.
    The aim of this change is just to complete the deletion during the compute
    mangager start-up for instances found in that state.

    bug 1187422
    Change-Id: I52efa07b4d98106214fc54aee3af9de6eacb58d9

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-2 → 2013.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.