summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2012-12-06 17:07:55 -0800
committerClark Boylan <clark.boylan@gmail.com>2012-12-06 17:07:55 -0800
commitfa5e490e4687349685d50c9ce93bc289be6a61bf (patch)
tree4ae1dd7dc439ab06ff7ff0ef95245784eba5101b
parentf495b95d0ee28141bd067ca64a0176189f5d8293 (diff)
downloadnova-fa5e490e4687349685d50c9ce93bc289be6a61bf.tar.gz
nova-fa5e490e4687349685d50c9ce93bc289be6a61bf.tar.xz
nova-fa5e490e4687349685d50c9ce93bc289be6a61bf.zip
Order instance faults by created_at and id.
It is possible that instance faults have the same created_at values so ordering on that field alone is not deterministic. Add an additional order by clause to order descending on id as well. I am not sure if the order by exists to make tests pass; however, without the additional "id" the tests do occasionally fail. See http://logs.openstack.org/15078/18/check/gate-nova-python26/10709/console.html for an example failure. If order does not actually matter we may want to make the test smarter instead. Part of blueprint grizzly-testtools Change-Id: I1c7a07669846c832270631c1734dae509dba7586
-rw-r--r--nova/db/sqlalchemy/api.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 4155fdc3d..537ebaa9e 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -4536,7 +4536,7 @@ def instance_fault_get_by_instance_uuids(context, instance_uuids):
rows = model_query(context, models.InstanceFault, read_deleted='no').\
filter(models.InstanceFault.instance_uuid.in_(
instance_uuids)).\
- order_by(desc("created_at")).\
+ order_by(desc("created_at"), desc("id")).\
all()
output = {}