From ad7c8befa5d580ff05c962fb269ce856086a0ac2 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Tue, 10 Dec 2013 13:00:17 +0100 Subject: [PATCH] Extend options for custom flavor sorting when launching instances Until now, flavors were sorted by RAM, ascending, by default. An option to override this and use a custom callable instead was introduced via the CREATE_INSTANCE_FLAVOR_SORT dict in local_settings.py. This patch introduces another way of using the CREATE_INSTANCE_FLAVOR_SORT dict: by providing a flavor attribute. Change-Id: I5b2819cc3ebc97377e673682d0b2c7ddab94e3d3 Closes-Bug: #1254524 --- openstack_dashboard/test/helpers.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index 806c30be..c0250186 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -403,3 +403,12 @@ class SeleniumAdminTestCase(SeleniumTestCase): if "roles" not in kwargs: kwargs['roles'] = [self.roles.admin._info] super(SeleniumAdminTestCase, self).setActiveUser(*args, **kwargs) + + +def my_custom_sort(flavor): + sort_order = { + 'm1.secret': 0, + 'm1.tiny': 1, + 'm1.massive': 2, + } + return sort_order[flavor.name]