From a3a7464a8de96e219f40049fdd03b41cb8eb65ca Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 10 Mar 2012 13:12:27 -0500 Subject: Sort results from describe_instances in EC2 API. Fix bug 827619. This bug pointed out that EC2 sorts the results of of describe_instances by the launch time. Make our implementation of the EC2 API behave the same way. Previously, instances coming out of the db API were sorted by the key we wanted, but in the opposite order. You can now specify both a sort key and order. The behavior is the same by default, but the EC2 API sets the parameter to do an ascending sort. Change-Id: Ifd0bc79ad4c4c8c45809dbb1ac2dadf8abcfd4c3 --- nova/api/ec2/cloud.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index aa1f2203c..81f0c9a7e 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -1160,7 +1160,8 @@ class CloudController(object): # always filter out deleted instances search_opts['deleted'] = False instances = self.compute_api.get_all(context, - search_opts=search_opts) + search_opts=search_opts, + sort_dir='asc') except exception.NotFound: instances = [] for instance in instances: -- cgit