instance_type data cannot be extracted from sys_meta after instance deleted

Bug #1185190 reported by Chris Behrens
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Critical
Chris Behrens
Grizzly
Fix Released
Critical
Chris Behrens

Bug Description

This commit:

---
commit 17bca438954638d74035d560e826a26a532b3ea3
Author: Joe Gordon <email address hidden>
Date: Wed Mar 13 16:58:13 2013 -0700

    Delete InstanceSystemMetadata on instance deletion

    Thanks to no-db-compute only pre-delete instance data is used in
    notifications. So now we can go back to deleting InstanceSystemMetadata
    when an instance is deleted.

    Fixes bug 1153827

    Change-Id: Ic66b998cde2a15a24f302f08c34753a8b57da73d
---

Changed things so that we delete the instance_system_metadata entries for an instance when instance_destroy() is called. However, the commit message turns out to be wrong, from what I can tell. There's 2 cases that need access to instance_type data that's stored in sys_meta AFTER an instance is deleted:

1) The API. If you specify 'changes-since', the API will return deleted instances. The instance_type data needs to be extracted in order to form the API response
2) _usage_audit_log() task in compute manager. This task potentially queries for deleted instances in the past day to send audit information for them nightly.

I don't have a traceback for #1 handy, but:

Traceback for #2:

Traceback (most recent call last):
  File "/meow/nova/compute/manager.py", line 3813, in _instance_usage_audit
        include_bandwidth=True
  File "/meow/nova/conductor/api.py", line 308, in notify_usage_exists
    system_metadata, extra_usage_info, include_bandwidth)
  File "/meow/nova/utils.py", line 1089, in wrapper
    return func(*args, **kwargs)
  File "/meow/nova/conductor/manager.py", line 405, in notify_usage_exists
        include_bandwidth) File "/meow/nova/compute/utils.py", line 224, in notify_usage_exists
    system_metadata=system_metadata, extra_usage_info=extra_info)
  File "/meow/nova/compute/utils.py", line 250, in notify_about_instance_usage
    network_info, system_metadata, **extra_usage_info)
  File "/meow/nova/notifications.py", line 287, in info_from_instance
        instance_type = flavors.extract_instance_type(instance_ref)
  File "/meow/nova/compute/flavors.py", line 247, in extract_instance_type
    instance_type[key] = type_fn(sys_meta[type_key])
KeyError: 'instance_type_memory_mb'

Tags: db
Chris Behrens (cbehrens)
Changed in nova:
importance: Undecided → Critical
milestone: none → havana-2
milestone: havana-2 → havana-1
tags: added: db
Changed in nova:
status: New → Confirmed
Revision history for this message
Thierry Carrez (ttx) wrote :

Pushing back to H2, please set back to H1 if this is milestone-critical (in which case the fix needs to land in master first and then be backported to milestone-proposed before tomorrow)

Changed in nova:
milestone: havana-1 → havana-2
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-2 → havana-1
Chris Behrens (cbehrens)
Changed in nova:
assignee: nobody → Chris Behrens (cbehrens)
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/30894
Committed: http://github.com/openstack/nova/commit/4885aa28706a1858f4fc51a0d2c661eec05139c0
Submitter: Jenkins
Branch: master

commit 4885aa28706a1858f4fc51a0d2c661eec05139c0
Author: Chris Behrens <email address hidden>
Date: Wed May 29 14:21:00 2013 +0000

    Don't delete sys_meta on instance delete

    Unfortunately, we require to access instance_system_metadata to get
    data (specifically at least instance_type data) for instances that have
    been deleted.

    There's 2 cases where this is true:

    1) nova-api supports showing deleting instances when you specify a
    'changes-since' param.
    2) The _usage_audit_log periodic task pulls all instances during the
    audit period, which includes instances that have been deleted during
    that period.

    This reverts commit 17bca438954638d74035d560e826a26a532b3ea3, which was
    attempting to fix a bug where we leave instance_system_metadata entries
    undeleted from the DB. There's not an easy way to query for the deleted
    sys_meta data in an efficient manner, and leaving the entries undeleted is
    the lesser of the 2 evils for now.

    Fixes bug 1185190

    Change-Id: I898f0546c49126dcc56a4237120082f95dc82304

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (milestone-proposed)

Fix proposed to branch: milestone-proposed
Review: https://review.openstack.org/30954

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (milestone-proposed)

Reviewed: https://review.openstack.org/30954
Committed: http://github.com/openstack/nova/commit/04d9fb406783ba5934d9cb249550a92202555bc7
Submitter: Jenkins
Branch: milestone-proposed

commit 04d9fb406783ba5934d9cb249550a92202555bc7
Author: Chris Behrens <email address hidden>
Date: Wed May 29 14:21:00 2013 +0000

    Don't delete sys_meta on instance delete

    Unfortunately, we require to access instance_system_metadata to get
    data (specifically at least instance_type data) for instances that have
    been deleted.

    There's 2 cases where this is true:

    1) nova-api supports showing deleting instances when you specify a
    'changes-since' param.
    2) The _usage_audit_log periodic task pulls all instances during the
    audit period, which includes instances that have been deleted during
    that period.

    This reverts commit 17bca438954638d74035d560e826a26a532b3ea3, which was
    attempting to fix a bug where we leave instance_system_metadata entries
    undeleted from the DB. There's not an easy way to query for the deleted
    sys_meta data in an efficient manner, and leaving the entries undeleted is
    the lesser of the 2 evils for now.

    Fixes bug 1185190

    Change-Id: I898f0546c49126dcc56a4237120082f95dc82304
    (cherry picked from commit 4885aa28706a1858f4fc51a0d2c661eec05139c0)

Changed in nova:
status: Fix Committed → Fix Released
tags: added: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/31244

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/grizzly)

Reviewed: https://review.openstack.org/31244
Committed: http://github.com/openstack/nova/commit/8c136a8ee4733d8d3af61406fc9eeccb4e9b7a68
Submitter: Jenkins
Branch: stable/grizzly

commit 8c136a8ee4733d8d3af61406fc9eeccb4e9b7a68
Author: Chris Behrens <email address hidden>
Date: Wed May 29 14:21:00 2013 +0000

    Don't delete sys_meta on instance delete

    Unfortunately, we require to access instance_system_metadata to get
    data (specifically at least instance_type data) for instances that have
    been deleted.

    There's 2 cases where this is true:

    1) nova-api supports showing deleting instances when you specify a
    'changes-since' param.
    2) The _usage_audit_log periodic task pulls all instances during the
    audit period, which includes instances that have been deleted during
    that period.

    This reverts commit 17bca438954638d74035d560e826a26a532b3ea3, which was
    attempting to fix a bug where we leave instance_system_metadata entries
    undeleted from the DB. There's not an easy way to query for the deleted
    sys_meta data in an efficient manner, and leaving the entries undeleted is
    the lesser of the 2 evils for now.

    Fixes bug 1185190

    Change-Id: I898f0546c49126dcc56a4237120082f95dc82304
    (cherry picked from commit 4885aa28706a1858f4fc51a0d2c661eec05139c0)

tags: removed: grizzly-backport-potential
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → 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.