api Package

certificate Module

class kolla_cli.api.certificate.CertificateApi

Bases: object

static certificate_init(verbose_level=1)

Certificate Init.

Creates a self-signed certificate for secure TLS communication.

Parameters

verbose_level (integer) – the higher the number, the more verbose

Returns

Job object

Return type

Job

client Module

class kolla_cli.api.client.ClientApi

Bases: kolla_cli.api.certificate.CertificateApi, kolla_cli.api.config.ConfigApi, kolla_cli.api.control_plane.ControlPlaneApi, kolla_cli.api.group.GroupApi, kolla_cli.api.host.HostApi, kolla_cli.api.password.PasswordApi, kolla_cli.api.properties.PropertyApi, kolla_cli.api.service.ServiceApi, kolla_cli.api.support.SupportApi

Client API Notes

Objects returned by the API contain a local copy of the information in the datastore. While changes made to the local copy will be reflected in the local object, changes made to the datastore from other objects will not be reflected in this local copy. The object will need to be re-fetched from the datastore to reflect the updates.

static enable_console_logging(level, enable=True)

enable/disable console logging for the api

enable: True/False level: logging.INFO, logging.DEBUG, logging.WARNING, logging.CRITICAL…

static get_version()

config Module

class kolla_cli.api.config.ConfigApi

Bases: object

config_import_inventory(file_path)

Config Import Inventory

Import groups and child associations from the provided inventory file. This currently does not import hosts, group vars, or host vars that may also exist in the inventory file.

Parameters

file_path (string) – path to inventory file to import

static config_reset()

Config Reset.

Resets the kolla-ansible configuration to its release defaults.

control_plane Module

class kolla_cli.api.control_plane.ControlPlaneApi

Bases: object

static check(verbose_level=1, hostnames=[], servicenames=[])

Do post-deployment smoke tests.

Parameters
  • hostnames (list) – host names

  • verbose_level (integer) – the higher the number, the more verbose

  • servicenames (list of strings) – services to check. If empty, then check all.

Returns

Job object

Return type

Job

static deploy(hostnames=[], serial_flag=False, verbose_level=1, servicenames=[])

Deploy.

Deploy and start all kolla containers.

Parameters
  • hostnames (list of strings) – hosts to deploy to. If empty, then deploy to all.

  • serial_flag (boolean) – if true, deploy will be done one host at a time

  • verbose_level (integer) – the higher the number, the more verbose

  • servicenames (list of strings) – services to deploy. If empty, then deploy all.

Returns

Job object

Return type

Job

static genconfig(verbose_level=1, hostnames=[], servicenames=[])

Genconfig.

Generate configuration files for enabled OpenStack services.

Parameters
  • verbose_level (integer) – the higher the number, the more verbose

  • servicenames (list of strings) – services to generate. If empty, then generate all.

Returns

Job object

Return type

Job

Upgrade containers to new version specified by the property “openstack_release.”

static get_deploy_mode()

Get deploy mode from either local or remote.

Local indicates that the openstack deployment will be to the local host. Remote means that the deployment is executed via ssh.

NOTE: local mode is not supported and should never be used in production environments.

static postdeploy(verbose_level=1)

Post-Deploy.

Do post deploy on deploy node.

Parameters

verbose_level (integer) – the higher the number, the more verbose

Returns

Job object

Return type

Job

static prechecks(verbose_level=1, hostnames=[], servicenames=[])

Check pre-deployment configuration of hosts.

Check if host is ready for a new deployment. This will fail if any of the hosts are not configured correctly or if they have already been deployed to. :param hostnames: host names :type hostnames: list :param verbose_level: the higher the number, the more verbose :type verbose_level: integer :param servicenames: services to prechecks. :type servicenames: list of strings :return: Job object :rtype: Job

static pull(verbose_level=1, hostnames=[], servicenames=[])

Pull.

Pull all images for containers (only pulls, no running container).

Parameters
  • verbose_level (integer) – the higher the number, the more verbose

  • hostnames (list of strings) – hosts to pull to. If empty, then pull to all.

  • servicenames – services to pull. If empty, then pull all.

Returns

Job object

Return type

Job

static reconfigure(verbose_level=1, hostnames=[], servicenames=[])

Reconfigure.

Reconfigure OpenStack service.

Parameters
  • hostnames (list) – host names

  • verbose_level (integer) – the higher the number, the more verbose

  • servicenames (list of strings) – services to prechecks.

Returns

Job object

Return type

Job

static set_deploy_mode(remote_mode)

Set deploy mode to either local or remote.

Local indicates that the openstack deployment will be to the local host. Remote means that the deployment is executed via ssh.

NOTE: local mode is not supported and should never be used in production environments.

Parameters

remote_mode (bool) – if remote mode is True deployment is done via ssh

static stop(verbose_level=1, hostnames=[], servicenames=[])

