ovirtlago package

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

Bases: lago.prefix.Prefix

_activate()[source]
_create_rpm_repository(dists, repos_path, repo_names, projects_list=None)[source]
_create_virt_env()[source]
_deactivate()[source]
create_snapshots(name, restore=True)[source]
deploy(*args, **kwargs)[source]
prepare_repo(*args, **kwargs)[source]
revert_snapshots(name)[source]
run_test(*args, **kwargs)[source]
serve(*args, **kwargs)[source]
start()[source]
stop()[source]
class ovirtlago.OvirtWorkdir(*args, **kwargs)[source]

Bases: lago.workdir.Workdir

ovirtlago._activate_all_hosts(api)[source]
ovirtlago._activate_all_storage_domains(*args, **kwargs)[source]
ovirtlago._activate_storage_domains(api, sds)[source]
ovirtlago._build_engine_rpms(engine_dir, output_dir, dists, build_gwt=False)[source]
ovirtlago._build_ioprocess_rpms(source_dir, output_dir, dists)[source]
ovirtlago._build_rpms(name, script, source_dir, output_dir, dists, env=None)[source]
ovirtlago._build_vdsm_jsonrpc_java_rpms(source_dir, output_dir, dists)[source]
ovirtlago._build_vdsm_rpms(vdsm_dir, output_dir, dists)[source]
ovirtlago._deactivate_all_hosts(api)[source]
ovirtlago._deactivate_all_storage_domains(*args, **kwargs)[source]
ovirtlago._deactivate_storage_domains(api, sds)[source]
ovirtlago._git_revision_at(path)[source]
ovirtlago._sync_rpm_repository(repo_path, yum_config, repos)[source]
ovirtlago._with_repo_server(func)[source]

Submodules

ovirtlago.cmd module

class ovirtlago.cmd.OvirtCLI[source]

Bases: lago.plugins.cli.CLIPlugin

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 25
_abc_registry = <_weakrefset.WeakSet object>
do_run(args)[source]
init_args = {'help': 'oVirt related actions'}
populate_parser(parser)[source]
ovirtlago.cmd._populate_parser(cli_plugins, parser)[source]

ovirtlago.constants module

ovirtlago.merge_repos module

ovirtlago.merge_repos._fastcopy(source, dest)[source]
ovirtlago.merge_repos.merge(output_dir, input_dirs)[source]

ovirtlago.paths module

class ovirtlago.paths.OvirtPaths(prefix)[source]

Bases: lago.paths.Paths

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

ovirtlago.repoverify module

This module contains all the functions related to syncing yum repos, it also defines the format for the reposync configuration file.

Reposync config file

In order to provide fast package installation to the vms lago creates a local repository for each prefix, right now is also the only way to pass local repos to the vms too.

This file should be a valid yum config file, with the repos that you want to be available for the vms declared there with a small extension, the whitelist and blacklist options:

Include

For each repo you can define an option ‘include’ with a space separated list of fnmatch patterns to allow only rpms that match them

Exclude

Similar to include, you can define an option ‘exclude’ with a space separated list of fnmatch patterns to ignore any rpms that match them

Example:

[main]
reposdir=/etc/reposync.repos.d

[local-vdsm-build-el7]
name=VDSM local built rpms
baseurl=file:///home/dcaro/Work/redhat/ovirt/vdsm/exported-artifacts
enabled=1
gpgcheck=0

[ovirt-master-snapshot-el7]
name=oVirt Master Nightly Test Releases
baseurl=http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/el7/
exclude=vdsm-* ovirt-node-* *-debuginfo ovirt-engine-appliance
enabled=1
gpgcheck=0
ovirtlago.repoverify.RPMNS = {'rpm': 'http://linux.duke.edu/metadata/repo', 'common': 'http://linux.duke.edu/metadata/common'}

Randomly chosen rpm xml name spaces (I swear, we used a dice)

ovirtlago.repoverify._get_packages_from_repo_url(repo_url)[source]
ovirtlago.repoverify._passes_blacklist(blacklist, rpm_string, rpm_name)[source]
ovirtlago.repoverify._passes_lists(whitelist, blacklist, rpm_string, rpm_name)[source]
ovirtlago.repoverify._passes_whitelist(whitelist, rpm_string, rpm_name)[source]
ovirtlago.repoverify._pkg_in_pattern_list(pattern_list, pkg)[source]
ovirtlago.repoverify.fetch_xml(url)[source]

Retrieves an xml resource from a url

Parameters:url (str) – URL to get the xml from
Returns:Root of the xml tree for the retrieved resource
Return type:lxml.etree._Element
ovirtlago.repoverify.gen_to_list(func)[source]

Decorator to wrap the results of the decorated function in a list

ovirtlago.repoverify.get_packages(repo_url, whitelist=None, blacklist=None, only_latest=True)[source]

Retrieves the package info from the given repo, filtering with whitelist and blacklist

Parameters:
  • repo_url (str) – URL to the repo to ger rpm info from
  • whitelist (list of str) – fnmatch patterns to whitelist by
  • blacklist (list of str) – fnmatch patterns to blacklist by
Returns:

