avocado_i2n.states.qcow2 module

Module for the QCOW2 state management backends.

SUMMARY

Copyright: Intra2net AG

INTERFACE

avocado_i2n.states.qcow2.QEMU_OFF_STATES_REGEX = re.compile('^\\d+\\s+([\\w\\.-]+)\\s*(0 B)\\s+\\d{4}-\\d\\d-\\d\\d', re.MULTILINE)

off qemu states regex (0 vm size)

avocado_i2n.states.qcow2.QEMU_ON_STATES_REGEX = re.compile('^\\d+\\s+([\\w\\.-]+)\\s*(?!0 B)(\\d+e?[\\-\\+]?[\\.\\d]* \\w+)\\s+\\d{4}-\\d\\d-\\d\\d', re.MULTILINE)

on qemu states regex (>0 vm size)

class avocado_i2n.states.qcow2.QCOW2Backend[source]

Bases: RootSourcedStateBackend

Backend manipulating image states as internal QCOW2 snapshots.

classmethod state_type() str[source]

State type string representation depending used for logging.

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]

Retrieve a state disregarding the current changes.

All arguments match the base class.

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

Store a state saving the current changes.

All arguments match the base class.

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

Remove a state with previous changes.

All arguments match the base class.

class avocado_i2n.states.qcow2.QCOW2ExtBackend[source]

Bases: SourcedStateBackend, QCOW2Backend

Backend manipulating image states as external QCOW2 snapshots.

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

Check whether a root state or essentially the object exists locally.

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.

class avocado_i2n.states.qcow2.QCOW2VTBackend[source]

Bases: QCOW2Backend

Backend manipulating vm states as QCOW2 snapshots using VT’s VM bindings.

classmethod show(params: Params, object: Any = None) set[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]

Retrieve a state disregarding the current changes.

All arguments match the base class.

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

Store a state saving the current changes.

All arguments match the base class.

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

Remove a state with previous changes.

All arguments match the base class.

avocado_i2n.states.qcow2.get_image_path(params: Params) str[source]

Get the absolute path to a QCOW2 image.

Parameters:

params – configuration parameters

Returns:

absolute path to the QCOW2 image

avocado_i2n.states.qcow2.convert_image(params: Params) None[source]

Convert a raw img to a QCOW2 or other image usable for virtual machines.

Parameters:

params – configuration parameters

Raises:

py:class:FileNotFoundError if the source image doesn’t exist

Raises:

py:class:AssertionError when the source image is in use

Note

This function could be used with qemu-img for more general images and not just the QCOW2 format.