Instance usage audit should be based on deleted_at not terminated_at

Bug #1226036 reported by Phil Day
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Medium
David Ripton

Bug Description

Currently the DB query used by the instance usage audit, instance_get_active_by_window_joined() uses the terminated_at timestamp.

terminated_at is normally set as part of the instance deletion processing, however there are cases where an exception at the wrong time could prevent terminated_at from being set. Also the recent bug fixed by this change https://review.openstack.org/#/c/42534/ missed out this update altogether, so instances created by a system with that bug in-situ will now have large numbers of instances that will be continually reported as existing even though the entry in the DB is deleted.

Given that instance_usage_audit is meant to report on instances that from the DB perspective existed on a host in the previous audit period it would be more consistent to change instance_get_active_by_window_joined() to use deleted_at - which is set directly by the DB layer when the entry is deleted.

This would mean instances which have terminated_at set but not deleted would be reported as existing - which is also more consistent with the intended behviour of the audit.

The only case where terminated_at is not set as part of deletion is already reported as a separate bug: https://bugs.launchpad.net/nova/+bug/1189554

Tags: compute db
Phil Day (philip-day)
description: updated
Matt Riedemann (mriedem)
tags: added: compute db
Revision history for this message
David Ripton (dripton) wrote :

Good catch Phil. This one doesn't look too hard to fix, so I'm going to try to squash it for havana-rc1

Changed in nova:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → David Ripton (dripton)
milestone: none → havana-rc1
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/46950

Changed in nova:
status: Triaged → In Progress
Changed in nova:
milestone: havana-rc1 → none
Revision history for this message
Joe Gordon (jogo) wrote :

patch was abandoned.

Changed in nova:
status: In Progress → Opinion
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.