list with the rpm info for each rpm that passed the filters, where the returned dict has the keys:

  • name (str): Name of the rpm

  • location (str): URL for the rpm, relative to the repo url

  • checksum (dict): dict with the hash type and value
    • checksum[type] (str): type of checksum (usually sha256)
    • checksum[hash] (str): value for the checksum
  • build_time (int): Time when the package was built

  • version (tuple of str, str, str): tuple with the epoc, version and release strings for that rpm

Return type:

list of dict

Warning

The whitelist is actually doing the same as blacklist, the example below shows what it shoud do, not what it does

Example

>>> get_packages(
...    'http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/el7/',
...    whitelist=['*ioprocess*'],
...    blacklist=['*debuginfo*'],
... )
... 
[{'build_time': 1...,
    'checksum': {'hash': '...',
    'type': 'sha256'},
    'location': 'noarch/python-ioprocess-....el7.noarch.rpm',
    'name': 'python-ioprocess',
    'version': ('...', '...', '....el7')},
{'build_time': 1...,
    'checksum': {'hash': '...',
    'type': 'sha256'},
    'location': 'noarch/python-ioprocess-....el7.noarch.rpm',
    'name': 'python-ioprocess',
    'version': ('...', '...', '....el7')},
{'build_time': 1...,
    'checksum': {'hash': '...',
    'type': 'sha256'},
    'location': 'x86_64/ioprocess-....el7.x86_64.rpm',
    'name': 'ioprocess',
    'version': ('0', '0.15.0', '3.el7')},
{'build_time': 1...,
    'checksum': {'hash': '...',
    'type': 'sha256'},
    'location': 'x86_64/ioprocess-....el7.x86_64.rpm',
    'name': 'ioprocess',
    'version': ('...', '...', '....el7')}]
ovirtlago.repoverify.verify_repo(repo_url, path, whitelist=None, blacklist=None)[source]

Verifies that the given repo url is properly synced to the given path

Parameters:
  • repo_url (str) – Remote URL to sync locally
  • path (str) – Local path to sync to
  • whitelist (list of str) – List of patterns to whitelist by
  • blacklist (list of str) – List of patterns to blacklist by
Returns:

None

Raises:

RuntimeError – if there’s a local rpm that does not exist in the remote repo url

See also

get_packages()

ovirtlago.repoverify.verify_reposync(config_path, sync_dir, repo_whitelist=None)[source]

Verifies that the given reposync configuration is properly updated in the given sync dir, skipping any non-whitelisted repos

Parameters:
  • config_path (str) – Path to the reposync configuration file
  • sync_dir (str) – Local path to the parent dir where to look for the repos, if not there, they will get created
  • repo_whitelist (list of str) – list with the fnmatch patterns to whitelist repos by, if empty or not passed, it will not filter the repos
Returns:

None

ovirtlago.testlib module

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

Bases: nose.plugins.base.Plugin

_addFault(test, err)[source]
addError(test, err)[source]
addFailure(test, err)[source]
configure(options, conf)[source]
name = 'log-collector-plugin'
options(parser, env=None)[source]
class ovirtlago.testlib.TaskLogNosePlugin(*args, **kwargs)[source]

Bases: nose.plugins.base.Plugin

configure(options, conf)[source]
name = 'tasklog-plugin'
options(parser, env)[source]
startTest(test)[source]
stopTest(test)[source]
ovirtlago.testlib._instance_of_any(obj, cls_list)[source]
ovirtlago.testlib._vms_capable(vms, caps)[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.continue_on_failure(func)[source]
ovirtlago.testlib.engine_capability(caps)[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_prefix(func)[source]

ovirtlago.utils module

ovirtlago.utils._BetterHTTPRequestHandler(root_dir)[source]

Factory for _BetterHTTPRequestHandler classes

Parameters:root_dir (path) – Path to the dir to serve
Returns:A ready to be used improved http request handler
Return type:_BetterHTTPRequestHandler
ovirtlago.utils._create_http_server(ip, port, root_dir)[source]

Starts an http server with an improved request handler

Parameters:
  • ip (str) – Ip to listen on
  • port (int) – Port to register on
  • root_dir (str) – path to the directory to serve
Returns:

instance of the http server, already running on a thread

Return type:

BaseHTTPServer

ovirtlago.utils.repo_server_context(*args, **kwds)[source]

Context manager that starts an http server that serves the given prefix’s yum repository. Will listen on constants.REPO_SERVER_PORT and on the first network defined in the previx virt config

Parameters:prefix (ovirtlago.OvirtPrefix) – prefix to start the server for
Returns:None
ovirtlago.utils.run_command(command, **kwargs)[source]

Wrapper around lago.utils.run_command() that prepends the ovirtlago LIBEXEC_DIR to the path if needed

Parameters:
Returns:

Whatever lago.utils.run_command() returns

Return type:

?

ovirtlago.virt module

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

Bases: lago.virt.VM

_artifact_paths()[source]
_create_api()[source]
_get_api(wait)[source]
add_iso(path)[source]
engine_setup(config=None)[source]
get_api(wait=True)[source]
stop()[source]
class ovirtlago.virt.HostVM(env, spec)[source]

Bases: lago.virt.VM

_artifact_paths()[source]
class ovirtlago.virt.NodeVM(env, spec)[source]

Bases: lago.virt.VM

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

Bases: lago.virt.VirtEnv

_create_vm(vm_spec)[source]
engine_vm()[source]
host_vms()[source]