Deprecate 'command' argument of VMTasks.dd_load_test
VMTasks.dd_load_test appeared as an inheritor of VMTasks.boot_runcommand_delete scenario with hardcoded script to execute. Hardcoded script simplifies both user experience (they do not need to prepare script itself or find it in our samples/source) maintaining (we can ensure that VMTasks.dd_load_test always launchs the latest version of ther script). As like the logic, VMTasks.dd_load_test inherited all the arguments of the parent which is not convinient when we talk about "command" argument. The "command" argument of VMTasks.boot_runcommand_delete is designed to describe what and how the thing should be executed in the VM. For example, the can be just a command or script which should be executed. In VMTasks.dd_load_test we have hardcoded script to execute, so allowing to setup "command" argument can mislead our customers. But anyway, we still need to be able setup some part of it. Despite the fact that we know the interpreter for which our script is written, the VM can be launched from not trivial image which can use alternative interpreter (some variety of /bin/sh like /bin/csh in OpenBSD). So this patch deprecates 'command' argument and replaces it with 'interpreter' (it defaults to /bin/sh). Change-Id: Idbf45c71b66e55ce8eb43a6a913f7bf526712a0b
This commit is contained in:
parent
7ffa1b95c5
commit
6ed06f974f
@ -776,8 +776,6 @@
|
||||
name: {{image_name}}
|
||||
floating_network: "public"
|
||||
force_delete: false
|
||||
command:
|
||||
interpreter: "/bin/sh"
|
||||
username: "cirros"
|
||||
runner:
|
||||
type: "constant"
|
||||
|
@ -222,12 +222,9 @@ class BootRuncommandDelete(vm_utils.VMScenario, cinder_utils.CinderBasic):
|
||||
:param use_floating_ip: bool, floating or fixed IP for SSH connection
|
||||
:param force_delete: whether to use force_delete for servers
|
||||
:param wait_for_ping: whether to check connectivity on server creation
|
||||
:param **kwargs: extra arguments for booting the server
|
||||
:param max_log_length: The number of tail nova console-log lines user
|
||||
would like to retrieve
|
||||
:returns: dictionary with keys `data' and `errors':
|
||||
data: dict, JSON output from the script
|
||||
errors: str, raw data from the script's stderr stream
|
||||
:param kwargs: extra arguments for booting the server
|
||||
"""
|
||||
if volume_args:
|
||||
volume = self.cinder.create_volume(volume_args["size"],
|
||||
@ -480,7 +477,6 @@ EOF
|
||||
flavor={"type": "nova_flavor"})
|
||||
@validation.add("image_valid_on_flavor", flavor_param="flavor",
|
||||
image_param="image")
|
||||
@validation.add("valid_command", param_name="command")
|
||||
@validation.add("number", param_name="port", minval=1, maxval=65535,
|
||||
nullable=True, integer_only=True)
|
||||
@validation.add("external_network_exists", param_name="floating_network")
|
||||
@ -493,12 +489,20 @@ EOF
|
||||
name="VMTasks.dd_load_test",
|
||||
platform="openstack")
|
||||
class DDLoadTest(BootRuncommandDelete):
|
||||
|
||||
def run(self, command, **kwargs):
|
||||
@logging.log_deprecated_args(
|
||||
"Use 'interpreter' to specify the interpreter to execute script from.",
|
||||
"0.10.0", ["command"], once=True)
|
||||
def run(self, interpreter="/bin/sh", command=None, **kwargs):
|
||||
"""Boot a server from a custom image, run a command that outputs JSON.
|
||||
|
||||
Example Script in rally-jobs/extra/install_benchmark.sh
|
||||
:param command: default parameter from scenario
|
||||
|
||||
:param interpreter: the interpreter to execute script with dd load test
|
||||
(defaults to /bin/sh)
|
||||
:param command: deprecated
|
||||
"""
|
||||
command["script_inline"] = BASH_DD_LOAD_TEST
|
||||
return super(DDLoadTest, self).run(command=command, **kwargs)
|
||||
cmd = {"interpreter": interpreter,
|
||||
"script_inline": BASH_DD_LOAD_TEST}
|
||||
if command and "interpreter" in command:
|
||||
cmd["interpreter"] = command["interpreter"]
|
||||
return super(DDLoadTest, self).run(command=cmd, **kwargs)
|
||||
|
@ -11,9 +11,7 @@
|
||||
},
|
||||
"floating_network": "public",
|
||||
"force_delete": false,
|
||||
"command": {
|
||||
"interpreter": "/bin/sh"
|
||||
},
|
||||
"interpreter": "/bin/sh",
|
||||
"username": "cirros"
|
||||
},
|
||||
"runner": {
|
||||
|
@ -9,8 +9,7 @@
|
||||
name: "^cirros.*-disk$"
|
||||
floating_network: "public"
|
||||
force_delete: false
|
||||
command:
|
||||
interpreter: "/bin/sh"
|
||||
interpreter: "/bin/sh"
|
||||
username: "cirros"
|
||||
runner:
|
||||
type: "constant"
|
||||
|
Loading…
Reference in New Issue
Block a user