[Verify] Don't create new flavor when flavor already exists

The current Tempest resources context creates a flavor in the cloud
every time when we run the tests and even when we run only one test.
It is not optimal. In order to avoid creating the flavor every time,
before running tests Rally will try to discover flavor with the
following properties: RAM = (64 or 128)MB, CPU = 1, disk = 0GB and,
if the flavor is not discovered, Rally will create it.

Change-Id: I920d5eebbd3dd6c00bd4d8ba915108e7b3e22e78
This commit is contained in:
Yaroslav Lobankov 2016-01-31 19:48:50 -06:00
parent db2011e5d6
commit 59a9b5559e

View File

@ -118,11 +118,12 @@ class FakeServer(FakeResource):
class FakeImage(FakeResource): class FakeImage(FakeResource):
def __init__(self, manager=None, id="image-id-0", min_ram=0, def __init__(self, manager=None, id="image-id-0", min_ram=0,
size=0, min_disk=0, name=None): size=0, min_disk=0, status="active", name=None):
super(FakeImage, self).__init__(manager, id=id, name=name) super(FakeImage, self).__init__(manager, id=id, name=name)
self.min_ram = min_ram self.min_ram = min_ram
self.size = size self.size = size
self.min_disk = min_disk self.min_disk = min_disk
self.status = status
self.update = mock.MagicMock() self.update = mock.MagicMock()
@ -158,11 +159,12 @@ class FakeNetwork(FakeResource):
class FakeFlavor(FakeResource): class FakeFlavor(FakeResource):
def __init__(self, id="flavor-id-0", manager=None, ram=0, disk=0, def __init__(self, id="flavor-id-0", manager=None, ram=0, disk=0, vcpus=1,
name="flavor-name-0"): name="flavor-name-0"):
super(FakeFlavor, self).__init__(manager, id=id) super(FakeFlavor, self).__init__(manager, id=id)
self.ram = ram self.ram = ram
self.disk = disk self.disk = disk
self.vcpus = vcpus
self.name = name self.name = name