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
This commit is contained in:
Ana Krivokapic 2013-12-10 13:00:17 +01:00
parent 49e6198d4a
commit ad7c8befa5
1 changed files with 9 additions and 0 deletions

View File

@ -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]