ovirtlago package

Submodules

ovirtlago.cmd module

ovirtlago.constants module

ovirtlago.paths module

class ovirtlago.paths.OvirtPaths(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

build_dir(*path)[source]
internal_repo(*path)[source]
test_logs(*args)[source]

ovirtlago.prefix module

ovirtlago.reposetup module

exception ovirtlago.reposetup.RepositoryError[source]

Bases: exceptions.Exception

exception ovirtlago.reposetup.RepositoryMergeError[source]

Bases: ovirtlago.reposetup.RepositoryError

ovirtlago.reposetup.merge(output_dir, sources, repoman_config=None)[source]

Run repoman on sources, creating a new RPM repository in output_dir

Args:

output_dir(str): Path to create new repository sources(list of str): repoman sources repoman_config(str): repoman configuration file, if not passed it will

use default repoman configurations, equivalent to:

[main]
on_empty_source=warn
[store.RPMStore]
on_wrong_distro=copy_to_all
with_srcrpms=false
with_sources=false
Raises:
RepositoryMergeError: If repoman command failed. IOError: If repoman_config is passed but does not exists.
Returns:
None
ovirtlago.reposetup.sync_rpm_repository(repo_path, yum_config, repos)[source]
ovirtlago.reposetup.with_repo_server(func)[source]

A decorator that starts an http server which serves the prefix’s internal_repo. The server will listen on the management network’s IP, and on port constans.REPO_SERVER_PORT

Args:
The first argument to the wrapped func should be a
lago.prefix.Prefix instance.

ovirtlago.server module

class ovirtlago.server.LagoThreadingTCPServer(server_address, RequestHandlerClass, allowed_exceptions=(), allowed_errnos=(32, ))[source]

Bases: SocketServer.ThreadingTCPServer

A custom multi-threaded TCP server.

We use allow_reuse_address in order to avoid a race when opening and closing multiple servers (at each point in time only one server is listening). For example, the first server has a connection in ‘time_wait’ state, while the second server tries to bind its socket.

Attributes:
_allowed_exceptions(tuple of Exceptions): If an exception occurs
and its type isn’t not in _allowed_exceptions, its traceback will be printed to the log.
_allowed_errnos(tuple of ints): If an OSError exception occurs
and its errno isn’t not in _allowed_errnos, its traceback will be printed to the log.
allow_reuse_address = True
handle_error(request, client_address)[source]

Handle an error gracefully

Overrides the default implementation which prints the error to stdout and stderr

ovirtlago.server.generate_request_handler(root_dir)[source]

Factory for _BetterHTTPRequestHandler classes

Args:
root_dir (path): Path to the dir to serve
Returns:
_BetterHTTPRequestHandler: A ready to be used improved http request
handler
ovirtlago.server.repo_server_context(*args, **kwds)[source]

Context manager that starts a generic http server that serves root_dir, and listens on gw_ip:port.

Args:
gw_ip(str): IP to listen on port(int): Port to listen on root_dir(str): The root directory that will be served.

ovirtlago.testlib module

class ovirtlago.testlib.LogCollectorPlugin(prefix)[source]

Bases: nose.plugins.base.Plugin

addError(test, err)[source]
addFailure(test, err)[source]
configure(options, conf)[source]

Configure the plugin and system, based on selected options.

The base plugin class sets the plugin to enabled if the enable option for the plugin (self.enableOpt) is true.

name = 'log-collector-plugin'
options(parser, env=None)[source]

Register commandline options.

Implement this method for normal options behavior with protection from OptionConflictErrors. If you override this method and want the default –with-$name option to be registered, be sure to call super().

class ovirtlago.testlib.TaskLogNosePlugin(*args, **kwargs)[source]

Bases: nose.plugins.base.Plugin

addError(test, err)[source]
configure(options, conf)[source]

Configure the plugin and system, based on selected options.

The base plugin class sets the plugin to enabled if the enable option for the plugin (self.enableOpt) is true.

name = 'tasklog-plugin'
options(parser, env)[source]

Register commandline options.

Implement this method for normal options behavior with protection from OptionConflictErrors. If you override this method and want the default –with-$name option to be registered, be sure to call super().

score = 10000
startTest(test)[source]
stopTest(test)[source]
ovirtlago.testlib.assert_equals_within(func, value, timeout, allowed_exceptions=None, initial_wait=10)[source]
ovirtlago.testlib.assert_equals_within_long(func, value, allowed_exceptions=None)[source]
ovirtlago.testlib.assert_equals_within_short(func, value, allowed_exceptions=None)[source]
ovirtlago.testlib.assert_true_within(func, timeout, allowed_exceptions=None)[source]
ovirtlago.testlib.assert_true_within_long(func, allowed_exceptions=None)[source]
ovirtlago.testlib.assert_true_within_short(func, allowed_exceptions=None)[source]
ovirtlago.testlib.engine_capability(caps)[source]
ovirtlago.testlib.get_prefixed_name(entity_name)[source]
ovirtlago.testlib.get_test_prefix()[source]
ovirtlago.testlib.host_capability(caps)[source]
ovirtlago.testlib.test_sequence_gen(test_list)[source]
ovirtlago.testlib.with_ovirt_api(func)[source]
ovirtlago.testlib.with_ovirt_api4(func)[source]
ovirtlago.testlib.with_ovirt_api4_service(func)[source]
ovirtlago.testlib.with_ovirt_prefix(func)[source]

ovirtlago.utils module

ovirtlago.utils.available_sdks(modules=None)[source]
ovirtlago.utils.get_data_file(basename)[source]

Load a data as a string from the data directory

Args:
basename(str): filename
Returns:
str: string representation of the file
ovirtlago.utils.partial(func, *args, **kwargs)[source]
ovirtlago.utils.require_sdk(version, modules=None)[source]

ovirtlago.virt module

class ovirtlago.virt.EngineVM(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

add_iso(path)[source]
check_sds_status(**kwargs)[source]
engine_setup(config=None)[source]
get_api(api_ver=3)[source]
get_api_v3()[source]
get_api_v4(check=False)[source]
get_api_v4_system_service()[source]
start_all_hosts(**kwargs)[source]
start_all_vms(**kwargs)[source]
status(**kwargs)[source]
stop()[source]
stop_all_hosts(**kwargs)[source]
stop_all_vms(**kwargs)[source]
class ovirtlago.virt.HEHostVM(*args, **kwargs)[source]

Bases: ovirtlago.virt.HostVM

class ovirtlago.virt.HostVM(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

class ovirtlago.virt.NodeVM(*args, **kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

wait_for_ssh()[source]
class ovirtlago.virt.OvirtVirtEnv(prefix, vm_specs, net_spec)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

assert_engine_alive(timeout=120)[source]

Assert service ‘ovirt-engine’ reports running on the engine VM

Args:
timeout(int): timeout
Returns:
None
Raises:
AssertionError: if ovirt-engine is not reported running after the
given timeout, or ssh is unreachable.
assert_vdsm_alive(timeout=120)[source]

Assert service ‘vdsmd’ reports running on all vdsm hosts

Args:
timeout(int): timeout
Returns:
None
Raises:
AssertionError: if vdsmd is not reported running after the
given timeout, or ssh is unreachable.
engine_vm()[source]
get_ovirt_cpu_family(host=None)[source]

Get a suitable string for oVirt Cluster CPU. If host is None, it will use a random host, if no hosts are available it will use the Engine VM for detection. The detection is done by getting the VM host CPU model and vendor, from Lago, which in its turn is based on what was configured in the LagoInitFile. The detected model and vendor are then compared against the definitions in data/ovirt-cpu-map.yaml or against a custom file, if ovirt-cpu-map parameter was defined in the host’s metadata section.

Args:
host(lago.vm.DefaultVM): VM CPU/vendor to use for detection
Returns:
str: oVirt CPU Cluster string
Raises:
RuntimeError: If unsupported cpu vendor or model is detected
host_vms()[source]
update_clusters_cpu(**kwargs)[source]