Stop Hosts.

Stops all kolla related docker containers on the specified hosts.

Parameters
  • hostnames (list) – host names

  • verbose_level (integer) – the higher the number, the more verbose

  • servicenames (list of strings) – services to stop. If empty, then stop all.

Returns

Job object

Return type

Job

static upgrade(verbose_level=1, hostnames=[], servicenames=[])

Upgrade.

Upgrades existing OpenStack Environment.

Parameters
  • verbose_level (integer) – the higher the number, the more verbose

  • hostnames (list of strings.) – hostnames to upgrade.

  • servicenames (list of strings) – services to upgrade. If empty, then upgrade all.

Returns

Job object

Return type

Job

Upgrade containers to new version specified by the property “openstack_release.”

exceptions Module

Exception definitions.

exception kolla_cli.api.exceptions.ClientException(message, *args)

Bases: Exception

KollaClient Base Class Exception

exception kolla_cli.api.exceptions.FailedOperation(message, *args)

Bases: kolla_cli.api.exceptions.ClientException

exception kolla_cli.api.exceptions.HostError(message, *args)

Bases: kolla_cli.api.exceptions.ClientException

exception kolla_cli.api.exceptions.HostsSshCheckError(hostnames, *args)

Bases: kolla_cli.api.exceptions.ClientException

Host failed its ssh check

exception kolla_cli.api.exceptions.InvalidArgument(message, *args)

Bases: kolla_cli.api.exceptions.ClientException

Invalid argument

exception kolla_cli.api.exceptions.InvalidConfiguration(message, *args)

Bases: kolla_cli.api.exceptions.ClientException

Invalid configuration

exception kolla_cli.api.exceptions.MissingArgument(argname, *args)

Bases: kolla_cli.api.exceptions.ClientException

Missing argument

exception kolla_cli.api.exceptions.NotInInventory(obj_type, obj_names, *args)

Bases: kolla_cli.api.exceptions.ClientException

Not in inventory exception

group Module

class kolla_cli.api.group.Group(groupname, servicenames, hostnames)

Bases: object

add_host(hostname)

Add host to group

Parameters

hostname (string) – name of the host to add to the group

add_service(servicename)

Add service to group

Parameters

servicename (string) – name of the service to add to the group

get_hosts()

Get names of hosts associated with this group.

Returns

host names

Return type

list of strings

get_name()

Get name

Returns

group name

Return type

string

get_services()

Get names of services associated with this group.

Returns

service names

Return type

list of strings

remove_host(hostname)

Remove host from group

Parameters

hostname (string) – name of the host to remove from the group

remove_service(servicename)

Remove service from group

Parameters

servicename (string) – name of the service to remove from the group

class kolla_cli.api.group.GroupApi

Bases: object

group_add(groupnames)

Add groups to the inventory

Parameters

groupnames (list of strings) – names of the groups to add to the inventory

group_get(groupnames)

Get selected groups in the inventory

Parameters

groupnames (list of strings) – names of groups to be read

Returns

groups

Return type

list of Group objects

group_get_all()

Get all groups in the inventory

Returns

groups

Return type

list of Group objects

group_remove(groupnames)

Remove groups from the inventory

Parameters

groupnames (list of strings) – names of the groups to remove from the inventory

host Module

class kolla_cli.api.host.Host(hostname, groupnames=[])

Bases: object

get_groups()

Get names of the groups associated with this host

Returns

group names

Return type

list of strings

Note: If the groups associated with this host change after this host is fetched, the host must be re-fetched to reflect those changes.

get_name()

Get name

Returns

host name

Return type

string

class kolla_cli.api.host.HostApi

Bases: object

static host_add(hostnames)

Add hosts to the inventory

Parameters

hostnames – list of strings

static host_destroy(hostnames, destroy_type, verbose_level=1, include_data=False, remove_images=False)

Destroy Hosts.

Stops and removes all kolla related docker containers on the specified hosts.

Parameters
  • hostnames (list) – host names

  • destroy_type (string) – either ‘kill’ or ‘stop’

  • verbose_level (integer) – the higher the number, the more verbose

  • include_data (boolean) – if true, destroy data containers too.

  • remove_images (boolean) – if true, destroy will remove the docker images

Returns

Job object

Return type

Job

static host_get(hostnames)

Get selected hosts in the inventory

Parameters

hostnames – list of strings

Returns

hosts

Return type

list of Host objects

static host_get_all()

Get all hosts in the inventory

Returns

Hosts

Return type

list of Host objects

static host_remove(hostnames)

Remove hosts from the inventory

Parameters

hostnames – list of strings

static host_setup(hosts_info)

Setup multiple hosts for ssh access

hosts_info is a dictionary of form:
  • {hostname’: { ‘password’: password ‘uname’: user_name}, … }

The uname entry is optional.

