teuthology.openstack package

Module contents

exception teuthology.openstack.NoFlavorException

Bases: Exception

class teuthology.openstack.OpenStack

Bases: object

cache_token()
cloud_init_wait(instance)

Wait for cloud-init to complete on the name_or_ip OpenStack instance.

flavor(hint, arch)
flavor_range(min, good, arch)
get_available_archs()
get_default_arch()
get_ip(instance_id, network)
get_network()
get_os_flavors()
get_os_url(cmd, type=None)
get_provider()
get_sorted_flavors(arch, select, flavor_list=None)
static get_value(result, field)

Get the value of a field from a result returned by the openstack command in json format.

Parameters
  • result – A dictionary similar to the output of ‘openstack server show’

  • field – The name of the field whose value to retrieve. Case is ignored.

image(os_type, os_version, arch)

Return the image name for the given os_type and os_version. If the image does not exist it will be created.

image2url = {'centos-7.2-x86_64': 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1511.qcow2', 'centos-7.3-x86_64': 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1701.qcow2', 'debian-8.0-x86_64': 'http://cdimage.debian.org/cdimage/openstack/current/debian-8.7.1-20170215-openstack-amd64.qcow2', 'opensuse-42.1-x86_64': 'http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2', 'opensuse-42.2-x86_64': 'http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.2/images/openSUSE-Leap-42.2-OpenStack.x86_64.qcow2', 'opensuse-42.3-x86_64': 'http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.3/images/openSUSE-Leap-42.3-OpenStack.x86_64.qcow2', 'ubuntu-14.04-aarch64': 'https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-arm64-disk1.img', 'ubuntu-14.04-i686': 'https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386-disk1.img', 'ubuntu-14.04-x86_64': 'https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img', 'ubuntu-16.04-aarch64': 'https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img', 'ubuntu-16.04-i686': 'https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-i386-disk1.img', 'ubuntu-16.04-x86_64': 'https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img'}
image_create(name, arch)

Upload an image into OpenStack

image_exists(image)

Return true if the image exists in OpenStack.

image_name(name)

Return the image name used by teuthology in OpenStack to avoid conflicts with existing names.

interpret_hints(defaults, hints)

Return a hint hash which is the interpretation of a list of hints

static list_instances()
static list_volumes()
net()

Return the network to be used when creating an OpenStack instance. By default it should not be set. But some providers such as entercloudsuite require it is.

net_id(network)

Return the uuid of the network in OpenStack.

run(cmd, *args, **kwargs)
set_provider()
static sort_flavors(flavors)
token = None
token_cache_duration = 3600
token_expires = None
type_version_arch(os_type, os_version, arch)

Return the string used to differentiate os_type and os_version in names.

volume_delete(name_or_id)
class teuthology.openstack.OpenStackInstance(name_or_id, info=None)

Bases: object

destroy()

Delete the name_or_id OpenStack instance.

exists()
get_addresses()

Return the list of IPs associated with instance_id in OpenStack.

get_created()
get_floating_ip()
get_floating_ip_or_ip()
get_ip(network)

Return the private IP of the OpenStack instance_id.

get_ip_neutron()
get_volumes()

Return the uuid of the volumes attached to the name_or_id OpenStack instance.

set_info()
class teuthology.openstack.TeuthologyOpenStack(args, config, argv)

Bases: teuthology.openstack.OpenStack

static associate_floating_ip(name_or_id)

Associate a floating IP to the OpenStack instance or do nothing if no floating ip can be created.

create_cluster()
static create_floating_ip()
create_security_group()

Create a security group that will be used by all teuthology created instances. This should not be necessary in most cases but some OpenStack providers enforce firewall restrictions even among instances created within the same tenant.

static delete_floating_ip(instance_id)

Remove the floating ip from instance_id and delete it.

static get_floating_ip_id(ip)

Return the id of a floating IP

get_instance()
get_instance_id()
static get_os_floating_ips()
static get_unassociated_floating_ip()

Return a floating IP address not associated with an instance or None.

get_user_data()

Create a user-data.txt file to be used to spawn the teuthology cluster, based on a template where the OpenStack credentials and a few other values are substituted.

key_pair()
main()

Entry point implementing the teuthology-openstack command.

packages_repository()
reminders()
run_suite()

Delegate running teuthology-suite to the OpenStack instance running the teuthology cluster.

server_group()
server_name()
setup()
setup_logs()

Setup the log level according to –verbose

ssh(command)

Run a command in the OpenStack instance of the teuthology cluster. Return the stdout / stderr of the command.

teardown()

Delete all instances run by the teuthology cluster and delete the instance running the teuthology cluster.

teuthology_openstack_flavor(arch)

Return an OpenStack flavor fit to run the teuthology cluster. The RAM size depends on the maximum number of workers that will run simultaneously.

verify_openstack()

Check there is a working connection to an OpenStack cluster and set the provider data member if it is among those we know already.

worker_group()
teuthology.openstack.cmd_repr(dumper, data)
class teuthology.openstack.cmd_str

Bases: str

teuthology.openstack.enforce_json_dictionary(something)
teuthology.openstack.main(ctx, argv)