support use of id or name when referring to resource in rally scenario args

Registered by Marco Morais

Currently rally scenario arguments only accept uuid for resources. For this feature we will add a preprocessor phase to the scenario lifecycle which can be used to transform scenario arguments. The initial use case for transformations will be to allow users to pass names instead of uuids for resources.

For example, the json blobs below show arguments to the NovaServers.boot_and_delete_server scenario prior to and immediately after the preprocessor has been applied at runtime.

*** pre-transform
{
    "NovaServers.boot_and_delete_server": [
        {
            "args": {
                "flavor": {"name": "m1.nano"},
                "image": {"name": "cirros-0.3.1-x86_64-uec"}
            },
       ...
}
*** post-transform
{
    "NovaServers.boot_and_delete_server": [
        {
            "args": {
                "flavor_id": 1,
                "image_id": "73257560-c59b-4275-a1ec-ab140e5b9979"
            },
       ...
}

Step 1: Add new decorator for benchmark scenario (in benchmark.process module):
def arg(func) # it is similar to validators

Step 2: Add two function for processing arguments
def flavor_transform(src, dest):
     def transformer(**kw):
            src_value = kw.pop(“src”)
            kw[“dest”] = some_transformation_on(src_value)
            return kw
     return transformer

def flavor(src, dest):
      return arg(flavor_transform(src, dest))

Step 3: Add to all benchmarks, that accept smart args (flavor, image)
@process.flavor(src, dest)

Step 4: Run all processing function 1by1 after context & before running benchmark
Step 5: Partial fix for validation method (they should use by hand transformers) It will be in future changed.

Blueprint information

Status:
Complete
Approver:
Boris Pavlovic
Priority:
High
Drafter:
Marco Morais
Direction:
Approved
Assignee:
Marco Morais
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Boris Pavlovic
Completed by
Boris Pavlovic

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:benchmark-pass-id-or-name,n,z

Addressed by: https://review.openstack.org/86116
    [WIP] pass id or name when referring to resources in scenario config

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.