Parameters

hosts_info – dictionary

static host_ssh_check(hostnames)

Check hosts for ssh connectivity

Check status is a dictionary of form:
  • {hostname: { ‘success’:<True|False>, ‘msg’:message_string}, … }

Parameters

hostnames – list of strings

Returns

check status

Return type

dictionary

job Module

class kolla_cli.api.job.Job(ansible_job)

Bases: object

get_console_output()

Get the console output from the job

Returns

console output useful for debugging failed jobs.

Return type

string

get_error_message()

Get error message

Returns

if job failed, this will return the error message.

Return type

string

get_status()

Get status of job

Returns

None: job is still running 0: job succeeded 1: job failed 2: job killed by user

Return type

int or None

kill()

kill the job

wait()

Wait for job to complete

Returns

0 if job succeeded, 1 if job failed

Return type

int

password Module

class kolla_cli.api.password.PasswordApi

Bases: object

password_clear(name)

Clear password

Parameters

name (string) – name of the password

password_get_names()

Get password names

Returns

password names

Return type

list of strings

password_init()

Init empty passwords

Init empty passwords and ssh keys in /etc/kolla/passwords.yml to auto-generated values

password_set(name, value)

Set password

Parameters
  • name (string) – name of the password

  • value (string) – value of the password

password_set_sshkey(name, private_key, public_key)

Set password to an ssh key

Parameters
  • name (string) – name of the password

  • private_key – ssh private key

  • public_key – ssh public key

properties Module

class kolla_cli.api.properties.Property(ansible_property, override_flags)

Bases: object

Members:
  • name (str): key

  • value (Any): value

  • file_name (str): name of file property is from

  • overrides (bool): does the property override some other value

  • orig_value (str): the value which is overridden or None

  • target (str): group or host name for group or host properties

  • prop_type (str): one of ‘global’, ‘group’ or ‘host’

  • ovr_global (bool): true if property is overridden at global level

  • ovr_group (bool): true if property is overridden at group level

  • ovr_host (bool): true if property is overridden at host level

  • value_type (type): the python type of the value

class kolla_cli.api.properties.PropertyApi

Bases: object

property_clear(property_list, property_type='global', change_set=None)

Clear a property

Parameters
  • property_list (list) – property list

  • property_type (string) – one of ‘global’, ‘group’ or ‘host’

  • change_set (list of strings) – for group or host clears this is the list of groups or hosts to clear the property for

property_get(property_type='global', get_set=None)

Returns a list of Property objects

Parameters
  • property_type (string) – one of ‘global’, ‘group’, or ‘host’

  • get_set (list of strings) – optional list of hosts or groups to be used when getting group or host related property lists

Returns

properties

Return type

list of Property objects

property_set(property_dict, property_type='global', change_set=None)

Set a property

Parameters
  • property_dict (dictionary) – property dictionary containing key / values

  • property_type (string) – one of ‘global’, ‘group’ or ‘host’

  • change_set (list of strings) – for group or host sets this is the list of groups or hosts to set the property for

service Module

class kolla_cli.api.service.Service(servicename, parentnames=[], childnames=[], groupnames=[])

Bases: object

A service is one of the services available in openstack-kolla-ansible.

For example, this would be how the murano services would be represented:

  • murano
    • parentnames: []

    • childnames: [murano-api, murano-engine]

  • murano-api
    • parentnames: [murano]

    • childnames: []

  • murano-engine
    • parentnames: [murano]

    • childnames: []

get_children()

Get names of the child services

Returns

child names

Return type

list of strings

get_groups()

Get names of the groups

Returns

group names

Return type

list of strings

Note: If the groups associated with this service change after this service is fetched, the service must be re-fetched to reflect those changes.

get_name()

Get name

Returns

service name

Return type

string

get_parents()

Get name of parent services

Returns

parent service names

Return type

string

class kolla_cli.api.service.ServiceApi

Bases: object

service_get(servicenames)

Get selected services in the inventory

Parameters

servicenames (list of strings) – names of services to be read

Returns

services

Return type

list of Service objects

service_get_all()

Get all services in the inventory

Returns

services

Return type

List of Service objects

support Module

class kolla_cli.api.support.SupportApi

Bases: object

support_dump(dirpath)

Dumps configuration data for debugging.

Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / development to help with debugging problems.

Parameters

dirpath (string) – path to directory where dump will be placed

Returns

path to dump file

Return type

string

support_get_logs(servicenames, hostname, dirpath)

get container logs

Fetch the container log files of services from the specified hosts. The log files will be placed in the named directory. All the containers for the host will be placed in a directory named hostname. The file names for each log will be servicename_id.log.

Parameters
  • servicenames (list of strings) – names of services (ie nova, glance, etc)

  • hostname (string) – name of host to look for logs on

  • dirpath (string) – path of directory where log files will be written