testCloud API

instance

This is a module for downloading fedora cloud images (and probably any other qcow2) and then booting them locally with qemu.

class testCloud.instance.Instance(name, image=None)[source]

The Instance class handles the creation, location and customization of existing testCloud instances (which are qcow2 backed from an Image)

boot()[source]

Boot an already spawned instance.

destroy()[source]

Destroy an already stopped instance

Raises TestCloudInstanceError:
 if the image does not exist or is still running
exists()[source]

Check to see if this instance already exists.

expand_qcow(size='+10G')[source]

Expand the storage for a qcow image. Currently only used for Atomic Hosts.

set_seed(path)[source]

Set the seed image for the instance.

spawn_vm(expand_disk=False)[source]

Boot the cloud image redirecting local port 8888 to 80 on the vm as well as local port 2222 to 22 on the vm so http and ssh can be accessed.

Pass True to expand_disk if booting a fresh atomic image or you want to grow the disk size for some other reason at boot.

start()[source]

Start the instance

stop()[source]

Stop the instance

testCloud.instance.find_instance(name, image=None)[source]

Find an instance using a given name and image, if it exists.

Parameters:
Returns:

Instance if the instance exists, None if it doesn’t

testCloud.instance.list_instances(connection='qemu:///system')[source]

List instances known by testCloud and the state of each instance

Parameters:connection – libvirt compatible connection to use when listing domains
Returns:dictionary of instance_name to domain_state mapping

image

This is a module for downloading fedora cloud images (and probably any other qcow2) and then booting them locally with qemu.

class testCloud.image.Image(uri)[source]

Handles base cloud images and prepares them for boot. This includes downloading images from remote systems (http, https supported) or copying from mounted local filesystems.

prepare()[source]

Prepare the image for local use by either downloading the image from a remote location or copying it into the image cache from a locally mounted filesystem

util

This module contains helper functions for the housekeeping tasks of testCloud.

testCloud.util.clean_dirs()[source]

Remove dirs after a test run.

testCloud.util.create_dirs()[source]

Create the dirs in the download dir we need to store things.

testCloud.util.find_ip_from_mac(mac)[source]

Look through arp -an output for the IP of the provided MAC address.

testCloud.util.find_mac(xml_string)[source]

Pass in a virsh xmldump and return a list of any mac addresses listed. Typically it will just be one.

testCloud.util.get_vm_xml(instance_name)[source]

Query virsh for the xml of an instance by name.

testCloud.util.list_pristine()[source]

List the pristine images currently saved.

cli

This is the primary user entry point for testCloud

testCloud.cli.find_vm_ip(name)[source]

Finds the ip of a local vm given it’s name used by libvirt.

Parameters:name – name of the VM (as used by libvirt)
Returns:ip address of VM
Return type:str

Table Of Contents

Previous topic

testCloud, in Depth

This Page