From fa5e490e4687349685d50c9ce93bc289be6a61bf Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 6 Dec 2012 17:07:55 -0800 Subject: 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 --- nova/db/sqlalchemy/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 = {} -- cgit