avocado_i2n.states.pool module

Module for the QCOW2 pool state management backend.

SUMMARY

Copyright: Intra2net AG

INTERFACE

avocado_i2n.states.pool.SKIP_LOCKS = False

skip waiting on locks if we only read from the pool for all processes WARNING: use it only if you know what you are doing

class avocado_i2n.states.pool.TransferOps[source]

Bases: object

A small namespace for pool transfer operations of multiple types.

classmethod list_paths(pool_path: str, params: Params) list[str][source]

List all states in a path from the pool.

Parameters:
  • pool_path – pool path to list pool states from

  • params – configuration parameters

classmethod compare(cache_path: str, pool_path: str, params: Params) bool[source]

Compare cache and pool external state version.

Parameters:
  • cache_path – cache path to compare with

  • pool_path – pool path to compare with

  • params – configuration parameters

classmethod download(cache_path: str, pool_path: str, params: Params) None[source]

Download a path from the pool depending on the pool location.

Parameters:
  • cache_path – cache path to download to

  • pool_path – pool path to download from

  • params – configuration parameters

classmethod upload(cache_path: str, pool_path: str, params: Params) None[source]

Upload a path to the pool depending on the pool location.

Parameters:
  • cache_path – cache path to upload from

  • pool_path – pool path to upload to

  • params – configuration parameters

classmethod delete(pool_path: str, params: Params) None[source]

Delete a path in the pool depending on the pool location.

Parameters:
  • pool_path – path in the pool to delete

  • params – configuration parameters

static list_local(pool_path: str, params: Params) list[str][source]

List all states in a path from the pool.

All arguments are identical to the main entry method.

static compare_local(cache_path: str, pool_path: str, params: Params) bool[source]

Compare cache and pool external state version.

All arguments are identical to the main entry method.

static download_local(cache_path: str, pool_path: str, params: Params) None[source]

Download a path from the pool depending on the pool location.

All arguments are identical to the main entry method.

static upload_local(cache_path: str, pool_path: str, params: Params) None[source]

Upload a path to the pool depending on the pool location.

All arguments are identical to the main entry method.

static delete_local(pool_path: str, params: Params) None[source]

Delete a path in the pool depending on the pool location.

All arguments are identical to the main entry method.

static list_remote(pool_path: str, params: Params) list[str][source]

List all states in a path from the pool.

All arguments are identical to the main entry method.

static compare_remote(cache_path: str, pool_path: str, params: Params) bool[source]

Compare cache and pool external state version.

All arguments are identical to the main entry method.

static download_remote(cache_path: str, pool_path: str, params: Params) None[source]

Download a path from the pool depending on the pool location.

All arguments are identical to the main entry method.

static upload_remote(cache_path: str, pool_path: str, params: Params) None[source]

Upload a path to the pool depending on the pool location.

All arguments are identical to the main entry method.

static delete_remote(pool_path: str, params: Params) None[source]

Delete a path in the pool depending on the pool location.

All arguments are identical to the main entry method.

Compare cache and pool external state version.

All arguments are identical to the main entry method.

..todo:: True symlink support is available only for simple backing chains -

we cannot have the same get_location for an entire chain here since some backing files are links and not the originals.

List all states in a path from the pool.

All arguments are identical to the main entry method.

Download a path from the pool depending on the pool location.

All arguments are identical to the main entry method.

Upload a path to the pool depending on the pool location.

All arguments are identical to the main entry method.

Delete a path in the pool depending on the pool location.

All arguments are identical to the main entry method.

class avocado_i2n.states.pool.QCOW2ImageTransfer[source]

Bases: StateBackend

Backend manipulating root or external states from a shared pool of QCOW2 images.

ops

alias of TransferOps

classmethod check_root(params: Params, object: Any = None) bool[source]

Check whether a root state or essentially the object exists.

All arguments match the base class.

classmethod unset_root(params: Params, object: Any = None) None[source]

Unset a root state to prevent object existence.

All arguments match the base class and in addition:

classmethod compare_chain(state: str, cache_dir: str, pool_dir: str, params: Params) bool[source]

Compare checksums for all dependencies states backing a given state.

Parameters:
  • state – state name

  • cache_dir – root cache directory to compare from/to

  • pool_dir – root pool directory to compare from/to

  • params – configuration parameters

classmethod transfer_chain(state: str, cache_dir: str, pool_dir: str, params: Params, down: bool = True) None[source]

Repeat pool operation an all dependencies states backing a given state.

Parameters:
  • state – state name

  • cache_dir – root cache directory to transfer from/to

  • pool_dir – root pool directory to transfer from/to

  • params – configuration parameters

  • down – whether the chain is downloaded or uploaded

classmethod show(params: Params, object: Any = None) list[str][source]

Return a list of available states of a specific type.

All arguments match the base class.

classmethod get(params: Params, object: Any = None) None[source]

Get a state transferring its entire chain of dependencies.

All arguments match the base class.

classmethod set(params: Params, object: Any = None) None[source]

Set a state transferring its entire chain of dependencies.

All arguments match the base class.

classmethod unset(params: Params, object: Any = None) None[source]

Unset a state preserving its entire chain of dependencies.

All arguments match the base class and in addition:

class avocado_i2n.states.pool.RootSourcedStateBackend[source]

Bases: StateBackend

Backend manipulating root states from a possibly shared source.

transport

alias of QCOW2ImageTransfer

classmethod check_root(params: Params, object: Any = None) list[TestObject] | bool[source]

Check whether a root state or essentially the object exists.

All arguments match the base class.

classmethod unset_root(params: Params, object: Any = None) None[source]

Unset a root state to prevent object existence.

All arguments match the base class and in addition:

class avocado_i2n.states.pool.SourcedStateBackend[source]

Bases: StateBackend

Backend manipulating states from a possibly shared source.

transport

alias of QCOW2ImageTransfer

classmethod show(params: Params, object: Any = None) list[str][source]

Return a list of available states of a specific type.

All arguments match the base class.

classmethod get(params: Params, object: Any = None) None[source]

Get a state from the best possible mirror in a certain restricted scope.

All arguments match the base class.

classmethod set(params: Params, object: Any = None) None[source]

Set a state to all mirrors in a certain restricted scope.

All arguments match the base class.

classmethod unset(params: Params, object: Any = None) None[source]

Unset a state to all mirrors in a certain restricted scope.

All arguments match the base class and in addition:

avocado_i2n.states.pool.image_lock(resource_path: str, timeout: int = 300) None[source]

Wait for a lock to free image for state pool operations.

Parameters:
  • resource_path – path to the potentially locked resource

  • timeout – timeout to wait before erroring out (default 5 mins)