Remove extra field from watcher plugin
This patch set removes extra field from scenarios and context since Watcher team has removed extra field from Watcher and Watcher Client. Change-Id: Ibaf4e9e4e0583b50e8d11aed596f54f5c16449b8
This commit is contained in:
parent
b56ecbda90
commit
7f0f3ea371
@ -17,7 +17,6 @@
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
@ -29,7 +28,6 @@
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
@ -56,12 +54,10 @@
|
||||
name: "workload_balancing"
|
||||
strategy:
|
||||
name: "workload_stabilization"
|
||||
extra: {}
|
||||
- goal:
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
@ -60,9 +60,6 @@ class AuditTemplateGenerator(context.Context):
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"type": "object"
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -100,10 +97,9 @@ class AuditTemplateGenerator(context.Context):
|
||||
strategy_id = types.WatcherStrategy.transform(
|
||||
clients=clients,
|
||||
resource_config=audit_params["strategy"])
|
||||
extra = audit_params.get("extra") or {}
|
||||
|
||||
audit_template = watcher_scenario._create_audit_template(
|
||||
goal_id, strategy_id, extra)
|
||||
goal_id, strategy_id)
|
||||
self.context["audit_templates"].append(audit_template.uuid)
|
||||
|
||||
@logging.log_task_wrapper(LOG.info, _("Exit context: `Audit Templates`"))
|
||||
|
@ -10,6 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from rally.common import logging
|
||||
from rally import consts
|
||||
from rally.plugins.openstack import scenario
|
||||
from rally.plugins.openstack.scenarios.watcher import utils
|
||||
@ -28,18 +29,18 @@ from rally.task import validation
|
||||
name="Watcher.create_audit_template_and_delete")
|
||||
class CreateAuditTemplateAndDelete(utils.WatcherScenario):
|
||||
|
||||
def run(self, goal, strategy, extra=None):
|
||||
@logging.log_deprecated_args("Extra field has been removed "
|
||||
"since it isn't used.", "0.8.0", ["extra"],
|
||||
once=True)
|
||||
def run(self, goal, strategy):
|
||||
"""Create audit template and delete it.
|
||||
|
||||
:param goal: The goal audit template is based on
|
||||
:param strategy: The strategy used to provide resource optimization
|
||||
algorithm
|
||||
:param extra: This field is used to specify some audit template
|
||||
options
|
||||
"""
|
||||
|
||||
extra = extra or {}
|
||||
audit_template = self._create_audit_template(goal, strategy, extra)
|
||||
audit_template = self._create_audit_template(goal, strategy)
|
||||
self._delete_audit_template(audit_template.uuid)
|
||||
|
||||
|
||||
|
@ -34,19 +34,17 @@ class WatcherScenario(scenario.OpenStackScenario):
|
||||
"""Base class for Watcher scenarios with basic atomic actions."""
|
||||
|
||||
@atomic.action_timer("watcher.create_audit_template")
|
||||
def _create_audit_template(self, goal_id, strategy_id, extra):
|
||||
def _create_audit_template(self, goal_id, strategy_id):
|
||||
"""Create Audit Template in DB
|
||||
|
||||
:param goal_id: UUID Goal
|
||||
:param strategy_id: UUID Strategy
|
||||
:param extra: Audit Template Extra (JSON Dict)
|
||||
:return: Audit Template object
|
||||
"""
|
||||
return self.admin_clients("watcher").audit_template.create(
|
||||
goal=goal_id,
|
||||
strategy=strategy_id,
|
||||
name=self.generate_random_name(),
|
||||
extra=extra or {})
|
||||
name=self.generate_random_name())
|
||||
|
||||
@atomic.action_timer("watcher.delete_audit_template")
|
||||
def _delete_audit_template(self, audit_template):
|
||||
|
@ -21,8 +21,7 @@
|
||||
},
|
||||
"strategy": {
|
||||
"name": "dummy"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,4 +17,3 @@
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
|
@ -7,8 +7,7 @@
|
||||
},
|
||||
"strategy": {
|
||||
"name": "dummy"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
|
@ -6,7 +6,6 @@
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
|
@ -17,8 +17,7 @@
|
||||
},
|
||||
"strategy": {
|
||||
"name": "workload_stabilization"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"goal": {
|
||||
@ -26,8 +25,7 @@
|
||||
},
|
||||
"strategy": {
|
||||
"name": "dummy"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -14,9 +14,7 @@
|
||||
name: "workload_balancing"
|
||||
strategy:
|
||||
name: "workload_stabilization"
|
||||
extra: {}
|
||||
- goal:
|
||||
name: "dummy"
|
||||
strategy:
|
||||
name: "dummy"
|
||||
extra: {}
|
||||
|
@ -51,8 +51,7 @@ class AuditTemplateTestCase(test.ScenarioTestCase):
|
||||
},
|
||||
"strategy": {
|
||||
"name": "workload_stabilization"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"goal": {
|
||||
@ -60,8 +59,7 @@ class AuditTemplateTestCase(test.ScenarioTestCase):
|
||||
},
|
||||
"strategy": {
|
||||
"name": "workload_stabilization"
|
||||
},
|
||||
"extra": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -75,7 +73,7 @@ class AuditTemplateTestCase(test.ScenarioTestCase):
|
||||
audit_template.setup()
|
||||
goal_id = mock_watcher_goal_transform.return_value
|
||||
strategy_id = mock_watcher_strategy_transform.return_value
|
||||
mock_calls = [mock.call(goal_id, strategy_id, {})]
|
||||
mock_calls = [mock.call(goal_id, strategy_id)]
|
||||
mock_watcher_scenario__create_audit_template.assert_has_calls(
|
||||
mock_calls)
|
||||
|
||||
|
@ -27,10 +27,9 @@ class WatcherTestCase(test.ScenarioTestCase):
|
||||
scenario._create_audit_template = mock.MagicMock(
|
||||
return_value=audit_template)
|
||||
scenario._delete_audit_template = mock.MagicMock()
|
||||
scenario.run("goal", "strategy", {})
|
||||
scenario.run("goal", "strategy")
|
||||
scenario._create_audit_template.assert_called_once_with("goal",
|
||||
"strategy",
|
||||
{})
|
||||
"strategy")
|
||||
scenario._delete_audit_template.assert_called_once_with(
|
||||
audit_template.uuid)
|
||||
|
||||
|
@ -28,12 +28,11 @@ class WatcherScenarioTestCase(test.ScenarioTestCase):
|
||||
watcher_scenario = utils.WatcherScenario(self.context)
|
||||
watcher_scenario.generate_random_name = mock.MagicMock(
|
||||
return_value="mock_name")
|
||||
watcher_scenario._create_audit_template("fake_goal", "fake_strategy",
|
||||
{})
|
||||
watcher_scenario._create_audit_template("fake_goal", "fake_strategy")
|
||||
self.admin_clients(
|
||||
"watcher").audit_template.create.assert_called_once_with(
|
||||
goal="fake_goal", strategy="fake_strategy",
|
||||
name="mock_name", extra={})
|
||||
name="mock_name")
|
||||
self._test_atomic_action_timer(watcher_scenario.atomic_actions(),
|
||||
"watcher.create_audit_template")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user