ovirtlago package¶
-
class
ovirtlago.
OvirtPrefix
(*args, **kwargs)[source]¶ Bases:
lago.prefix.Prefix
-
class
ovirtlago.
OvirtWorkdir
(*args, **kwargs)[source]¶ Bases:
lago.workdir.Workdir
Submodules¶
ovirtlago.cmd module¶
ovirtlago.constants module¶
ovirtlago.merge_repos module¶
ovirtlago.paths module¶
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.
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: 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: Returns: None
Raises: RuntimeError
– if there’s a local rpm that does not exist in the remote repo urlSee also
-
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
-
name
= 'log-collector-plugin'¶
-
-
class
ovirtlago.testlib.
TaskLogNosePlugin
(*args, **kwargs)[source]¶ Bases:
nose.plugins.base.Plugin
-
name
= 'tasklog-plugin'¶
-
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: Returns: instance of the http server, already running on a thread
Return type:
-
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 configParameters: 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 neededParameters: - command – parameter to send as the command parameter to
lago.utils.run_command()
- **kwargs – keyword parameters to send as the command parameter to
lago.utils.run_command()
Returns: Whatever
lago.utils.run_command()
returnsReturn type: ?
- command – parameter to send as the command parameter to
ovirtlago.virt module¶
-
class
ovirtlago.virt.
EngineVM
(*args, **kwargs)[source]¶ Bases:
lago.virt.VM
-
class
ovirtlago.virt.
HostVM
(env, spec)[source]¶ Bases:
lago.virt.VM
-
class
ovirtlago.virt.
NodeVM
(env, spec)[source]¶ Bases:
lago.virt.VM