robottelo.libvirt_discovery

Utilities to create virtual host on libvirt with and without PXE boot

Hosts are virtual guests provisioned on a external libvirt_host. All guests images are stored on the image_dir path on external libvirt server.

Make sure to configure the compute_resources section on the configuration file. Also make sure that the vlan_networking section is properly configured.

Module Contents

Classes

LibvirtGuest

Manages a Libvirt guests to allow host discovery and provisioning

Functions

_gen_mac_for_libvirt()

Attributes

logger

robottelo.libvirt_discovery.logger
robottelo.libvirt_discovery._gen_mac_for_libvirt()
exception robottelo.libvirt_discovery.LibvirtGuestError

Bases: Exception

Exception raised for failed virtual guests on external libvirt

class robottelo.libvirt_discovery.LibvirtGuest(cpu=1, ram=1024, boot_iso=False, extra_nic=False, libvirt_server=None, image_dir=None, mac=None, network=None, network_type=None)

Manages a Libvirt guests to allow host discovery and provisioning

It expects that Libvirt host is defined with image path. Make sure to call destroy() to stop and clean the image on the libvirt server, otherwise the virtual machine and its image will stay on the server consuming hardware resources.

It is possible to customize the libvirt_host and image_dir as per virtual machine basis. Just set the expected values when instantiating.

create(self)

Creates a virtual machine on the libvirt server using virt-install

Raises

robottelo.libvirt_discovery.LibvirtGuestError – Whenever a virtual guest could not be executed.

destroy(self)

Destroys the virtual machine on the provisioning server

attach_nic(self)

Add a new NIC to existing host

__enter__(self)
__exit__(self, *exc)