mlos_bench.services.types.host_ops_type module

Protocol interface for Host/VM boot operations.

class mlos_bench.services.types.host_ops_type.SupportsHostOps(*args, **kwargs)

Bases: Protocol

Protocol interface for Host/VM boot operations.

Methods

restart_host(params[, force])

Restarts the host by initiating a (graceful) shutdown.

start_host(params)

Start a Host/VM.

stop_host(params[, force])

Stops the Host/VM by initiating a (graceful) shutdown.

wait_host_operation(params)

Waits for a pending operation on a Host/VM to resolve to SUCCEEDED or FAILED.

restart_host(params: dict, force: bool = False) Tuple[Status, dict]

Restarts the host by initiating a (graceful) shutdown.

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of tunable parameters.

forcebool

If True, force restart the Host/VM.

Returns:
result(Status, dict={})

A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}

start_host(params: dict) Tuple[Status, dict]

Start a Host/VM.

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of tunable parameters.

Returns:
result(Status, dict={})

A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}

stop_host(params: dict, force: bool = False) Tuple[Status, dict]

Stops the Host/VM by initiating a (graceful) shutdown.

Parameters:
paramsdict

Flat dictionary of (key, value) pairs of tunable parameters.

forcebool

If True, force stop the Host/VM.

Returns:
result(Status, dict={})

A pair of Status and result. The result is always {}. Status is one of {PENDING, SUCCEEDED, FAILED}

wait_host_operation(params: dict) Tuple[Status, dict]

Waits for a pending operation on a Host/VM to resolve to SUCCEEDED or FAILED. Return TIMED_OUT when timing out.

Parameters:
params: dict

Flat dictionary of (key, value) pairs of tunable parameters. Must have the “asyncResultsUrl” key to get the results. If the key is not present, return Status.PENDING.

Returns:
result(Status, dict)

A pair of Status and result. Status is one of {PENDING, SUCCEEDED, FAILED, TIMED_OUT} Result is info on the operation runtime if SUCCEEDED, otherwise {}.