Port rally scenario plugin to new Rally framework
Rally 0.0.4 and current master (which is going to be 0.1.0) have some difference in framework. This patch address them. Change-Id: I45064e27bcbe815ca12e311175addd4ecf9b6056
This commit is contained in:
parent
e0243b434d
commit
812a674135
@ -25,13 +25,14 @@ Rally concepts https://wiki.openstack.org/wiki/Rally/Concepts
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from rally.task.scenarios import base
|
from rally.plugins.openstack import scenario
|
||||||
from rally.task import utils as task_utils
|
from rally.task import atomic
|
||||||
|
from rally.task import utils
|
||||||
|
|
||||||
|
|
||||||
class GlancePlugin(base.Scenario):
|
class GlancePlugin(scenario.OpenStackScenario):
|
||||||
|
|
||||||
@base.atomic_action_timer("glance.create_image_label")
|
@atomic.action_timer("glance.create_image_label")
|
||||||
def _create_image(self, image_name, container_format,
|
def _create_image(self, image_name, container_format,
|
||||||
image_location, disk_format, **kwargs):
|
image_location, disk_format, **kwargs):
|
||||||
"""Create a new image.
|
"""Create a new image.
|
||||||
@ -62,25 +63,22 @@ class GlancePlugin(base.Scenario):
|
|||||||
kw["copy_from"] = image_location
|
kw["copy_from"] = image_location
|
||||||
|
|
||||||
image = self.clients("glance").images.create(**kw)
|
image = self.clients("glance").images.create(**kw)
|
||||||
|
image = utils.wait_for(image,
|
||||||
image = task_utils.wait_for(
|
is_ready=utils.resource_is("active"),
|
||||||
image,
|
update_resource=utils.get_from_manager(),
|
||||||
is_ready=task_utils.resource_is("active"),
|
|
||||||
update_resource=task_utils.get_from_manager(),
|
|
||||||
timeout=100,
|
timeout=100,
|
||||||
check_interval=0.5)
|
check_interval=0.5)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
if "data" in kw:
|
if "data" in kw:
|
||||||
kw["data"].close()
|
kw["data"].close()
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
@base.atomic_action_timer("glance.list_images_label")
|
@atomic.action_timer("glance.list_images_label")
|
||||||
def _list_images(self):
|
def _list_images(self):
|
||||||
return list(self.clients("glance").images.list())
|
return list(self.clients("glance").images.list())
|
||||||
|
|
||||||
@base.scenario(context={"cleanup": ["glance"]})
|
@scenario.configure(context={"cleanup": ["glance"]})
|
||||||
def create_and_list(self, container_format,
|
def create_and_list(self, container_format,
|
||||||
image_location, disk_format, **kwargs):
|
image_location, disk_format, **kwargs):
|
||||||
self._create_image(self._generate_random_name(),
|
self._create_image(self._generate_random_name(),
|
||||||
|
Loading…
Reference in New Issue
Block a user