Added functions which allow to execute commands

This commit is contained in:
Timur Nurlygayanov
2015-03-18 00:27:59 +03:00
parent 8badbbabfe
commit ba55570ff3
4 changed files with 37 additions and 13 deletions

View File

@@ -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"])

View 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)

View 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()

View File

@@ -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"]