teuthology.provision package

Submodules

teuthology.provision.downburst module

class teuthology.provision.downburst.Downburst(name, os_type, os_version, status=None, user='ubuntu', logfile=None)

Bases: object

A class that provides methods for creating and destroying virtual machine instances using downburst: https://github.com/ceph/downburst

build_config()

Assemble a configuration to pass to downburst, and write it to a file.

create()

Launch a virtual machine instance.

If creation fails because an instance with the specified name is already running, first destroy it, then try again. This process will repeat two more times, waiting 60s between tries, before giving up.

destroy()

Destroy (shutdown and delete) a virtual machine instance.

remove_config()

Remove the downburst configuration file created by build_config()

teuthology.provision.downburst.downburst_executable()

First check for downburst in the user’s path. Then check in ~/src, ~ubuntu/src, and ~teuthology/src. Return ‘’ if no executable downburst is found.

teuthology.provision.downburst.get_distro_from_downburst()

Return a table of valid distros.

If downburst is in path use it. If either downburst is unavailable, or if downburst is unable to produce a json list, then use a default table.

teuthology.provision.fog module

class teuthology.provision.fog.FOG(name, os_type, os_version)

Bases: object

Reimage bare-metal machines with https://fogproject.org/

cancel_deploy_task(task_id)

Cancel an active deploy task

create()

Initiate deployment and wait until completion

deploy_task_active(task_id)
Parameters:task_id – The id of the task to query
Returns:True if the task is active
destroy()

A no-op; we just leave idle nodes as-is

do_request(url_suffix, data=None, method='GET', verify=True)

A convenience method to submit a request to the FOG server :param url_suffix: The portion of the URL to append to the endpoint,

e.g. ‘/system/info’
Parameters:
  • data – Optional JSON data to submit with the request
  • method – The HTTP method to use for the request (default: ‘GET’)
  • verify – Whether or not to raise an exception if the request is unsuccessful (default: True)
Returns:

A requests.models.Response object

get_deploy_tasks()
Returns:A list of deploy tasks which are active on our host
get_host_data()

Locate the host we want to use, and return the FOG object which represents it :returns: A dict describing the host

get_image_data()

Locate the image we want to use, and return the FOG object which represents it :returns: A dict describing the image

schedule_deploy_task(host_id)
Parameters:host_id – The id of the host to deploy
Returns:The id of the scheduled task
set_image(host_id)

Tell FOG to use the proper image on the next deploy :param host_id: The id of the host to deploy

timestamp_format = '%Y-%m-%d %H:%M:%S'
wait_for_deploy_task(task_id)

Wait until the specified task is no longer active (i.e., it has completed)

teuthology.provision.fog.enabled(warn=False)

Check for required FOG settings

Parameters:warn – Whether or not to log a message containing unset parameters
Returns:True if they are present; False if they are not
teuthology.provision.fog.get_types()

Fetch and parse config.fog[‘machine_types’]

Returns:The list of FOG-configured machine types. An empty list if FOG is not configured.

teuthology.provision.openstack module

class teuthology.provision.openstack.ProvisionOpenStack

Bases: teuthology.openstack.OpenStack

A class that provides methods for creating and destroying virtual machine instances using OpenStack

attach_volumes(server_name, volumes)

Create and attach volumes to the named OpenStack instance. If attachment is failed, make another try.

create(num, os_type, os_version, arch, resources_hint)

Create num OpenStack instances running os_type os_version and return their names. Each instance has at least the resources described in resources_hint.

destroy(name_or_id)
init_user_data(os_type, os_version)

Get the user-data file that is fit for os_type and os_version. It is responsible for setting up enough for ansible to take over.

static ip2name(prefix, ip)

return the instance name suffixed with the IP address.

Module contents

teuthology.provision.create_if_vm(ctx, machine_name, _downburst=None)

Use downburst to create a virtual machine

Parameters:_downburst – Only used for unit testing.
teuthology.provision.destroy_if_vm(ctx, machine_name, user=None, description=None, _downburst=None)

Use downburst to destroy a virtual machine

Return False only on vm downburst failures.

Parameters:_downburst – Only used for unit testing.
teuthology.provision.reimage(ctx, machine_name)