Added functions which allow to execute commands
This commit is contained in:
@@ -40,6 +40,6 @@ class CloudNodesContext(base.Context):
|
||||
def cleanup(self):
|
||||
"""This method is called after the task finish"""
|
||||
for action in self.context["done_actions"]:
|
||||
## we need to import shaiker somehow :)
|
||||
## we need to import shaker somehow :)
|
||||
shaiker.run_command_on_node(action["node"],
|
||||
ACTIONS[action["command"]]["undo"])
|
||||
|
||||
23
rally-scenarios/base_disaster_scenario.py
Normal file
23
rally-scenarios/base_disaster_scenario.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from rally.benchmark.scenarios import base
|
||||
|
||||
|
||||
class BaseDisasterScenario(base.Scenario):
|
||||
|
||||
def boot_vm(self):
|
||||
self._boot_server(self.context["shaker_image"],
|
||||
self.context["default_flavor",
|
||||
{"auto_assign_nic": True})
|
||||
|
||||
def execute_command_on_shaker_node(self, node, command):
|
||||
return None
|
||||
|
||||
def run_command(self, node, command):
|
||||
return self.execute_command_on_shaker_node(node, command)
|
||||
|
||||
def run_disaster_command(self, node, command):
|
||||
do = self.context["actions"][command]["do"]
|
||||
|
||||
done = {"node": node, "command": command}
|
||||
self.context["done_actions"].append(done)
|
||||
|
||||
self.execute_command_on_shaker_node(node, command)
|
||||
13
rally-scenarios/rabbitmq_disaster_scenarios.py
Normal file
13
rally-scenarios/rabbitmq_disaster_scenarios.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import base_disaster_scenario
|
||||
from rally.benchmark.scenarios import base
|
||||
|
||||
|
||||
class BaseDisasterScenario(base_disaster_scenario.BaseDisasterScenario):
|
||||
|
||||
@base.scenario()
|
||||
def test_scenario_1(self):
|
||||
self.run_disaster_command(self.context["controllers"][0],
|
||||
"stop rabbitmq service")
|
||||
|
||||
## need to extend it
|
||||
self.boot_vm()
|
||||
@@ -1,12 +0,0 @@
|
||||
from rally.benchmark.scenarios import base
|
||||
|
||||
|
||||
class shaker_controller(base.Scenario):
|
||||
"""Sample plugin for shaiker."""
|
||||
|
||||
@base.scenario()
|
||||
def sample_print(self):
|
||||
print "its work"
|
||||
print "controllers: ", self.context["controllers"]
|
||||
self.context["nodes"] = ["10", "11", "12"]
|
||||
print "nodes: ", self.context["nodes"]
|
||||
Reference in New Issue
Block a user