Openstacksdk
Openstacksdk
Openstacksdk
Release 0.52.1.dev3
OpenStack Foundation
1 Installation 3
1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 For Users 5
2.1 Getting started with the OpenStack SDK . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Presentations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
4 openstacksdk 569
5 openstack 571
7 openstack.config 575
8 Links 577
8.1 General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Index 583
i
ii
OpenStackSDK Documentation, Release 0.52.1.dev3
CONTENTS 1
OpenStackSDK Documentation, Release 0.52.1.dev3
2 CONTENTS
CHAPTER
ONE
INSTALLATION
1.1 Installation
$ mkvirtualenv openstacksdk
$ pip install openstacksdk
3
OpenStackSDK Documentation, Release 0.52.1.dev3
4 Chapter 1. Installation
CHAPTER
TWO
FOR USERS
For a listing of terms used throughout the SDK, including the names of projects and services supported
by it, see the glossary.
2.1.1 Installation
The OpenStack SDK is available on PyPI under the name openstacksdk. To install it, use pip:
To check the installed version you can call the module with
These guides walk you through how to make use of the libraries we provide to work with each OpenStack
service. If youre looking for a cookbook approach, this is where youll want to begin.
Using os-client-config
Environment Variables
openstacksdk honors all of the normal OS_* variables. It does not provide backwards compatibility to
service-specific variables such as NOVA_USERNAME.
If you have OpenStack environment variables set, openstacksdk will produce a cloud config object
named envvars containing your values from the environment. If you dont like the name envvars, thats
ok, you can override it by setting OS_CLOUD_NAME.
Service specific settings, like the nova service type, are set with the default service type as a prefix. For
instance, to set a special service_type for trove set
5
OpenStackSDK Documentation, Release 0.52.1.dev3
export OS_DATABASE_SERVICE_TYPE=rax:database
Config Files
openstacksdk will look for a file called clouds.yaml in the following locations:
• Current Directory
• ~/.config/openstack
• /etc/openstack
The first file found wins.
You can also set the environment variable OS_CLIENT_CONFIG_FILE to an absolute path of a file to
look for and that location will be inserted at the front of the file search list.
The keys are all of the keys youd expect from OS_* - except lower case and without the OS prefix. So,
region name is set with region_name.
Service specific settings, like the nova service type, are set with the default service type as a prefix. For
instance, to set a special service_type for trove (because youre using Rackspace) set:
database_service_type: 'rax:database'
In addition to ~/.config/openstack and /etc/openstack - some platforms have other locations they like to
put things. openstacksdk will also look in an OS specific config dir
• USER_CONFIG_DIR
• SITE_CONFIG_DIR
USER_CONFIG_DIR is different on Linux, OSX and Windows.
• Linux: ~/.config/openstack
• OSX: ~/Library/Application Support/openstack
• Windows: C:\Users\USERNAME\AppData\Local\OpenStack\openstack
SITE_CONFIG_DIR is different on Linux, OSX and Windows.
• Linux: /etc/openstack
• OSX: /Library/Application Support/openstack
• Windows: C:\ProgramData\OpenStack\openstack
An example config file is probably helpful:
clouds:
mtvexx:
profile: https://vexxhost.com
auth:
username: [email protected]
(continues on next page)
You may note a few things. First, since auth_url settings are silly and embarrassingly ugly, known cloud
vendor profile information is included and may be referenced by name or by base URL to the cloud in
question if the cloud serves a vendor profile. One of the benefits of that is that auth_url isnt the only
thing the vendor defaults contain. For instance, since Rackspace lists rax:database as the service type
for trove, openstacksdk knows that so that you dont have to. In case the cloud vendor profile is not
available, you can provide one called clouds-public.yaml, following the same location rules previously
mentioned for the config files.
regions can be a list of regions. When you call get_all_clouds, youll get a cloud config object for each
cloud/region combo.
As seen with dns_service_type, any setting that makes sense to be per-service, like service_type or
endpoint or api_version can be set by prefixing the setting with the default service type. That might
strike you funny when setting service_type and it does me too - but thats just the world we live in.
Auth Settings
Keystone has auth plugins - which means its not possible to know ahead of time which auth settings
are needed. openstacksdk sets the default plugin type to password, which is what things all were before
plugins came about. In order to facilitate validation of values, all of the parameters that exist as a result
of a chosen plugin need to go into the auth dict. For password auth, this includes auth_url, username
and password as well as anything related to domains, projects and trusts.
Splitting Secrets
In some scenarios, such as configuration management controlled environments, it might be easier to have
secrets in one file and non-secrets in another. This is fully supported via an optional file secure.yaml
which follows all the same location rules as clouds.yaml. It can contain anything you put in clouds.yaml
and will take precedence over anything in the clouds.yaml file.
# clouds.yaml
clouds:
internap:
profile: internap
auth:
username: api-55f9a00fb2619
project_name: inap-17037
regions:
- ams01
- nyj01
# secure.yaml
clouds:
internap:
auth:
password: XXXXXXXXXXXXXXXXX
SSL Settings
When the access to a cloud is done via a secure connection, openstacksdk will always verify the SSL
cert by default. This can be disabled by setting verify to False. In case the cert is signed by an unknown
CA, a specific cacert can be provided via cacert. WARNING: verify will always have precedence over
cacert, so when setting a CA cert but disabling verify, the cloud cert will never be validated.
Client certs are also configurable. cert will be the client cert file location. In case the cert key is not
included within the client cert file, its file location needs to be set via key.
# clouds.yaml
clouds:
regular-secure-cloud:
auth:
auth_url: https://signed.cert.domain:5000
...
unknown-ca-with-client-cert-secure-cloud:
auth:
auth_url: https://unknown.ca.but.secure.domain:5000
...
key: /home/myhome/client-cert.key
cert: /home/myhome/client-cert.crt
cacert: /home/myhome/ca.crt
self-signed-insecure-cloud:
auth:
auth_url: https://self.signed.cert.domain:5000
...
verify: False
Note for parity with openstack command-line options the insecure boolean is also recognised (with
the opposite semantics to verify; i.e. True ignores certificate failures). This should be considered depre-
cated for verify.
Cache Settings
Accessing a cloud is often expensive, so its quite common to want to do some client-side caching of those
operations. To facilitate that, openstacksdk understands passing through cache settings to dogpile.cache,
with the following behaviors:
• Listing no config settings means you get a null cache.
• cache.expiration_time and nothing else gets you memory cache.
• Otherwise, cache.class and cache.arguments are passed in
Different cloud behaviors are also differently expensive to deal with. If you want to get really crazy
and tweak stuff, you can specify different expiration times on a per-resource basis by passing values, in
seconds to an expiration mapping keyed on the singular name of the resource. A value of -1 indicates
that the resource should never expire.
openstacksdk does not actually cache anything itself, but it collects and presents the cache information
so that your various applications that are connecting to OpenStack can share a cache should you desire.
cache:
class: dogpile.cache.pylibmc
expiration_time: 3600
arguments:
url:
- 127.0.0.1
expiration:
server: 5
flavor: -1
clouds:
mtvexx:
profile: vexxhost
auth:
username: [email protected]
password: XXXXXXXXX
project_name: [email protected]
region_name: ca-ymq-1
dns_api_version: 1
IPv6
IPv6 is the future, and you should always use it if your cloud supports it and if your local network
supports it. Both of those are easily detectable and all friendly software should do the right thing.
However, sometimes a cloud API may return IPv6 information that is not useful to a production de-
ployment. For example, the API may provide an IPv6 address for a server, but not provide that to the
host instance via metadata (configdrive) or standard IPv6 autoconfiguration methods (i.e. the host either
needs to make a bespoke API call, or otherwise statically configure itself).
For such situations, you can set the force_ipv4, or OS_FORCE_IPV4 boolean environment variable.
For example:
clouds:
mtvexx:
profile: vexxhost
(continues on next page)
The above snippet will tell client programs to prefer the IPv4 address and leave the public_v6 field
of the Server object blank for the fooprovider cloud . You can also set this with a client flag for all
clouds:
client:
force_ipv4: true
Per-region settings
Sometimes you have a cloud provider that has config that is common to the cloud, but also with some
things you might want to express on a per-region basis. For instance, Internap provides a public and
private network specific to the user in each region, and putting the values of those networks into config
can make consuming programs more efficient.
To support this, the region list can actually be a list of dicts, and any setting that can be set at the cloud
level can be overridden for that region.
clouds:
internap:
profile: internap
auth:
password: XXXXXXXXXXXXXXXXX
username: api-55f9a00fb2619
project_name: inap-17037
regions:
- name: ams01
values:
networks:
- name: inap-17037-WAN1654
routes_externally: true
- name: inap-17037-LAN6745
- name: nyj01
values:
networks:
- name: inap-17037-WAN1654
routes_externally: true
- name: inap-17037-LAN6745
Usage
python -m openstack.config.loader
Which will print out whatever if finds for your config. If you want to use it from python, which is much
more likely what you want to do, things like:
Get a named cloud.
import openstack.config
cloud_region = openstack.config.OpenStackConfig().get_one(
'internap', region_name='ams01')
print(cloud_region.name, cloud_region.region, cloud_region.config)
import openstack.config
cloud_regions = openstack.config.OpenStackConfig().get_all()
for cloud_region in cloud_regions:
print(cloud_region.name, cloud_region.region, cloud_region.config)
argparse
If youre using openstack.config from a program that wants to process command line options, there is a
registration function to register the arguments that both openstack.config and keystoneauth know how to
deal with - as well as a consumption argument.
import argparse
import openstack
parser = argparse.ArgumentParser()
cloud = openstack.connect(options=parser)
Vendor Support
OpenStack presents deployers with many options, some of which can expose differences to end users.
os-client-config tries its best to collect information about various things a user would need to know. The
following is a text representation of the vendor related defaults os-client-config knows about.
Default Values
AURO
https://api.auro.io:5000/v2.0
Betacloud
https://api-1.betacloud.de:5000
Catalyst
https://api.cloud.catalyst.net.nz:5000/v2.0
City Cloud
https://%(region_name)s.citycloud.com:5000/v3/
ConoHa
https://identity.%(region_name)s.conoha.io
DreamCompute
https://iad2.dream.io:5000
https://iam.%(region_name)s.otc.t-systems.com/v3
ELASTX
https://ops.elastx.cloud:5000/v3
https://api.entercloudsuite.com/v2.0
Fuga
https://identity.api.fuga.io:5000
Internap
https://identity.api.cloud.iweb.com/v2.0
Limestone Networks
https://auth.cloud.lstn.net:5000/v3
OVH
https://auth.cloud.ovh.net/v3
Rackspace
https://identity.api.rackspacecloud.com/v2.0/
auth:
username: myusername
api_key: myapikey
auth_type: rackspace_apikey
SWITCHengines
https://keystone.cloud.switch.ch:5000/v3
Ultimum
https://console.ultimum-cloud.com:5000/v2.0
UnitedStack
https://identity.api.ustack.com/v3
VEXXHOST
http://auth.vexxhost.net
Zetta
https://identity.api.zetta.io/v3
Network Config
There are several different qualities that networks in OpenStack might have that might not be able to
be automatically inferred from the available metadata. To help users navigate more complex setups,
os-client-config allows configuring a list of network metadata.
clouds:
amazing:
networks:
- name: blue
routes_externally: true
- name: purple
routes_externally: true
default_interface: true
- name: green
routes_externally: false
- name: yellow
routes_externally: false
nat_destination: true
- name: chartreuse
routes_externally: false
routes_ipv6_externally: true
- name: aubergine
routes_ipv4_externally: false
routes_ipv6_externally: true
Every entry must have a name field, which can hold either the name or the id of the network.
routes_externally is a boolean field that labels the network as handling north/south traffic off of the
cloud. In a public cloud this might be thought of as the public network, but in private clouds its possible
it might be an RFC1918 address. In either case, its provides IPs to servers that things not on the cloud
can use. This value defaults to false, which indicates only servers on the same network can talk to it.
routes_ipv4_externally and routes_ipv6_externally are boolean fields to help handle routes_externally
in the case where a network has a split stack with different values for IPv4 and IPv6. Either entry, if not
given, defaults to the value of routes_externally.
default_interface is a boolean field that indicates that the network is the one that programs should use.
It defaults to false. An example of needing to use this value is a cloud with two private networks, and
where a user is running ansible in one of the servers to talk to other servers on the private network.
Because both networks are private, there would otherwise be no way to determine which one should be
used for the traffic. There can only be one default_interface per cloud.
nat_destination is a boolean field that indicates which network floating ips should be attached to. It
defaults to false. Normally this can be inferred by looking for a network that has subnets that have a
gateway_ip. But its possible to have more than one network that satisfies that condition, so the user
might want to tell programs which one to pick. There can be only one nat_destination per cloud.
nat_source is a boolean field that indicates which network floating ips should be requested from. It
defaults to false. Normally this can be inferred by looking for a network that is attached to a router. But
its possible to have more than one network that satisfies that condition, so the user might want to tell
programs which one to pick. There can be only one nat_source per cloud.
API Reference
get_extra_config(key, defaults=None)
Fetch an arbitrary extra chunk of config, laying in defaults.
Parameters
• key (string) name of the config section to fetch
• defaults (dict) (optional) default values to merge under the found con-
fig
register_argparse_arguments(parser, argv, service_keys=None)
Register all of the common argparse options needed.
Given an argparse parser, register the keystoneauth Session arguments, the keystoneauth
Auth Plugin Options and os-cloud. Also, peek in the argv to see if all of the auth plugin
options should be registered or merely the ones already configured.
Parameters
• argparse.ArgumentParser parser to attach argparse options to
• argv the arguments provided to the application
• service_keys (string) Service or list of services this argparse should
be specialized for, if known. The first item in the list will be used as the
default value for service_type (optional)
:raises exceptions.ConfigException if an invalid auth-type is requested
auth_config_hook(config)
Allow examination of config values before loading auth plugin
OpenStackClient will override this to perform additional checks on auth_type.
option_prompt(config, p_opt)
Prompt user for option that requires a value
magic_fixes(config)
Perform the set of magic argument fixups
get_one(cloud=None, validate=True, argparse=None, **kwargs)
Retrieve a single CloudRegion and merge additional options
Parameters
• cloud (string) The name of the configuration to load from clouds.yaml
• validate (boolean) Validate the config. Setting this to False causes no
auth plugin to be created. Its really only useful for testing.
• argparse (Namespace) An argparse Namespace object; allows direct
passing in of argparse options to be added to the cloud config. Values of
None and will be removed.
• region_name Name of the region of the cloud.
• kwargs Additional configuration options
Returns openstack.config.cloud_region.CloudRegion
Raises keystoneauth1.exceptions.MissingRequiredOptions on missing required
auth parameters
get_one_cloud(cloud=None, validate=True, argparse=None, **kwargs)
Retrieve a single CloudRegion and merge additional options
Parameters
• cloud (string) The name of the configuration to load from clouds.yaml
• validate (boolean) Validate the config. Setting this to False causes no
auth plugin to be created. Its really only useful for testing.
• argparse (Namespace) An argparse Namespace object; allows direct
passing in of argparse options to be added to the cloud config. Values of
None and will be removed.
• region_name Name of the region of the cloud.
• kwargs Additional configuration options
Returns openstack.config.cloud_region.CloudRegion
Raises keystoneauth1.exceptions.MissingRequiredOptions on missing required
auth parameters
get_one_cloud_osc(cloud=None, validate=True, argparse=None, **kwargs)
Retrieve a single CloudRegion and merge additional options
Parameters
• cloud (string) The name of the configuration to load from clouds.yaml
• validate (boolean) Validate the config. Setting this to False causes no
auth plugin to be created. Its really only useful for testing.
• argparse (Namespace) An argparse Namespace object; allows direct
passing in of argparse options to be added to the cloud config. Values of
None and will be removed.
• region_name Name of the region of the cloud.
• kwargs Additional configuration options
Raises keystoneauth1.exceptions.MissingRequiredOptions on missing required
auth parameters
'block_storage_endpoint_override': 'http://...'
'interface': 'public'
property full_name
Return a string that can be used as an identifier.
Always returns a valid string. It will have name and region_name or just one of the two if
only one is set, or else unknown.
set_session_constructor(session_constructor)
Sets the Session constructor.
get_requests_verify_args()
Return the verify and cert values for the requests library.
get_services()
Return a list of service types we know something about.
get_endpoint_from_catalog(service_type, interface=None, region_name=None)
Return the endpoint for a given service as found in the catalog.
For values respecting endpoint overrides, see endpoint_for()
Parameters
• service_type Service Type of the endpoint to search for.
• interface Interface of the endpoint to search for. Optional, defaults to
the configured value for interface for this Connection.
• region_name Region Name of the endpoint to search for. Optional, de-
faults to the configured value for region_name for this Connection.
Returns The endpoint of the service, or None if not found.
get_auth()
Return a keystoneauth plugin from the auth credentials.
insert_user_agent()
Set sdk information into the user agent of the Session.
Normal consumers of SDK should use app_name and app_version. However, if someone
else writes a subclass of CloudRegion it may be desirable.
get_session()
Return a keystoneauth session based on the auth credentials.
get_service_catalog()
Helper method to grab the service catalog.
get_nat_destination()
Get network used for NAT destination.
get_nat_source()
Get network used for NAT source.
get_client_config(name=None, defaults=None)
Get config settings for a named client.
Settings will also be looked for in a section called client. If settings are found in both, they
will be merged with the settings from the named section winning over the settings from
client section, and both winning over provided defaults.
Parameters
• name (string) Name of the config section to look for.
• defaults (dict) Default settings to use.
Returns A dict containing merged settings from the named section, the client sec-
tion and the defaults.
Connect
In order to work with an OpenStack cloud you first need to create a Connection to it using your cre-
dentials. A Connection can be created in 3 ways, using the class itself, Config Files, or Environment
Variables. It is recommended to always use Config Files as the same config can be used across tools and
languages.
Create Connection
Next
Now that you can create a connection, continue with the User Guides to work with an OpenStack service.
In order to work with an OpenStack cloud you first need to create a Connection to it using your
credentials. A Connection can be created in 3 ways, using the class itself (see Connect), a file, or
environment variables as illustrated below. The SDK uses os-client-config to handle the configuration.
Default Location
To create a connection from a file you need a YAML file to contain the configuration.
clouds:
test_cloud:
region_name: RegionOne
auth:
auth_url: http://xxx.xxx.xxx.xxx:5000/v2.0/
username: demo
password: secrete
project_name: demo
rackspace:
cloud: rackspace
auth:
username: joe
password: joes-password
project_name: 123123
region_name: IAD
example:
image_name: fedora-20.x86_64
flavor_name: m1.small
network_name: private
class Opts:
def __init__(self, cloud_name='devstack-admin', debug=False):
self.cloud = cloud_name
self.debug = debug
# Use identity v3 API for examples.
self.identity_api_version = '3'
def create_connection_from_config():
return openstack.connect(cloud=TEST_CLOUD)
def create_connection_from_args():
parser = argparse.ArgumentParser()
return openstack.connect(options=parser)
To use a configuration file in a user defined location set the environment variable
OS_CLIENT_CONFIG_FILE to the absolute path of a file.:
export OS_CLIENT_CONFIG_FILE=/path/to/my/config/my-clouds.yaml
and call from_config() with the cloud_name of the cloud configuration to use, .
Next
Now that you can create a connection, continue with the User Guides for an OpenStack service.
Logging
Note: TODO(shade) This document is written from a shade POV. It needs to be combined with the
existing logging guide, but also the logging systems need to be rationalized.
openstacksdk uses Python Logging. As openstacksdk is a library, it does not configure logging handlers
automatically, expecting instead for that to be the purview of the consuming application.
Simple Usage
For consumers who just want to get a basic logging setup without thinking about it too deeply, there is a
helper method. If used, it should be called before any other openstacksdk functionality.
openstack.enable_logging(debug=False, http_debug=False, path=None,
stream=None, format_stream=False, for-
mat_template=’%(asctime)s %(levelname)s: %(name)s
%(message)s’, handlers=None)
Enable logging output.
Helper function to enable logging. This function is available for debugging purposes and for
folks doing simple applications who want an easy just make it work for me. For more complex
applications or for those who want more flexibility, the standard library logging package will
receive these messages in any handlers you create.
Parameters
• debug (bool) Set this to True to receive debug messages.
• http_debug (bool) Set this to True to receive debug messages including
HTTP requests and responses. This implies debug=True.
• path (str) If a path is specified, logging output will written to that file in
addition to sys.stderr. The path is passed to logging.FileHandler, which will
append messages the file (and create it if needed).
• stream One of None `` or ``sys.stdout or sys.stderr. If it is
None, nothing is logged to a stream. If it isnt None, console output is logged
to this stream.
• format_stream (bool) If format_stream is False, the default, apply
format_template to path but not to stream outputs. If True, apply
format_template to stream outputs as well.
• format_template (str) Template to pass to logging.Formatter.
Return type None
import openstack
openstack.enable_logging()
The stream parameter controls the stream where log message are written to. It defaults to sys.stdout
which will result in log messages being written to STDOUT. It can be set to another output stream, or to
None to disable logging to the console.
The path parameter sets up logging to log to a file. By default, if path is given and stream is not,
logging will only go to path.
You can combine the path and stream parameters to log to both places simultaneously.
To log messages to a file called openstack.log and the console on stdout:
import sys
import openstack
openstack.enable_logging(
debug=True, path='openstack.log', stream=sys.stdout)
openstack.enable_logging also sets up a few other loggers and squelches some warnings or log messages
that are otherwise uninteresting or unactionable by an openstacksdk user.
Advanced Usage
HTTP Tracing
HTTP Interactions are handled by keystoneauth. If you want to enable HTTP tracing while using open-
stacksdk and are not using openstack.enable_logging, set the log level of the keystoneauth logger
to DEBUG.
For more information see https://docs.openstack.org/keystoneauth/latest/using-sessions.html#logging
Python Logging
Python logging is a standard feature of Python and is documented fully in the Python Documentation,
which varies by version of Python.
For more information on Python Logging for Python v2, see https://docs.python.org/2/library/logging.
html.
For more information on Python Logging for Python v3, see https://docs.python.org/3/library/logging.
html.
Statistics reporting
openstacksdk offers possibility to report statistics on individual API requests/responses in different for-
mats. Statsd allows reporting of the response times in the statsd format. InfluxDB allows a more event-
oriented reporting of the same data. Prometheus reporting is a bit different and requires the application
using SDK to take care of the metrics exporting, while openstacksdk prepares the metrics.
Due to the nature of the statsd protocol lots of tools consuming the metrics do the data aggregation and
processing in the configurable time frame (mean value calculation for a 1 minute time frame). For the
case of periodic tasks this might not be very useful. A better fit for using openstacksdk as a library is an
event-recording, where duration of an individual request is stored and all required calculations are done
if necessary in the monitoring system based required timeframe, or the data is simply shown as is with
no analytics. A comparison article describes differences in those approaches.
Simple Usage
metrics:
statsd:
host: __statsd_server_host__
port: __statsd_server_port__
clouds:
..
In order to enable InfluxDB reporting following configuration need to be done in the clouds.yaml file
metrics:
influxdb:
host: __influxdb_server_host__
port: __influxdb_server_port__
use_udp: __True|False__
username: __influxdb_auth_username__
password: __influxdb_auth_password__
database: __influxdb_db_name__
measurement: __influxdb_measurement_name__
timeout: __infludb_requests_timeout__
clouds:
..
Metrics will be reported only when corresponding client libraries ( statsd for statsd reporting, influxdb
for influxdb reporting correspondingly). When those libraries are not available reporting will be silently
ignored.
InfluxDB reporting allows setting additional tags into the metrics based on the selected cloud.
clouds:
my_cloud:
profile: some_profile
...
additional_metric_tags:
environment: production
Microversions
As openstacksdk rolls out support for consuming microversions, it will do so on a call by call basis as
needed. Just like with major versions, openstacksdk should have logic to handle each microversion for
a given REST call it makes, with the following rules in mind:
• If an activity openstack performs can be done differently or more efficiently with a new microver-
sion, the support should be added to openstack.cloud and to the appropriate Proxy class.
• openstacksdk should always attempt to use the latest microversion it is aware of for a given call,
unless a microversion removes important data.
• Microversion selection should under no circumstances be exposed to the user in python API calls
in the Resource layer or the openstack.cloud layer.
• Microversion selection is exposed to the user in the REST layer via the microversion argu-
ment to each REST call.
• A user of the REST layer may set the default microversion by set-
ting {service_type}_default_microversion in clouds.yaml or
OS_{service_type|upper}_DEFAULT_MICROVERSION environment variable.
Note: Setting the default microversion in any circumstance other than when using the REST layer is
highly discouraged. Both of the higher layers in openstacksdk provide data normalization as well as
logic about which REST call to make. Setting the default microversion could change the behavior of the
service in question in such a way that openstacksdk does not understand. If there is a feature of a service
that needs a microversion and it is not already transparently exposed in openstacksdk, please file a bug.
• If a feature is only exposed for a given microversion and cannot be simulated for older clouds
without that microversion, it is ok to add it, but a clear error message should be given to the user
that the given feature is not available on their cloud. (A message such as This cloud supports
a maximum microversion of XXX for service YYY and this feature only exists on clouds with
microversion ZZZ. Please contact your cloud provider for information about when this feature
might be available)
• When adding a feature that only exists behind a new microversion, every effort should be made to
figure out how to provide the same functionality if at all possible, even if doing so is inefficient.
If an inefficient workaround is employed, a warning should be provided to the user. (the users
workaround to skip the inefficient behavior would be to stop using that openstacksdk API call)
An example of this is the nova get me a network feature. The logic of get me a network can be
done client-side, albeit less efficiently. Adding support for the get me a network feature via nova
microversion should also add support for doing the client-side workaround.
• If openstacksdk is aware of logic for more than one microversion, it should always attempt to use
the latest version available for the service for that call.
• Objects returned from openstacksdk should always go through normalization and thus should
always conform to openstacksdks documented data model. The objects should never look different
to the user regardless of the microversion used for the REST call.
• If a microversion adds new fields to an object, those fields should be added to openstacksdks data
model contract for that object and the data should either be filled in by performing additional
REST calls if the data is available that way, or the field should have a default value of None which
the user can be expected to test for when attempting to use the new value.
• If a microversion removes fields from an object that are part of the existing data model contract,
care should be taken to not use the new microversion for that call unless forced to by lack of
availablity of the old microversion on the cloud in question. In the case where an old microversion
is no longer available, care must be taken to either find the data from another source and fill it in,
or to put a value of None into the field and document for the user that on some clouds the value
may not exist.
• If a microversion removes a field and the outcome is particularly intractable and impossible to
work around without fundamentally breaking users, an issue should be raised with the service
team in question. Hopefully a resolution can be found during the period while clouds still have
the old microversion.
• As new calls or objects are added, it is important to check in with the service team in question on
the expected stability of the object. If there are known changes expected in the future, even if they
may be a few years off, openstacksdk should take care to not add committments to its data model
for those fields/features. It is ok for openstacksdk to not have something.
Note: openstacksdk does not currently have any sort of experimental opt-in API that would allow
exposing things to a user that may not be supportable under the normal compatibility contract. If
a conflict arises in the future where there is a strong desire for a feature but also a lack of certainty
about its stability over time, an experimental API may want to be explored but concrete use cases
should arise before such a thing is started.
Before working with the Bare Metal service, youll need to create a connection to your OpenStack cloud
by following the Connect user guide. This will provide you with the conn variable used in the examples
below.
Table of Contents
• CRUD operations
– List Nodes
• Provisioning operations
– Manage and inspect Node
– Provide Node
CRUD operations
List Nodes
def list_nodes(conn):
print("List Nodes:")
Provisioning operations
Provisioning actions are the main way to manipulate the nodes. See Bare Metal service states documen-
tation for details.
Managing a node in the enroll provision state validates the management (IPMI, Redfish, etc) creden-
tials and moves the node to the manageable state. Managing a node in the available state moves
it to the manageable state. In this state additional actions, such as configuring RAID or inspecting,
are available.
Inspecting a node detects its properties by either talking to its BMC or by booting a special ramdisk.
Provide Node
Providing a node in the manageable provision state makes it available for deployment.
Before working with the Block Storage service, youll need to create a connection to your OpenStack
cloud by following the Connect user guide. This will provide you with the conn variable used in the
examples below.
Before working with the Clustering service, youll need to create a connection to your OpenStack cloud
by following the Connect user guide. This will provide you with the conn variable used by all examples
in this guide.
The primary abstractions/resources of the Clustering service are:
A profile is a template used to create and manage nodes, i.e. objects exposed by other OpenStack
services. A profile encodes the information needed for node creation in a property named spec.
def list_profile_types(conn):
print("List Profile Types:")
for pt in conn.clustering.profile_types():
print(pt.to_dict())
To get the details about a profile type, you need to provide the name of it.
def get_profile_type(conn):
print("Get Profile Type:")
pt = conn.clustering.get_profile_type('os.nova.server-1.0')
print(pt.to_dict())
Managing Profiles
A profile type can be treated as the meta-type of a Profile object. A registry of profile types is built
when the Cluster service starts. When creating a Profile object, you will indicate the profile type used in
its spec property.
List Profiles
def list_profiles(conn):
print("List Profiles:")
When listing profiles, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage profile
Create Profile
When creating a profile, you will provide a dictionary with keys and values specified according to the
profile type referenced.
def create_profile(conn):
print("Create Profile:")
spec = {
'profile': 'os.nova.server',
'version': 1.0,
'name': 'os_server',
'properties': {
'name': SERVER_NAME,
'flavor': FLAVOR_NAME,
'image': IMAGE_NAME,
'networks': {
'network': NETWORK_NAME
}
}
}
profile = conn.clustering.create_profile(spec)
print(profile.to_dict())
Optionally, you can specify a metadata keyword argument that contains some key-value pairs to be
associated with the profile.
Full example: manage profile
Find Profile
def find_profile(conn):
print("Find Profile:")
profile = conn.clustering.find_profile('os_server')
print(profile.to_dict())
The Cluster service doesnt allow updating the spec of a profile. The only way to achieve that is to
create a new profile.
Full example: manage profile
Get Profile
def get_profile(conn):
print("Get Profile:")
profile = conn.clustering.get_profile('os_server')
print(profile.to_dict())
Update Profile
After a profile is created, most of its properties are immutable. Still, you can update a profiles name
and/or metadata.
def update_profile(conn):
print("Update Profile:")
The Cluster service doesnt allow updating the spec of a profile. The only way to achieve that is to
create a new profile.
Full example: manage profile
Delete Profile
A profile can be deleted after creation, provided that it is not referenced by any active clusters or nodes.
If you attempt to delete a profile that is still in use, you will get an error message.
def delete_profile(conn):
print("Delete Profile:")
conn.clustering.delete_profile('os_server')
print("Profile deleted.")
Managing Clusters
Clusters are first-class citizens in Senlin service design. A cluster is defined as a collection of homo-
geneous objects. The homogeneous here means that the objects managed (aka. Nodes) have to be
instantiated from the same profile type.
List Clusters
def list_cluster(conn):
print("List clusters:")
When listing clusters, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage cluster
Create Cluster
When creating a cluster, you will provide a dictionary with keys and values according to the cluster type
referenced.
def create_cluster(conn):
print("Create cluster:")
spec = {
"name": CLUSTER_NAME,
"profile_id": PROFILE_ID,
"min_size": 0,
"max_size": -1,
"desired_capacity": 1,
}
(continues on next page)
cluster = conn.clustering.create_cluster(**spec)
print(cluster.to_dict())
Optionally, you can specify a metadata keyword argument that contains some key-value pairs to be
associated with the cluster.
Full example: manage cluster
Get Cluster
def get_cluster(conn):
print("Get cluster:")
cluster = conn.clustering.get_cluster(CLUSTER_ID)
print(cluster.to_dict())
Find Cluster
def find_cluster(conn):
print("Find cluster:")
cluster = conn.clustering.find_cluster(CLUSTER_ID)
print(cluster.to_dict())
Update Cluster
After a cluster is created, most of its properties are immutable. Still, you can update a clusters name
and/or params.
def update_cluster(conn):
print("Update cluster:")
spec = {
"name": "Test_Cluster001",
"profile_id": "c0e3a680-e270-4eb8-9361-e5c9503fba0a",
"profile_only": True,
}
cluster = conn.clustering.update_cluster(CLUSTER_ID, **spec)
print(cluster.to_dict())
Delete Cluster
A cluster can be deleted after creation, When there are nodes in the cluster, the Senlin engine will launch
a process to delete all nodes from the cluster and destroy them before deleting the cluster object itself.
def delete_cluster(conn):
print("Delete cluster:")
conn.clustering.delete_cluster(CLUSTER_ID)
print("Cluster deleted.")
def add_nodes_to_cluster(conn):
print("Add nodes to cluster:")
node_ids = [NODE_ID]
res = conn.clustering.add_nodes_to_cluster(CLUSTER_ID, node_ids)
print(res)
def remove_nodes_from_cluster(conn):
print("Remove nodes from a cluster:")
node_ids = [NODE_ID]
res = conn.clustering.remove_nodes_from_cluster(CLUSTER_ID, node_ids)
print(res)
def replace_nodes_in_cluster(conn):
print("Replace the nodes in a cluster with specified nodes:")
old_node = NODE_ID
new_node = "cd803d4a-015d-4223-b15f-db29bad3146c"
spec = {
old_node: new_node
}
res = conn.clustering.replace_nodes_in_cluster(CLUSTER_ID, **spec)
print(res)
def scale_out_cluster(conn):
print("Inflate the size of a cluster:")
res = conn.clustering.scale_out_cluster(CLUSTER_ID, 1)
print(res)
Cluster Scale In
def scale_out_cluster(conn):
print("Inflate the size of a cluster:")
res = conn.clustering.scale_out_cluster(CLUSTER_ID, 1)
print(res)
Cluster Resize
Resize of cluster.
def resize_cluster(conn):
print("Resize of cluster:")
spec = {
'min_size': 1,
'max_size': 6,
'adjustment_type': 'EXACT_CAPACITY',
'number': 2
}
res = conn.clustering.resize_cluster(CLUSTER_ID, **spec)
print(res)
Once a policy is attached (bound) to a cluster, it will be enforced when related actions are performed on
that cluster, unless the policy is (temporarily) disabled on the cluster
def attach_policy_to_cluster(conn):
print("Attach policy to a cluster:")
Once a policy is attached to a cluster, it can be detached from the cluster at users request.
def detach_policy_from_cluster(conn):
print("Detach a policy from a cluster:")
Cluster Check
def check_cluster(conn):
print("Check cluster:")
res = conn.clustering.check_cluster(CLUSTER_ID)
print(res)
Cluster Recover
def recover_cluster(conn):
print("Recover cluster:")
Managing Nodes
Node is a logical object managed by the Senlin service. A node can be a member of at most one cluster
at any time. A node can be an orphan node which means it doesnt belong to any clusters.
List Nodes
def list_nodes(conn):
print("List Nodes:")
When listing nodes, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage node
Create Node
When creating a node, you will provide a dictionary with keys and values according to the node type
referenced.
def create_node(conn):
print("Create Node:")
spec = {
'name': NODE_NAME,
'profile_id': PROFILE_ID,
}
node = conn.clustering.create_node(**spec)
print(node.to_dict())
Optionally, you can specify a metadata keyword argument that contains some key-value pairs to be
associated with the node.
Full example: manage node
Get Node
def get_node(conn):
print("Get Node:")
node = conn.clustering.get_node(NODE_ID)
print(node.to_dict())
Find Node
def find_node(conn):
print("Find Node:")
node = conn.clustering.find_node(NODE_ID)
print(node.to_dict())
Update Node
After a node is created, most of its properties are immutable. Still, you can update a nodes name and/or
params.
def update_node(conn):
print("Update Node:")
spec = {
'name': 'Test_Node01',
'profile_id': 'c0e3a680-e270-4eb8-9361-e5c9503fba0b',
}
Delete Node
A node can be deleted after creation, provided that it is not referenced by any active clusters. If you
attempt to delete a node that is still in use, you will get an error message.
def delete_node(conn):
print("Delete Node:")
conn.clustering.delete_node(NODE_ID)
print("Node deleted.")
# node support force delete
conn.clustering.delete_node(NODE_ID, False, True)
print("Node deleted")
Check Node
If the underlying physical resource is not healthy, the node will be set to ERROR status.
def check_node(conn):
print("Check Node:")
node = conn.clustering.check_node(NODE_ID)
print(node)
Recover Node
def recover_node(conn):
print("Recover Node:")
A policy is a template that encodes the information needed for specifying the rules that are
checked/enforced before/after certain actions are performed on a cluster. The rules are encoded in a
property named spec.
def list_policy_types(conn):
print("List Policy Types:")
for pt in conn.clustering.policy_types():
print(pt.to_dict())
To retrieve the details about a policy type, you need to provide the name of it.
def get_policy_type(conn):
print("Get Policy Type:")
pt = conn.clustering.get_policy_type('senlin.policy.deletion-1.0')
print(pt.to_dict())
Managing Policies
A policy type can be treated as the meta-type of a Policy object. A registry of policy types is built when
the Cluster service starts. When creating a Policy object, you will indicate the policy type used in its
spec property.
List Policies
def list_policies(conn):
print("List Policies:")
When listing policies, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage policy
Create Policy
When creating a policy, you will provide a dictionary with keys and values according to the policy type
referenced.
def create_policy(conn):
print("Create Policy:")
attrs = {
'name': 'dp01',
'spec': {
'policy': 'senlin.policy.deletion',
'version': 1.0,
'properties': {
'criteria': 'oldest_first',
'destroy_after_deletion': True,
}
}
}
policy = conn.clustering.create_policy(attrs)
print(policy.to_dict())
Optionally, you can specify a metadata keyword argument that contains some key-value pairs to be
associated with the policy.
Full example: manage policy
Find Policy
def find_policy(conn):
print("Find Policy:")
policy = conn.clustering.find_policy('dp01')
print(policy.to_dict())
Get Policy
def get_policy(conn):
print("Get Policy:")
policy = conn.clustering.get_policy('dp01')
print(policy.to_dict())
Update Policy
After a policy is created, most of its properties are immutable. Still, you can update a policys name
and/or metadata.
def update_policy(conn):
print("Update Policy:")
The Cluster service doesnt allow updating the spec of a policy. The only way to achieve that is to
create a new policy.
Full example: manage policy
Delete Policy
A policy can be deleted after creation, provided that it is not referenced by any active clusters or nodes.
If you attempt to delete a policy that is still in use, you will get an error message.
def delete_policy(conn):
print("Delete Policy:")
conn.clustering.delete_policy('dp01')
print("Policy deleted.")
Managing Receivers
Receivers are the event sinks associated to senlin clusters. When certain events (or alarms) are seen by
a monitoring software, the software can notify the senlin clusters of those events (or alarms). When
senlin receives those notifications, it can automatically trigger some predefined operations with preset
parameter values.
List Receivers
def list_receivers(conn):
print("List Receivers:")
When listing receivers, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage receiver
Create Receiver
When creating a receiver, you will provide a dictionary with keys and values according to the receiver
type referenced.
def create_receiver(conn):
print("Create Receiver:")
receiver = conn.clustering.create_receiver(**spec)
print(receiver.to_dict())
Optionally, you can specify a metadata keyword argument that contains some key-value pairs to be
associated with the receiver.
Full example: manage receiver
Get Receiver
def get_receiver(conn):
print("Get Receiver:")
receiver = conn.clustering.get_receiver(FAKE_NAME)
print(receiver.to_dict())
Find Receiver
def find_receiver(conn):
print("Find Receiver:")
receiver = conn.clustering.find_receiver(FAKE_NAME)
print(receiver.to_dict())
Update Receiver
After a receiver is created, most of its properties are immutable. Still, you can update a receivers name
and/or params.
def update_receiver(conn):
print("Update Receiver:")
spec = {
"name": "test_receiver2",
"params": {
"count": "2"
}
}
receiver = conn.clustering.update_receiver(FAKE_NAME, **spec)
print(receiver.to_dict())
Delete Receiver
A receiver can be deleted after creation, provided that it is not referenced by any active clusters. If you
attempt to delete a receiver that is still in use, you will get an error message.
def delete_receiver(conn):
print("Delete Receiver:")
conn.clustering.delete_receiver(FAKE_NAME)
print("Receiver deleted.")
An action is an abstraction of some logic that can be executed by a worker thread. Most of the operations
supported by Senlin are executed asynchronously, which means they are queued into database and then
picked up by certain worker thread for execution.
List Actions
def list_actions(conn):
print("List Actions:")
When listing actions, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage action
Get Action
def get_action(conn):
print("Get Action:")
action = conn.clustering.get_action(ACTION_ID)
print(action.to_dict())
An event is a record generated during engine execution. Such an event captures what has happened
inside the senlin-engine. The senlin-engine service generates event records when it is performing some
actions or checking policies.
List Events
def list_events(conn):
print("List Events:")
When listing events, you can specify the sorting option using the sort parameter and you can do
pagination using the limit and marker parameters.
Full example: manage event
Get Event
def get_event(conn):
print("Get Event:")
event = conn.clustering.get_event(EVENT_ID)
print(event.to_dict())
Before working with the Compute service, youll need to create a connection to your OpenStack cloud
by following the Connect user guide. This will provide you with the conn variable used in the examples
below.
Table of Contents
• List Servers
• List Images
• List Flavors
• List Networks
• Create Key Pair
• Create Server
List Servers
A server is a virtual machine that provides access to a compute instance being run by your cloud
provider.
def list_servers(conn):
print("List Servers:")
List Images
An image is the operating system you want to use for your server.
def list_images(conn):
print("List Images:")
List Flavors
A flavor is the resource configuration for a server. Each flavor is a unique combination of disk, memory,
vCPUs, and network bandwidth.
def list_flavors(conn):
print("List Flavors:")
List Networks
def list_networks(conn):
print("List Networks:")
A key pair is the public key and private key of publickey cryptography. They are used to encrypt and
decrypt login information when connecting to your server.
def create_keypair(conn):
keypair = conn.compute.find_keypair(KEYPAIR_NAME)
if not keypair:
print("Create Key Pair:")
keypair = conn.compute.create_keypair(name=KEYPAIR_NAME)
print(keypair)
try:
os.mkdir(SSH_DIR)
except OSError as e:
if e.errno != errno.EEXIST:
raise e
os.chmod(PRIVATE_KEYPAIR_FILE, 0o400)
return keypair
Create Server
At minimum, a server requires a name, an image, a flavor, and a network on creation. You can discover
the names and IDs of these attributes by listing them as above and then using the find methods to get the
appropriate resources.
Ideally youll also create a server using a keypair so you can login to that server with the private key.
Servers take time to boot so we call wait_for_server to wait for it to become active.
def create_server(conn):
print("Create Server:")
image = conn.compute.find_image(IMAGE_NAME)
flavor = conn.compute.find_flavor(FLAVOR_NAME)
network = conn.network.find_network(NETWORK_NAME)
keypair = create_keypair(conn)
server = conn.compute.create_server(
name=SERVER_NAME, image_id=image.id, flavor_id=flavor.id,
networks=[{"uuid": network.id}], key_name=keypair.name)
server = conn.compute.wait_for_server(server)
Before working with the Database service, youll need to create a connection to your OpenStack cloud
by following the Connect user guide. This will provide you with the conn variable used in the examples
below.
Before working with the DNS service, youll need to create a connection to your OpenStack cloud by
following the Connect user guide. This will provide you with the conn variable used in the examples
below.
List Zones
def list_zones(conn):
print("List Zones:")
Before working with the Identity service, youll need to create a connection to your OpenStack cloud by
following the Connect user guide. This will provide you with the conn variable used in the examples
below.
The OpenStack Identity service is the default identity management system for OpenStack. The Identity
service authentication process confirms the identity of a user and an incoming request by validating a
set of credentials that the user supplies. Initially, these credentials are a user name and password or a
user name and API key. When the Identity service validates user credentials, it issues an authentication
token that the user provides in subsequent requests. An authentication token is an alpha-numeric text
string that enables access to OpenStack APIs and resources. A token may be revoked at any time and is
valid for a finite duration.
List Users
A user is a digital representation of a person, system, or service that uses OpenStack cloud services. The
Identity service validates that incoming requests are made by the user who claims to be making the call.
Users have a login and can access resources by using assigned tokens. Users can be directly assigned to
a particular project and behave as if they are contained in that project.
def list_users(conn):
print("List Users:")
List Credentials
Credentials are data that confirms the identity of the user. For example, user name and password, user
name and API key, or an authentication token that the Identity service provides.
def list_credentials(conn):
print("List Credentials:")
List Projects
def list_projects(conn):
print("List Projects:")
List Domains
A domain is an Identity service API v3 entity and represents a collection of projects and users that
defines administrative boundaries for the management of Identity entities. Users can be granted the
administrator role for a domain. A domain administrator can create projects, users, and groups in a
domain and assign roles to users and groups in a domain.
def list_domains(conn):
print("List Domains:")
List Groups
A group is an Identity service API v3 entity and represents a collection of users that are owned by a
domain. A group role granted to a domain or project applies to all users in the group. Adding users
to, or removing users from, a group respectively grants, or revokes, their role and authentication to the
associated domain or project.
def list_groups(conn):
print("List Groups:")
List Services
A service is an OpenStack service, such as Compute, Object Storage, or Image service, that provides
one or more endpoints through which users can access resources and perform operations.
def list_services(conn):
print("List Services:")
List Endpoints
An endpoint is a network-accessible address, usually a URL, through which you can access a service.
def list_endpoints(conn):
print("List Endpoints:")
List Regions
A region is an Identity service API v3 entity and represents a general division in an OpenStack deploy-
ment. You can associate zero or more sub-regions with a region to make a tree-like structured hierarchy.
def list_regions(conn):
print("List Regions:")
Before working with the Image service, youll need to create a connection to your OpenStack cloud by
following the Connect user guide. This will provide you with the conn variable used in the examples
below.
The primary resource of the Image service is the image.
List Images
An image is a collection of files for a specific operating system that you use to create or rebuild a server.
OpenStack provides pre-built images. You can also create custom images, or snapshots, from servers
that you have launched. Images come in different formats and are sometimes called virtual machine
images.
def list_images(conn):
print("List Images:")
Create Image
def upload_image(conn):
print("Upload Image:")
Create an image then use interoperable image import process to download data from a web URL.
For more information about the image import process, please check interoperable image import
def import_image(conn):
print("Import Image:")
As images are often very large pieces of data, storing their entire contents in the memory of your appli-
cation can be less than desirable. A more efficient method may be to iterate over a stream of the response
data.
By choosing to stream the response content, you determine the chunk_size that is appropriate for
your needs, meaning only that many bytes of data are read for each iteration of the loop until all data has
been consumed. See requests.Response.iter_content() for more information.
When you choose to stream an image download, openstacksdk is no longer able to compute the check-
sum of the response data for you. This example shows how you might do that yourself, in a very similar
manner to how the library calculates checksums for non-streamed responses.
def download_image_stream(conn):
print("Download Image via streaming:")
local_image.write(chunk)
# Now that you've consumed all of the data the response gave you,
# ensure that the checksums of what the server offered and
# what you downloaded are the same.
if response.headers["Content-MD5"] != md5.hexdigest():
raise Exception("Checksum mismatch in downloaded content")
If you wish to download an images contents all at once and to memory, simply set stream=False,
which is the default.
def download_image(conn):
print("Download Image:")
Delete Image
Delete an image.
def delete_image(conn):
print("Delete Image:")
example_image = conn.image.find_image(EXAMPLE_IMAGE_NAME)
conn.image.delete_image(example_image, ignore_missing=False)
Before working with the Key Manager service, youll need to create a connection to your OpenStack
cloud by following the Connect user guide. This will provide you with the conn variable used in the
examples below.
Table of Contents
• Create a Secret
• List Secrets
• Get Secret Payload
Note: Some interactions with the Key Manager service differ from that of other services in that re-
sources do not have a proper id parameter, which is necessary to make some calls. Instead, resources
have a separately named id attribute, e.g., the Secret resource has secret_id.
The examples below outline when to pass in those id values.
Create a Secret
The Key Manager service allows you to create new secrets by passing the attributes of the Secret to
the create_secret() method.
def create_secret(conn):
print("Create a secret:")
List Secrets
Once you have stored some secrets, they are available for you to list via the secrets() method. This
method returns a generator, which yields each Secret.
def list_secrets(conn):
print("List Secrets:")
The secrets() method can also make more advanced queries to limit the secrets that are returned.
def list_secrets_query(conn):
print("List Secrets:")
Once you have received a Secret, you can obtain the payload for it by passing the secrets id value to
the secrets() method. Use the secret_id attribute when making this request.
def get_secret_payload(conn):
print("Get a secret's payload:")
# Assuming you have an object `s` which you perhaps received from
# a conn.key_manager.secrets() call...
secret = conn.key_manager.get_secret(s.secret_id)
print(secret.payload)
Before working with the Message service, youll need to create a connection to your OpenStack cloud by
following the Connect user guide. This will provide you with the conn variable used in the examples
below.
Before working with the Network service, youll need to create a connection to your OpenStack cloud by
following the Connect user guide. This will provide you with the conn variable used in the examples
below.
Table of Contents
• List Networks
• List Subnets
• List Ports
• List Security Groups
• List Routers
• List Network Agents
• Create Network
• Open a Port
• Accept Pings
• Delete Network
List Networks
A network is an isolated Layer 2 networking segment. There are two types of networks, project and
provider networks. Project networks are fully isolated and are not shared with other projects. Provider
networks map to existing physical networks in the data center and provide external network access for
servers. Only an OpenStack administrator can create provider networks. Networks can be connected via
routers.
def list_networks(conn):
print("List Networks:")
List Subnets
A subnet is a block of IP addresses and associated configuration state. Subnets are used to allocate IP
addresses when new ports are created on a network.
def list_subnets(conn):
print("List Subnets:")
List Ports
A port is a connection point for attaching a single device, such as the NIC of a server, to a network. The
port also describes the associated network configuration, such as the MAC and IP addresses to be used
on that port.
def list_ports(conn):
print("List Ports:")
A security group acts as a virtual firewall for servers. It is a container for security group rules which
specify the type of network traffic and direction that is allowed to pass through a port.
def list_security_groups(conn):
print("List Security Groups:")
List Routers
A router is a logical component that forwards data packets between networks. It also provides Layer 3
and NAT forwarding to provide external network access for servers on project networks.
def list_routers(conn):
print("List Routers:")
A network agent is a plugin that handles various tasks used to implement virtual networks. These
agents include neutron-dhcp-agent, neutron-l3-agent, neutron-metering-agent, and neutron-lbaas-agent,
among others.
def list_network_agents(conn):
print("List Network Agents:")
Create Network
Create a project network and subnet. This network can be used when creating a server and allows the
server to communicate with others servers on the same project network.
def create_network(conn):
print("Create Network:")
example_network = conn.network.create_network(
name='openstacksdk-example-project-network')
print(example_network)
example_subnet = conn.network.create_subnet(
name='openstacksdk-example-project-subnet',
network_id=example_network.id,
ip_version='4',
cidr='10.0.2.0/24',
gateway_ip='10.0.2.1')
print(example_subnet)
Open a Port
When creating a security group for a network, you will need to open certain ports to allow communica-
tion via them. For example, you may need to enable HTTPS access on port 443.
def open_port(conn):
print("Open a port:")
example_sec_group = conn.network.create_security_group(
name='openstacksdk-example-security-group')
print(example_sec_group)
example_rule = conn.network.create_security_group_rule(
security_group_id=example_sec_group.id,
(continues on next page)
print(example_rule)
Accept Pings
In order to ping a machine on your network within a security group, you will need to create a rule to
allow inbound ICMP packets.
def allow_ping(conn):
print("Allow pings:")
example_sec_group = conn.network.create_security_group(
name='openstacksdk-example-security-group2')
print(example_sec_group)
example_rule = conn.network.create_security_group_rule(
security_group_id=example_sec_group.id,
direction='ingress',
remote_ip_prefix='0.0.0.0/0',
protocol='icmp',
port_range_max=None,
port_range_min=None,
ethertype='IPv4')
print(example_rule)
Delete Network
def delete_network(conn):
print("Delete Network:")
example_network = conn.network.find_network(
'openstacksdk-example-project-network')
Before working with the Object Store service, youll need to create a connection to your OpenStack
cloud by following the Connect user guide. This will provide you with the conn variable used in the
examples below.
Table of Contents
The primary resources of the Object Store service are containers and objects.
Listing Containers
The containers method returns a generator which yields Container objects. It handles pagination
for you, which can be adjusted via the limit argument. By default, the containers method will
yield as many containers as the service will return, and it will continue requesting until it receives no
more.
Creating Containers
To get the metadata for a container, use the get_container_metadata() method. This method
either takes the name of a container, or a Container object, and it returns a Container object with all
of its metadata attributes set.
To set the metadata for a container, use the set_container_metadata() method. This method
takes a Container object. For example, to grant another user write access to this container, you can
set the write_ACL on a resource and pass it to set_container_metadata.
Objects are held in containers. From an API standpoint, you work with them using similarly named
methods, typically with an additional argument to specify their container.
Listing Objects
To list the objects that exist in a container, use the objects() method.
If you have a Container object, you can pass it to objects.
Similar to the containers() method, objects returns a generator which yields Object objects
stored in the container. It also handles pagination for you, which you can adjust with the limit param-
eter, otherwise making each request for the maximum that your Object Store will return.
If you have the name of a container instead of an object, you can also pass that to the objects method.
Once you have an Object, you get the data stored inside of it with the get_object_data()
method.
Additionally, if you want to save the object to disk, the download_object() convenience method
takes an Object and a path to write the contents to.
Uploading Objects
Once you have data youd like to store in the Object Store service, you use the upload_object()
method. This method takes the data to be stored, along with at least an object name and the
container it is to be stored in.
Working with metadata on objects is identical to how its done with containers. You use the
get_object_metadata() and set_object_metadata() methods.
The metadata attributes to be set can be found on the Object object.
We set the delete_after value to 500 seconds, causing the object to be deleted in 300 seconds, or
five minutes. That attribute corresponds to the X-Delete-After header value, which you can see is
returned when we retrieve the updated metadata.
>>> conn.object_store.get_object_metadata(ob)
openstack.object_store.v1.container.Object: {'content-length': '11',
'container': u'Secret Container',
'name': u'selfdestruct.txt', 'x-delete-after': 300,
'accept-ranges': 'bytes', 'last-modified': 'Tue, 25 Nov 2014 17:50:45 GMT',
'etag': '5eb63bbbe01eeed093cb22bb8f5acdc3',
'x-timestamp': '1416937844.36805',
'x-trans-id': 'tx5c3fd94adf7c4e1b8f334-005474c17b',
'date': 'Tue, 25 Nov 2014 17:50:51 GMT', 'content-type': 'text/plain'}
Before working with the Orchestration service, youll need to create a connection to your OpenStack
cloud by following the Connect user guide. This will provide you with the conn variable used in the
examples below.
Service APIs are exposed through a two-layered approach. The classes exposed through our Connection
interface are the place to start if youre an application developer consuming an OpenStack cloud. The
Resource interface is the layer upon which the Connection is built, with Connection methods accepting
and returning Resource objects.
The Cloud Abstraction layer has a data model.
Data Model
shade has a very strict policy on not breaking backwards compatability ever. However, with the data
structures returned from OpenStack, there are places where the resource structures from OpenStack
are returned to the user somewhat directly, leaving a shade user open to changes/differences in result
content.
To combat that, shade normalizes the return structure from OpenStack in many places, and the results of
that normalization are listed below. Where shade performs normalization, a user can count on any fields
declared in the docs as being completely safe to use - they are as much a part of shades API contract as
any other Python method.
Some OpenStack objects allow for arbitrary attributes at the root of the object. shade will pass those
through so as not to break anyone who may be counting on them, but as they are arbitrary shade can
make no guarantees as to their existence. As part of normalization, shade will put any attribute from an
OpenStack resource that is not in its data model contract into an attribute called properties. The contents
of properties are defined to be an arbitrary collection of key value pairs with no promises as to any
particular key ever existing.
If a user passes strict=True to the shade constructor, shade will not pass through arbitrary objects to the
root of the resource, and will instead only put them in the properties dict. If a user is worried about
accidentally writing code that depends on an attribute that is not part of the API contract, this can be a
useful tool. Keep in mind all data can still be accessed via the properties dict, but any code touching
anything in the properties dict should be aware that the keys found there are highly user/cloud specific.
Any key that is transformed as part of the shade data model contract will not wind up with an entry in
properties - only keys that are unknown.
Location
A Location defines where a resource lives. It includes a cloud name and a region name, an availability
zone as well as information about the project that owns the resource.
The project information may contain a project id, or a combination of one or more of a project name
with a domain name or id. If a project id is present, it should be considered correct.
Some resources do not carry ownership information with them. For those, the project information will
be filled in from the project the user currently has a token for.
Some resources do not have information about availability zones, or may exist region wide. Those
resources will have None as their availability zone.
If all of the project information is None, then
Location = dict(
cloud=str(),
region_name=str(),
zone=str() or None,
project=dict(
id=str() or None,
name=str() or None,
domain_id=str() or None,
domain_name=str() or None))
Resources
Flavor
Flavor = dict(
location=Location(),
id=str(),
name=str(),
is_public=bool(),
is_disabled=bool(),
ram=int(),
vcpus=int(),
disk=int(),
ephemeral=int(),
swap=int(),
rxtx_factor=float(),
extra_specs=dict(),
properties=dict())
Flavor Access
FlavorAccess = dict(
flavor_id=str(),
project_id=str())
Image
A Glance Image.
Image = dict(
location=Location(),
id=str(),
name=str(),
min_ram=int(),
min_disk=int(),
size=int(),
virtual_size=int(),
container_format=str(),
disk_format=str(),
checksum=str(),
created_at=str(),
updated_at=str(),
owner=str(),
is_public=bool(),
is_protected=bool(),
visibility=str(),
status=str(),
locations=list(),
direct_url=str() or None,
tags=list(),
properties=dict())
Keypair
Keypair = dict(
location=Location(),
name=str(),
id=str(),
public_key=str(),
fingerprint=str(),
type=str(),
user_id=str(),
private_key=str() or None
properties=dict())
Security Group
Server
ComputeLimits
ComputeLimits = dict(
location=Location(),
max_personality=int(),
max_personality_size=int(),
max_server_group_members=int(),
max_server_groups=int(),
max_server_meta=int(),
max_total_cores=int(),
max_total_instances=int(),
max_total_keypairs=int(),
max_total_ram_size=int(),
total_cores_used=int(),
total_instances_used=int(),
total_ram_used=int(),
total_server_groups_used=int(),
properties=dict())
ComputeUsage
ComputeUsage = dict(
location=Location(),
started_at=str(),
stopped_at=str(),
server_usages=list(),
max_personality=int(),
max_personality_size=int(),
(continues on next page)
ServerUsage
ComputeUsage = dict(
started_at=str(),
ended_at=str(),
flavor=str(),
hours=int(),
instance_id=str(),
local_gb=int(),
memory_mb=int(),
name=str(),
state=str(),
uptime=int(),
vcpus=int(),
properties=dict())
Floating IP
FloatingIP = dict(
location=Location(),
id=str(),
description=str(),
attached=bool(),
fixed_ip_address=str() or None,
floating_ip_address=str() or None,
network=str() or None,
port=str() or None,
router=str(),
status=str(),
created_at=str() or None,
updated_at=str() or None,
(continues on next page)
Volume
Volume = dict(
location=Location(),
id=str(),
name=str(),
description=str(),
size=int(),
attachments=list(),
status=str(),
migration_status=str() or None,
host=str() or None,
replication_driver=str() or None,
replication_status=str() or None,
replication_extended_status=str() or None,
snapshot_id=str() or None,
created_at=str(),
updated_at=str() or None,
source_volume_id=str() or None,
consistencygroup_id=str() or None,
volume_type=str() or None,
metadata=dict(),
is_bootable=bool(),
is_encrypted=bool(),
can_multiattach=bool(),
properties=dict())
VolumeType
VolumeType = dict(
location=Location(),
id=str(),
name=str(),
description=str() or None,
is_public=bool(),
qos_specs_id=str() or None,
extra_specs=dict(),
properties=dict())
VolumeTypeAccess
VolumeTypeAccess = dict(
location=Location(),
volume_type_id=str(),
project_id=str(),
properties=dict())
ClusterTemplate
ClusterTemplate = dict(
location=Location(),
apiserver_port=int(),
cluster_distro=str(),
coe=str(),
created_at=str(),
dns_nameserver=str(),
docker_volume_size=int(),
external_network_id=str(),
fixed_network=str() or None,
flavor_id=str(),
http_proxy=str() or None,
https_proxy=str() or None,
id=str(),
image_id=str(),
insecure_registry=str(),
is_public=bool(),
is_registry_enabled=bool(),
is_tls_disabled=bool(),
keypair_id=str(),
labels=dict(),
master_flavor_id=str() or None,
name=str(),
network_driver=str(),
no_proxy=str() or None,
server_type=str(),
updated_at=str() or None,
volume_driver=str(),
properties=dict())
MagnumService
MagnumService = dict(
location=Location(),
binary=str(),
created_at=str(),
disabled_reason=str() or None,
host=str(),
id=str(),
report_count=int(),
state=str(),
properties=dict())
Stack
Stack = dict(
location=Location(),
id=str(),
name=str(),
created_at=str(),
deleted_at=str(),
updated_at=str(),
description=str(),
action=str(),
identifier=str(),
is_rollback_enabled=bool(),
notification_topics=list(),
outputs=list(),
owner=str(),
parameters=dict(),
parent=str(),
stack_user_project_id=str(),
status=str(),
status_reason=str(),
tags=dict(),
tempate_description=str(),
timeout_mins=int(),
properties=dict())
Identity Resources
Project
Project = dict(
location=Location(),
id=str(),
name=str(),
description=str(),
is_enabled=bool(),
is_domain=bool(),
domain_id=str(),
properties=dict())
Role
Project = dict(
location=Location(),
id=str(),
name=str(),
domain_id=str(),
properties=dict())
Connection Interface
A Connection instance maintains your cloud config, session and authentication information providing
you with a set of higher-level interfaces to work with OpenStack services.
Connection
The Connection class is the primary interface to the Python SDK. It maintains a context for a con-
nection to a region of a cloud provider. The Connection has an attribute to access each OpenStack
service.
At a minimum, the Connection class needs to be created with a config or the parameters to build one.
While the overall system is very flexible, there are four main use cases for different ways to create a
Connection.
• Using config settings and keyword arguments as described in Configuring OpenStack SDK Appli-
cations
• Using only keyword arguments passed to the constructor ignoring config files and environment
variables.
For users who want to create a Connection making use of named clouds in clouds.yaml files,
OS_ environment variables and python keyword arguments, the openstack.connect() factory
function is the recommended way to go:
import openstack
If the application in question is a command line application that should also accept command line ar-
guments, an argparse.Namespace can be passed to openstack.connect() that will have relevant
arguments added to it and then subsequently consumed by the constructor:
import argparse
import openstack
If the application wants to avoid loading any settings from clouds.yaml or environment variables,
use the Connection constructor directly. As long as the cloud argument is omitted or None, the
Connection constructor will not load settings from files or the environment.
Note: This is a different default behavior than the connect() factory function. In connect() if
cloud is omitted or None, a default cloud will be loaded, defaulting to the envvars cloud if it exists.
conn = connection.Connection(
region_name='example-region',
auth=dict(
auth_url='https://auth.example.com',
username='amazing-user',
password='super-secret-password',
project_id='33aa1afc-03fe-43b8-8201-4e0d3b4b8ab5',
user_domain_id='054abd68-9ad9-418b-96d3-3437bb376703'),
compute_api_version='2',
identity_interface='internal')
For applications that already have an authenticated Session, simply passing it to the Connection
constructor is all that is needed:
conn = connection.Connection(
session=session,
region_name='example-region',
compute_api_version='2',
identity_interface='internal')
For applications that have an oslo.config CONF object that has been populated with keystoneauth1.
loading.register_adapter_conf_options in groups named by the OpenStack services
project name, it is possible to construct a Connection with the CONF object and an authenticated Session.
Note: This is primarily intended for use by OpenStack services to talk amongst themselves.
conn = connection.Connection(
session=session,
oslo_conf=CONF)
config = openstack.config.get_cloud_region(
cloud='example', region_name='earth')
conn = connection.Connection(config=config)
Services are accessed through an attribute named after the services official service-type.
List
projects = conn.identity.projects()
Find or create
If you wanted to make sure you had a network named zuul, you would first try to find it and if that fails,
you would create it:
network = conn.network.find_network("zuul")
if network is None:
network = conn.network.create_network(name="zuul")
Additional information about the services can be found in the Service Proxies documentation.
from_config
Connection Object
Note: This method is optional. When an application makes a call to any OpenStack service,
this method allows you to request a token manually before attempting to do anything else.
close()
Release any resources held open.
add_auto_ip(server, wait=False, timeout=60, reuse=True)
Add a floating IP to a server.
This method is intended for basic usage. For advanced network architecture (e.g. multiple
external networks or servers with multiple interfaces), use other floating IP methods.
This method can reuse available IPs, or allocate new IPs to the current project.
Parameters
• server a server dictionary.
• reuse Whether or not to attempt to reuse IPs, defaults to True.
• wait (optional) Wait for the address to appear as assigned to the server.
Defaults to False.
• timeout (optional) Seconds to wait, defaults to 60. See the wait param-
eter.
• reuse Try to reuse existing ips. Defaults to True.
Returns Floating IP address attached to server.
add_flavor_access(flavor_id, project_id)
Grant access to a private flavor for a project/tenant.
Parameters
• flavor_id (string) ID of the private flavor.
• project_id (string) ID of the project/tenant.
Raises OpenStackCloudException on operation error.
add_host_to_aggregate(name_or_id, host_name)
Add a host to an aggregate.
Parameters
• name_or_id Name or ID of the host aggregate.
• host_name Host to add.
Raises OpenStackCloudException on operation error.
add_ip_list(server, ips, wait=False, timeout=60, fixed_address=None)
Attach a list of IPs to a server.
Parameters
• server a server object
• ips list of floating IP addresses or a single address
• wait (optional) Wait for the address to appear as assigned to the server.
Defaults to False.
• timeout (optional) Seconds to wait, defaults to 60. See the wait param-
eter.
• fixed_address (optional) Fixed address of the server to attach the IP to
Returns The updated server munch.Munch
Raises OpenStackCloudException, on operation error.
add_router_interface(router, subnet_id=None, port_id=None)
Attach a subnet to an internal router interface.
Either a subnet ID or port ID must be specified for the internal interface. Supplying both
will result in an error.
Parameters
• router (dict) The dict object of the router being changed
• subnet_id (string) The ID of the subnet to use for the interface
• port_id (string) The ID of the port to use for the interface
Returns A munch.Munch with the router ID (ID), subnet ID (subnet_id), port
ID (port_id) and tenant ID (tenant_id).
Raises OpenStackCloudException on operation error.
add_server_security_groups(server, security_groups)
Add security groups to a server.
Add existing security groups to an existing server. If the security groups are already present
on the server this will continue unaffected.
Returns False if server or security groups are undefined, True otherwise.
Raises OpenStackCloudException, on operation error.
add_user_to_group(name_or_id, group_name_or_id)
Add a user to a group.
Parameters
• name_or_id (string) User name or ID
• group_name_or_id (string) Group name or ID
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call
add_volume_type_access(name_or_id, project_id)
Grant access on a volume_type to a project.
Parameters
• name_or_id ID or name of a volume_type
• project_id A project id
NOTE: the call works even if the project does not exist.
Raises OpenStackCloudException on operation error.
attach_port_to_machine(name_or_id, port_name_or_id)
Attach a virtual port to the bare metal machine.
Parameters
• name_or_id (string) A machine name or UUID.
• port_name_or_id (string) A port name or UUID. Note that this is a
Network service port, not a bare metal NIC.
Returns Nothing.
attach_volume(server, volume, device=None, wait=True, timeout=None)
Attach a volume to a server.
This will attach a volume, described by the passed in volume dict (as returned by
get_volume()), to the server described by the passed in server dict (as returned by
get_server()) on the named device on the server.
If the volume is already attached to the server, or generally not available, then an exception
is raised. To re-attach to a server, but under a different device, the user must detach it first.
Parameters
• server The server dict to attach to.
• volume The volume dict to attach.
• device The device name where the volume will attach.
• wait If true, waits for volume to be attached.
• timeout Seconds to wait for volume attachment. None is forever.
Returns a volume attachment object.
Raises OpenStackCloudTimeout if wait time exceeded.
Raises OpenStackCloudException on operation error.
available_floating_ip(network=None, server=None)
Get a floating IP from a network or a pool.
Return the first available floating IP or allocate a new one.
Parameters
• network Name or ID of the network.
• server Server the IP is for if known
Returns a (normalized) structure with a floating IP address description.
bind_accelerator_request(uuid, properties)
Bind an accelerator to VM. :param uuid: The uuid of the accelerator_request to be binded.
:param properties: The info of VM that will bind the accelerator. :returns: True if bind
succeeded, False otherwise.
connect_as(**kwargs)
Make a new OpenStackCloud object with new auth context.
Take the existing settings from the current cloud and construct a new OpenStackCloud object
with some of the auth settings overridden. This is useful for getting an object to perform tasks
with as another user, or in the context of a different project.
conn = openstack.connect(cloud='example')
# Work normally
servers = conn.list_servers()
conn2 = conn.connect_as(username='different-user', password='')
# Work as different-user
servers = conn2.list_servers()
Parameters kwargs keyword arguments can contain anything that would nor-
mally go in an auth dict. They will override the same settings from the parent
cloud as appropriate. Entries that do not want to be overridden can be ommit-
ted.
connect_as_project(project)
Make a new OpenStackCloud object with a new project.
Take the existing settings from the current cloud and construct a new OpenStackCloud object
with the project settings overridden. This is useful for getting an object to perform tasks with
as another user, or in the context of a different project.
cloud = openstack.connect(cloud='example')
# Work normally
servers = cloud.list_servers()
cloud2 = cloud.connect_as_project('different-project')
# Work in different-project
servers = cloud2.list_servers()
create_accelerator_request(attrs)
Create an accelerator_request. :param attrs: The info of accelerator_request to be created.
:returns: A munch.Munch of the created accelerator_request.
create_aggregate(name, availability_zone=None)
Create a new host aggregate.
Parameters
• name Name of the host aggregate being created
• availability_zone Availability zone to assign hosts
Returns a dict representing the new host aggregate.
Raises OpenStackCloudException on operation error.
create_baymodel(name, image_id=None, keypair_id=None, coe=None, **kwargs)
Create a cluster template.
Parameters
• name (string) Name of the cluster template.
• image_id (string) Name or ID of the image to use.
• keypair_id (string) Name or ID of the keypair to use.
• coe (string) Name of the coe for the cluster template.
Other arguments will be passed in kwargs.
Returns a dict containing the cluster template description
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call
create_cluster_template(name, image_id=None, keypair_id=None, coe=None,
**kwargs)
Create a cluster template.
Parameters
• name (string) Name of the cluster template.
Note: This method is not needed in most cases. Modern swift does not require directory
marker objects. However, some swift installs may need these.
When using swift Static Web and Web Listings to serve static content one may need to create
a zero-byte object to represent each directory. Doing so allows Web Listings to generate an
index of the objects inside of it, and allows Static Web to render index.html files that are
inside the directory.
Parameters
• container The name of the container.
• name Name for the directory marker object within the container.
• headers These will be passed through to the object creation API as HTTP
Headers.
create_domain(name, description=None, enabled=True)
Create a domain.
Parameters
• name The name of the domain.
• description A description of the domain.
• enabled Is the domain enabled or not (default True).
Returns a munch.Munch containing the domain representation.
Raises OpenStackCloudException if the domain cannot be created.
create_endpoint(service_name_or_id, url=None, interface=None, region=None, en-
abled=True, **kwargs)
Create a Keystone endpoint.
Parameters
• service_name_or_id Service name or id for this endpoint.
• url URL of the endpoint
• interface Interface type of the endpoint
• public_url Endpoint public URL.
• internal_url Endpoint internal URL.
• admin_url Endpoint admin URL.
• region Endpoint region.
• enabled Whether the endpoint is enabled
NOTE: Both v2 (public_url, internal_url, admin_url) and v3 (url, interface) calling se-
mantics are supported. But you can only use one of them at a time.
create_firewall_group(**kwargs)
Creates firewall group. The keys egress_firewall_policy and ingress_firewall_policy are
looked up and mapped as egress_firewall_policy_id and ingress_firewall_policy_id respec-
tively. Port name or ids list is transformed to port ids list before the POST request.
Parameters
• admin_state_up (bool) State of firewall group. Will block all traffic
if set to False. Defaults to True.
• description Human-readable description.
• egress_firewall_policy Name or id of egress firewall policy.
• ingress_firewall_policy Name or id of ingress firewall policy.
• name Human-readable name.
• ports (list[str]) List of associated ports (name or id)
• project_id Project id.
• shared Visibility to other projects. Defaults to False.
Raises BadRequestException if parameters are malformed
Raises DuplicateResource on multiple matches
Raises ResourceNotFound if (ingress-, egress-) firewall policy or a port is not
found.
Returns created firewall group
Return type FirewallGroup
create_firewall_policy(**kwargs)
Create firewall policy.
Parameters
• audited (bool) Status of audition of firewall policy. Set to False each
time the firewall policy or the associated firewall rules are changed. Has to
be explicitly set to True.
• description Human-readable description.
• firewall_rules (list[str]) List of associated firewall rules.
• name Human-readable name.
• project_id Project id.
• shared (bool) Visibility to other projects. Defaults to False.
Raises BadRequestException if parameters are malformed
Raises ResourceNotFound if a resource from firewall_list not found
Returns created firewall policy
Return type FirewallPolicy
create_firewall_rule(**kwargs)
Creates firewall rule.
Parameters
• action Action performed on traffic. Valid values: allow, deny Defaults to
deny.
• description Human-readable description.
• destination_firewall_group_id ID of destination firewall
group.
• destination_ip_address IPv4-, IPv6 address or CIDR.
• destination_port Port or port range (e.g. 80:90)
• enabled (bool) Status of firewall rule. You can disable rules without
disassociating them from firewall policies. Defaults to True.
• ip_version (int) IP Version. Valid values: 4, 6 Defaults to 4.
• name Human-readable name.
• project_id Project id.
• protocol IP protocol. Valid values: icmp, tcp, udp, null
• shared (bool) Visibility to other projects. Defaults to False.
• source_firewall_group_id ID of source firewall group.
• source_ip_address IPv4-, IPv6 address or CIDR.
• source_port Port or port range (e.g. 80:90)
Raises BadRequestException if parameters are malformed
Returns created firewall rule
Return type FirewallRule
create_flavor(name, ram, vcpus, disk, flavorid=’auto’, ephemeral=0, swap=0,
rxtx_factor=1.0, is_public=True)
Create a new flavor.
Parameters
• name Descriptive name of the flavor
• ram Memory in MB for the flavor
• vcpus Number of VCPUs for the flavor
• disk Size of local disk in GB
• flavorid ID for the flavor (optional)
• ephemeral Ephemeral space size in GB
• swap Swap space in MB
• rxtx_factor RX/TX factor
• is_public Make flavor accessible to the public
Parameters
• name Name of the image to be created
create_keypair(name, public_key=None)
Create a new keypair.
Parameters
• name Name of the keypair being created.
• public_key Public key for the new keypair.
Raises OpenStackCloudException on operation error.
create_network(name, shared=False, admin_state_up=True, external=False,
provider=None, project_id=None, availability_zone_hints=None,
port_security_enabled=None, mtu_size=None, dns_domain=None)
Create a network.
Parameters
• name (string) Name of the network being created.
• shared (bool) Set the network as shared.
• admin_state_up (bool) Set the network administrative state to up.
• external (bool) Whether this network is externally accessible.
• provider (dict) A dict of network provider options. Example:
[
{
"ip_address": "10.29.29.13",
(continues on next page)
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
[
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
• device_owner The ID of the entity that uses this port. For example, a
DHCP agent. (Optional)
• device_id The ID of the device that uses this port. For example, a virtual
server. (Optional)
• vnic_type (binding) The type of the created port. (Optional)
• port_security_enabled The security port state created on the net-
work. (Optional)
• qos_policy_id The ID of the QoS policy to apply for port.
Returns a munch.Munch describing the created port.
Raises OpenStackCloudException on operation error.
create_project(name, description=None, domain_id=None, enabled=True)
Create a project.
create_qos_bandwidth_limit_rule(policy_name_or_id, max_kbps, **kwargs)
Create a QoS bandwidth limit rule.
Parameters
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b
,→ ",
"ip_address": "192.168.10.2"
}
]
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
[ "8.8.8.7", "8.8.8.8" ]
• host_routes A list of host route dictionaries for the subnet. For exam-
ple:
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
Parameters
• name Name of the zone being created.
• zone_type Type of the zone (primary/secondary)
• email Email of the zone owner (only applies if zone_type is primary)
• description Description of the zone
• ttl TTL (Time to live) value in seconds
• masters Master nameservers (only applies if zone_type is secondary)
Returns a dict representing the created zone.
Raises OpenStackCloudException on operation error.
property current_location
Return a munch.Munch explaining the current cloud location.
property current_project
Return a munch.Munch describing the current project
property current_project_id
Get the current project ID.
Returns the project_id of the current token scope. None means that the token is domain
scoped or unscoped.
Raises
• keystoneauth1.exceptions.auth.AuthorizationFailure
if a new token fetch fails.
• keystoneauth1.exceptions.auth_plugins.
MissingAuthPlugin if a plugin is not available.
property current_user_id
Get the id of the currently logged-in user from the token.
delete_accelerator_request(name_or_id, filters)
Delete a accelerator_request. :param name_or_id: The Name(or uuid) of accelera-
tor_request. :param filters: dict of filter conditions to push down :returns: True if delete
succeeded, False otherwise.
delete_aggregate(name_or_id)
Delete a host aggregate.
Parameters name_or_id Name or ID of the host aggregate to delete.
Returns True if delete succeeded, False otherwise.
Raises OpenStackCloudException on operation error.
delete_autocreated_image_objects(container=None, segment_prefix=None)
Delete all objects autocreated for image uploads.
This method should generally not be needed, as shade should clean up the objects it uses for
object-based image creation. If something goes wrong and it is found that there are leaked
objects, this method can be used to delete any objects that shade has created on the users
behalf in service of image uploads.
Parameters
• container (str) Name of the container. Defaults to images.
• segment_prefix (str) Prefix for the image segment names to delete.
If not given, all image upload segments present are deleted.
delete_baymodel(name_or_id)
Delete a cluster template.
Parameters name_or_id Name or unique ID of the cluster template.
Returns True if the delete succeeded, False if the cluster template was not found.
Raises OpenStackCloudException on operation error.
delete_cluster_template(name_or_id)
Delete a cluster template.
Parameters name_or_id Name or unique ID of the cluster template.
Returns True if the delete succeeded, False if the cluster template was not found.
Raises OpenStackCloudException on operation error.
delete_coe_cluster(name_or_id)
Delete a COE cluster.
Parameters name_or_id Name or unique ID of the cluster.
Returns True if the delete succeeded, False if the cluster was not found.
Raises OpenStackCloudException on operation error.
delete_coe_cluster_template(name_or_id)
Delete a cluster template.
Parameters name_or_id Name or unique ID of the cluster template.
Returns True if the delete succeeded, False if the cluster template was not found.
Raises OpenStackCloudException on operation error.
delete_compute_quotas(name_or_id)
Delete quota for a project
Parameters name_or_id project name or id
Raises OpenStackCloudException if its not a valid project or the nova client call
failed
Returns dict with the quotas
delete_container(name)
Delete an object-store container.
Parameters name (str) Name of the container to delete.
delete_device_profile(name_or_id, filters)
Delete a device_profile. :param name_or_id: The Name(or uuid) of device_profile to be
deleted. :param filters: dict of filter conditions to push down :returns: True if delete suc-
ceeded, False otherwise.
delete_domain(domain_id=None, name_or_id=None)
Delete a domain.
Parameters
• domain_id ID of the domain to delete.
• name_or_id Name or ID of the domain to delete.
Returns True if delete succeeded, False otherwise.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call.
delete_endpoint(id)
Delete a Keystone endpoint.
Parameters id Id of the endpoint to delete.
Returns True if delete succeeded, False otherwise.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call.
delete_firewall_group(name_or_id, filters=None)
Deletes firewall group. Prints debug message in case to-be-deleted resource was not found.
Parameters
• name_or_id firewall group name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns True if resource is successfully deleted, False otherwise.
Return type bool
delete_firewall_policy(name_or_id, filters=None)
Deletes firewall policy. Prints debug message in case to-be-deleted resource was not found.
Parameters
• name_or_id firewall policy name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns True if resource is successfully deleted, False otherwise.
Return type bool
delete_firewall_rule(name_or_id, filters=None)
Deletes firewall rule. Prints debug message in case to-be-deleted resource was not found.
Parameters
• name_or_id firewall rule name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns True if resource is successfully deleted, False otherwise.
delete_server_group(name_or_id)
Delete a server group.
Parameters name_or_id Name or ID of the server group to delete
Returns True if delete succeeded, False otherwise
Raises OpenStackCloudException on operation error.
delete_server_metadata(name_or_id, metadata_keys)
Delete metadata from a server instance.
Parameters
• name_or_id (str) The name or ID of the server instance to update.
• metadata_keys A list with the keys to be deleted from the server in-
stance.
Raises OpenStackCloudException on operation error.
delete_service(name_or_id)
Delete a Keystone service.
Parameters name_or_id Service name or id.
Returns True if delete succeeded, False otherwise.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call
delete_stack(name_or_id, wait=False)
Delete a stack
Parameters
• name_or_id (string) Stack name or ID.
• wait (boolean) Whether to wait for the delete to finish
Returns True if delete succeeded, False if the stack was not found.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call
delete_subnet(name_or_id)
Delete a subnet.
If a name, instead of a unique UUID, is supplied, it is possible that we could find more than
one matching subnet since names are not required to be unique. An error will be raised in
this case.
Parameters name_or_id Name or ID of the subnet being deleted.
Returns True if delete succeeded, False otherwise.
Raises OpenStackCloudException on operation error.
delete_unattached_floating_ips(retry=1)
Safely delete unattached floating ips.
If the cloud can safely purge any unattached floating ips without race conditions, do so.
Safely here means a specific thing. It means that you are not running this while another
process that might do a two step create/attach is running. You can safely run this method
while another process is creating servers and attaching floating IPs to them if either that
process is using add_auto_ip from shade, or is creating the floating IPs by passing in a
server to the create_floating_ip call.
Parameters retry number of times to retry. Optional, defaults to 1, which is in
addition to the initial delete call. A value of 0 will also cause no checking of
results to occur.
Returns Number of Floating IPs deleted, False if none
Raises OpenStackCloudException, on operation error.
delete_volume(name_or_id=None, wait=True, timeout=None, force=False)
Delete a volume.
Parameters
• name_or_id Name or unique ID of the volume.
• wait If true, waits for volume to be deleted.
• timeout Seconds to wait for volume deletion. None is forever.
• force Force delete volume even if the volume is in deleting or er-
ror_deleting state.
Raises OpenStackCloudTimeout if wait time exceeded.
Raises OpenStackCloudException on operation error.
delete_volume_backup(name_or_id=None, force=False, wait=False, time-
out=None)
Delete a volume backup.
Parameters
• name_or_id Name or unique ID of the volume backup.
• force Allow delete in state other than error or available.
• wait If true, waits for volume backup to be deleted.
• timeout Seconds to wait for volume backup deletion. None is forever.
Raises OpenStackCloudTimeout if wait time exceeded.
Raises OpenStackCloudException on operation error.
delete_volume_quotas(name_or_id)
Delete volume quotas for a project
Parameters name_or_id project name or id
Raises OpenStackCloudException if its not a valid project or the cinder client call
failed
Returns dict with the quotas
delete_volume_snapshot(name_or_id=None, wait=False, timeout=None)
Delete a volume snapshot.
Parameters
Parameters
• name_or_id (str) Name or ID of the image.
• output_path the output path to write the image to. Either this or out-
put_file must be specified
• output_file a file object (or file-like object) to write the image data to.
Only write() will be called on this object. Either this or output_path must be
specified
• chunk_size (int) size in bytes to read from the wire and buffer at one
time. Defaults to 1024
Raises OpenStackCloudException in the event download_image is called without
exactly one of either output_path or output_file
Raises OpenStackCloudResourceNotFound if no images are found matching the
name or ID provided
endpoint_for(service_type, interface=None, region_name=None)
Return the endpoint for a given service.
Respects config values for Connection, including *_endpoint_override. For direct
values from the catalog regardless of overrides, see get_endpoint_from_catalog()
Parameters
• service_type Service Type of the endpoint to search for.
• interface Interface of the endpoint to search for. Optional, defaults to
the configured value for interface for this Connection.
• region_name Region Name of the endpoint to search for. Optional, de-
faults to the configured value for region_name for this Connection.
Returns The endpoint of the service, or None if not found.
get_aggregate(name_or_id, filters=None)
Get an aggregate by name or ID.
Parameters
• name_or_id Name or ID of the aggregate.
• filters (dict) A dictionary of meta data to use for further filtering.
Elements of this dictionary may, themselves, be dictionaries. Example:
{
'availability_zone': 'nova',
'metadata': {
'cpu_allocation_ratio': '1.0'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
get_coe_cluster_certificate(cluster_id)
Get details about the CA certificate for a cluster by name or ID.
Parameters cluster_id ID of the cluster.
Returns Details about the CA certificate for the given cluster.
get_coe_cluster_template(name_or_id, filters=None, detail=False)
Get a cluster template by name or ID.
Parameters
• name_or_id Name or ID of the cluster template.
• filters A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
get_container(name, skip_cache=False)
Get metadata about a container.
Parameters
• name (str) Name of the container to get metadata for.
• skip_cache (bool) Ignore the cache of container metadata for this con-
tainer.o Defaults to False.
get_container_access(name)
Get the control list from a container.
Parameters name (str) Name of the container.
get_default_network()
Return the network that is configured to be the default interface.
Returns A network dict if one is found
get_domain(domain_id=None, name_or_id=None, filters=None)
Get exactly one Keystone domain.
Parameters
• domain_id domain id.
• name_or_id domain name or id.
• filters (dict) A dict containing additional filters to use. Keys to search
on are id, name, enabled and description.
Returns a munch.Munch containing the domain description, or None if not
found. Each munch.Munch contains the following attributes:: - id: <domain
id> - name: <domain name> - description: <domain description>
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
get_endpoint(id, filters=None)
Get exactly one Keystone endpoint.
Parameters
• id endpoint id.
• filters a dict containing additional filters to use. e.g. {region: region-
a.geo-1}
Returns a munch.Munch containing the endpoint description. i.e. a munch.
Munch containing the following attributes:: - id: <endpoint id> - region:
<endpoint region> - public_url: <endpoint public url> - internal_url: <end-
point internal url> (optional) - admin_url: <endpoint admin url> (optional)
get_external_ipv4_floating_networks()
Return the networks that are configured to route northbound.
Returns A list of network munch.Munch if one is found
get_external_ipv4_networks()
Return the networks that are configured to route northbound.
Returns A list of network munch.Munch if one is found
get_external_ipv6_networks()
Return the networks that are configured to route northbound.
Returns A list of network munch.Munch if one is found
get_external_networks()
Return the networks that are configured to route northbound.
This should be avoided in favor of the specific ipv4/ipv6 method, but is here for backwards
compatibility.
Returns A list of network munch.Munch if one is found
get_firewall_group(name_or_id, filters=None)
Retrieves firewall group.
Parameters
• name_or_id firewall group name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns firewall group or None if not found
Return type FirewallGroup
get_firewall_policy(name_or_id, filters=None)
Retrieves a single firewall policy.
Parameters
• name_or_id firewall policy name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns firewall policy or None if not found
Return type FirewallPolicy
get_firewall_rule(name_or_id, filters=None)
Retrieves a single firewall rule.
Parameters
• name_or_id firewall rule name or id
• filters (dict) optional filters
Raises DuplicateResource on multiple matches
Returns firewall rule dict or None if not found
Return type FirewallRule
get_flavor(name_or_id, filters=None, get_extra=True)
Get a flavor by name or ID.
Parameters
• name_or_id Name or ID of the flavor.
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
get_internal_ipv6_networks()
Return the networks that are configured to not route northbound.
Returns A list of network munch.Munch if one is found
get_internal_networks()
Return the networks that are configured to not route northbound.
This should be avoided in favor of the specific ipv4/ipv6 method, but is here for backwards
compatibility.
Returns A list of network munch.Munch if one is found
get_keypair(name_or_id, filters=None)
Get a keypair by name or ID.
Parameters
• name_or_id Name or ID of the keypair.
• filters A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'policy': 'affinity',
}
get_service(name_or_id, filters=None)
Get exactly one Keystone service.
Parameters
• name_or_id Name or id of the desired service.
• filters a dict containing additional filters to use. e.g. {type: network}
Returns a munch.Munch containing the services description, i.e. the following
attributes:: - id: <service id> - name: <service name> - type: <service type> -
description: <service description>
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call or if multiple matches are found.
get_stack(name_or_id, filters=None, resolve_outputs=True)
Get exactly one stack.
Parameters
• name_or_id Name or ID of the desired stack.
• filters a dict containing additional filters to use. e.g. {stack_status:
CREATE_COMPLETE}
• resolve_outputs If True, then outputs for this stack will be resolved
Returns a munch.Munch containing the stack description
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call or if multiple matches are found.
get_subnet(name_or_id, filters=None)
Get a subnet by name or ID.
Parameters
• name_or_id Name or ID of the subnet.
• filters A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
get_volume_by_id(id)
Get a volume by ID
Parameters id ID of the volume.
Returns A volume munch.Munch.
get_volume_limits(name_or_id=None)
Get volume limits for a project
Parameters name_or_id (optional) project name or ID to get limits for if dif-
ferent from the current project
Raises OpenStackCloudException if its not a valid project
Returns Munch object with the limits
get_volume_quotas(name_or_id)
Get volume quotas for a project
Parameters name_or_id project name or id
Raises OpenStackCloudException if its not a valid project
Returns Munch object with the quotas
get_volume_snapshot(name_or_id, filters=None)
Get a volume by name or ID.
Parameters
• name_or_id Name or ID of the volume snapshot.
• filters A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
NOTE: domain is a required argument when the grant is on a project, user or group
specified by name. In that situation, they are all considered to be in that domain. If
different domains are in use in the same role grant, it is required to specify those by ID.
NOTE: for wait and timeout, sometimes granting roles is not instantaneous.
Engages the Ironic node inspection behavior in order to collect metadata about the baremetal
machine.
Parameters
• name_or_id String representing machine name or UUID value in order
to identify the machine.
• wait Boolean value controlling if the method is to wait for the desired
state to be reached or a failure to occur.
• timeout Integer value, defautling to 3600 seconds, for the$ wait state to
reach completion.
Returns munch.Munch representing the current state of the machine upon exit
of the method.
is_object_stale(container, name, filename, file_md5=None, file_sha256=None)
Check to see if an object matches the hashes of a file.
Parameters
• container Name of the container.
• name Name of the object.
• filename Path to the file.
• file_md5 Pre-calculated md5 of the file contents. Defaults to None which
means calculate locally.
• file_sha256 Pre-calculated sha256 of the file contents. Defaults to
None which means calculate locally.
is_user_in_group(name_or_id, group_name_or_id)
Check to see if a user is in a group.
Parameters
• name_or_id (string) User name or ID
• group_name_or_id (string) Group name or ID
Returns True if user is in the group, False otherwise
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call
list_accelerator_requests(filters=None)
List all accelerator_requests. :param filters: (optional) dict of filter conditions to push down
:returns: A list of accelerator request info.
list_aggregates(filters={})
List all available host aggregates.
Returns A list of aggregate dicts.
list_containers(full_listing=True, prefix=None)
List containers.
Parameters full_listing Ignored. Present for backwards compat
Returns list of Munch of the container objects
• prefix (string) only objects with this prefix will be returned. (op-
tional)
Returns list of Munch of the objects
Raises OpenStackCloudException on operation error.
list_ports(filters=None)
List all available ports.
Parameters filters (optional) dict of filter conditions to push down
Returns A list of port munch.Munch.
list_ports_attached_to_machine(name_or_id)
List virtual ports attached to the bare metal machine.
Parameters name_or_id (string) A machine name or UUID.
Returns List of munch.Munch representing the ports.
list_qos_bandwidth_limit_rules(policy_name_or_id, filters=None)
List all available QoS bandwidth limit rules.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy from
from rules should be listed.
• filters (optional) dict of filter conditions to push down
Returns A list of munch.Munch containing rule info.
Raises OpenStackCloudResourceNotFound if QoS policy will not be
found.
list_qos_dscp_marking_rules(policy_name_or_id, filters=None)
List all available QoS DSCP marking rules.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy from
from rules should be listed.
• filters (optional) dict of filter conditions to push down
Returns A list of munch.Munch containing rule info.
Raises OpenStackCloudResourceNotFound if QoS policy will not be
found.
list_qos_minimum_bandwidth_rules(policy_name_or_id, filters=None)
List all available QoS minimum bandwidth rules.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy from
from rules should be listed.
• filters (optional) dict of filter conditions to push down
Returns A list of munch.Munch containing rule info.
list_roles(**kwargs)
List Keystone roles.
Parameters domain_id domain id for listing roles (v3)
Returns a list of munch.Munch containing the role description.
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
list_router_interfaces(router, interface_type=None)
List all interfaces for a router.
Parameters
• router (dict) A router dict object.
• interface_type (string) One of None, internal, or external. Con-
trols whether all, internal interfaces or external interfaces are returned.
Returns A list of port munch.Munch objects.
list_routers(filters=None)
List all available routers.
Parameters filters (optional) dict of filter conditions to push down
Returns A list of router munch.Munch.
list_security_groups(filters=None)
List all available security groups.
Parameters filters (optional) dict of filter conditions to push down
Returns A list of security group munch.Munch.
list_server_groups()
List all available server groups.
Returns A list of server group dicts.
list_server_security_groups(server)
List all security groups associated with the given server.
Returns A list of security group munch.Munch.
list_servers(detailed=False, all_projects=False, bare=False, filters=None)
List all available servers.
Parameters
• detailed Whether or not to add detailed additional information. Defaults
to False.
• all_projects Whether to list servers from all projects or just the current
auth scoped project.
• bare Whether to skip adding any additional information to the server
record. Defaults to False, meaning the addresses dict will be populated as
needed from neutron. Setting to True implies detailed = False.
• filters Additional query parameters passed to the API server.
Returns A list of server munch.Munch.
list_services()
List all Keystone services.
Returns a list of munch.Munch containing the services description
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call.
list_subnets(filters=None)
List all available subnets.
Parameters filters (optional) dict of filter conditions to push down
Returns A list of subnet munch.Munch.
list_volume_backups(detailed=True, search_opts=None)
List all volume backups.
Parameters
• detailed (bool) Also list details for each entry
• search_opts (dict) Search options A dictionary of meta data to use
for further filtering. Example:
{
'name': 'my-volume-backup',
'status': 'available',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56
,→',
'all_tenants': 1
}
patch=[]
patch.append({
'op': 'remove',
'path': '/instance_info'
})
patch.append({
'op': 'replace',
'path': '/name',
'value': 'newname'
})
patch.append({
'op': 'add',
'path': '/driver_info/username',
'value': 'administrator'
})
[
{'mac': 'aa:bb:cc:dd:ee:01'},
{'mac': 'aa:bb:cc:dd:ee:02'}
]
• wait Boolean value, defaulting to false, to wait for the node to reach the
available state where the node can be provisioned. It must be noted, when
set to false, the method will still wait for locks to clear before sending the
next required command.
• timeout Integer value, defautling to 3600 seconds, for the wait state to
reach completion.
• lock_timeout Integer value, defaulting to 600 seconds, for locks to
clear.
• kwargs Key value pairs to be passed to the Ironic API, including uuid,
name, chassis_uuid, driver_info, parameters.
Raises OpenStackCloudException on operation error.
Returns Returns a munch.Munch representing the new baremetal node.
remove_flavor_access(flavor_id, project_id)
Revoke access from a private flavor for a project/tenant.
Parameters
• flavor_id (string) ID of the private flavor.
• project_id (string) ID of the project/tenant.
Raises OpenStackCloudException on operation error.
remove_host_from_aggregate(name_or_id, host_name)
Remove a host from an aggregate.
Parameters
• name_or_id Name or ID of the host aggregate.
• host_name Host to remove.
Raises OpenStackCloudException on operation error.
remove_machine_from_maintenance(name_or_id)
Remove Baremetal Machine from Maintenance State
Similarly to set_machine_maintenance_state, this method removes a machine from mainte-
nance state. It must be noted that this method simpily calls set_machine_maintenace_state
for the name_or_id requested and sets the state to False.
Parameters name_or_id (string) The Name or UUID value representing
the baremetal node.
Raises OpenStackCloudException on operation error.
Returns None
remove_router_interface(router, subnet_id=None, port_id=None)
Detach a subnet from an internal router interface.
• project_id A project id
Raises OpenStackCloudException on operation error.
revoke_role(name_or_id, user=None, group=None, project=None, domain=None,
wait=False, timeout=60)
Revoke a role from a user.
Parameters
• name_or_id (string) The name or id of the role.
• user (string) The name or id of the user.
• group (string) The name or id of the group. (v3)
• project (string) The name or id of the project.
• domain (string) The id of the domain. (v3)
• wait (bool) Wait for role to be revoked
• timeout (int) Timeout to wait for role to be revoked
NOTE: for wait and timeout, sometimes revoking roles is not instantaneous.
Parameters
• name_or_id cluster template name or ID.
• filters a dict containing additional filters to use.
• detail a boolean to control if we need summarized or detailed output.
Returns a list of dict containing the cluster templates
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_coe_cluster_templates(name_or_id=None, filters=None, de-
tail=False)
Search cluster templates.
Parameters
• name_or_id cluster template name or ID.
• filters a dict containing additional filters to use.
• detail a boolean to control if we need summarized or detailed output.
Returns a list of dict containing the cluster templates
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_coe_clusters(name_or_id=None, filters=None)
Search COE cluster.
Parameters
• name_or_id cluster name or ID.
• filters a dict containing additional filters to use.
• detail a boolean to control if we need summarized or detailed output.
Returns a list of dict containing the cluster
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_containers(name=None, filters=None)
Search containers.
Parameters
• name (string) container name.
• filters a dict containing additional filters to use. OR A string
containing a jmespath expression for further filtering. Example::
[?last_name==‘Smith‘] | [?other.gender]==‘Female‘]
Returns a list of munch.Munch containing the containers.
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_domains(filters=None, name_or_id=None)
Search Keystone domains.
Parameters
• name_or_id domain name or id
• filters (dict) A dict containing additional filters to use. Keys to search
on are id, name, enabled and description.
Returns a list of munch.Munch containing the domain description. Each
munch.Munch contains the following attributes:: - id: <domain id> - name:
<domain name> - description: <domain description>
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_endpoints(id=None, filters=None)
List Keystone endpoints.
Parameters
• id endpoint id.
• filters a dict containing additional filters to use. e.g. {region: region-
a.geo-1}
Returns a list of munch.Munch containing the endpoint description. Each dict
contains the following attributes:: - id: <endpoint id> - region: <endpoint
region> - public_url: <endpoint public url> - internal_url: <endpoint internal
url> (optional) - admin_url: <endpoint admin url> (optional)
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_groups(name_or_id=None, filters=None, **kwargs)
Search Keystone groups.
Parameters
• name Group name or id.
• filters A dict containing additional filters to use.
• domain_id domain id.
Returns A list of munch.Munch containing the group description.
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
search_networks(name_or_id=None, filters=None)
Search networks
Parameters
• name_or_id Name or ID of the desired network.
• filters a dict containing additional filters to use. e.g. {router:external:
True}
Returns a list of munch.Munch containing the network description.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call.
Parameters
• name_or_id Name or ID of the desired subnet.
• filters a dict containing additional filters to use. e.g. {enable_dhcp:
True}
Returns a list of munch.Munch containing the subnet description.
Raises OpenStackCloudException if something goes wrong during the
OpenStack API call.
search_users(name_or_id=None, filters=None, **kwargs)
Search users.
Parameters
• name_or_id (string) user name or ID.
• domain_id Domain ID. (v3)
• filters a dict containing additional filters to use. OR A string
containing a jmespath expression for further filtering. Example::
[?last_name==‘Smith‘] | [?other.gender]==‘Female‘]
Returns a list of munch.Munch containing the users
Raises OpenStackCloudException: if something goes wrong during the
OpenStack API call.
set_aggregate_metadata(name_or_id, metadata)
Set aggregate metadata, replacing the existing metadata.
Parameters
• name_or_id Name of the host aggregate to update
• metadata Dict containing metadata to replace (Use {key: None} to re-
move a key)
Returns a dict representing the new host aggregate.
Raises OpenStackCloudException on operation error.
set_compute_quotas(name_or_id, **kwargs)
Set a quota in a project
Parameters
• name_or_id project name or id
• kwargs key/value pairs of quota name and quota value
Raises OpenStackCloudException if the resource to set the quota does not exist.
set_container_access(name, access)
Set the access control list on a container.
Parameters
• name (str) Name of the container.
• access (str) ACL string to set on the container. Can also be public
or private which will be translated into appropriate ACL strings.
set_flavor_specs(flavor_id, extra_specs)
Add extra specs to a flavor
Parameters
• flavor_id (string) ID of the flavor to update.
• extra_specs (dict) Dictionary of key-value pairs.
Raises OpenStackCloudException on operation error.
Raises OpenStackCloudResourceNotFound if flavor ID is not found.
set_machine_maintenance_state(name_or_id, state=True, reason=None)
Set Baremetal Machine Maintenance State
Sets Baremetal maintenance state and maintenance reason.
Parameters
• name_or_id (string) The Name or UUID value representing the
baremetal node.
• state (boolean) The desired state of the node. True being in mainte-
nance where as False means the machine is not in maintenance mode. This
value defaults to True if not explicitly set.
• reason (string) An optional freeform string that is supplied to the
baremetal API to allow for notation as to why the node is in maintenance
state.
Raises OpenStackCloudException on operation error.
Returns None
set_machine_power_off(name_or_id)
De-activate baremetal machine power
This is a method that sets the node power state to off.
Params string name_or_id A string representing the baremetal node to have
power turned to an off state.
Raises OpenStackCloudException on operation error.
Returns
set_machine_power_on(name_or_id)
Activate baremetal machine power
This is a method that sets the node power state to on.
Params string name_or_id A string representing the baremetal node to have
power turned to an on state.
Raises OpenStackCloudException on operation error.
Returns None
set_machine_power_reboot(name_or_id)
De-activate baremetal machine power
This is a method that sets the node power state to reboot, which in essence changes the
machine power state to off, and that back to on.
update_aggregate(name_or_id, **kwargs)
Update a host aggregate.
Parameters
• name_or_id Name or ID of the aggregate being updated.
• name New aggregate name
• availability_zone Availability zone to assign to hosts
Returns a dict representing the updated host aggregate.
Raises OpenStackCloudException on operation error.
update_baymodel(name_or_id, operation, **kwargs)
Update a cluster template.
Parameters
• name_or_id Name or ID of the cluster template being updated.
• operation Operation to perform - add, remove, replace.
Other arguments will be passed with kwargs.
Returns a dict representing the updated cluster template.
Raises OpenStackCloudException on operation error.
update_cluster_template(name_or_id, operation, **kwargs)
Update a cluster template.
Parameters
• name_or_id Name or ID of the cluster template being updated.
• operation Operation to perform - add, remove, replace.
Other arguments will be passed with kwargs.
Returns a dict representing the updated cluster template.
Raises OpenStackCloudException on operation error.
update_coe_cluster(name_or_id, operation, **kwargs)
Update a COE cluster.
Parameters
• name_or_id Name or ID of the COE cluster being updated.
• operation Operation to perform - add, remove, replace.
Other arguments will be passed with kwargs.
Returns a dict representing the updated cluster.
Raises OpenStackCloudException on operation error.
update_coe_cluster_template(name_or_id, operation, **kwargs)
Update a cluster template.
Parameters
• name_or_id Name or ID of the cluster template being updated.
[
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
]
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
[
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
• device_owner The ID of the entity that uses this port. For example, a
DHCP agent. (Optional)
• device_id The ID of the resource this port is attached to.
• vnic_type (binding) The type of the created port. (Optional)
• port_security_enabled The security port state created on the net-
work. (Optional)
• qos_policy_id The ID of the QoS policy to apply for port.
Returns a munch.Munch describing the updated port.
Raises OpenStackCloudException on operation error.
update_qos_bandwidth_limit_rule(policy_name_or_id, rule_id, **kwargs)
Update a QoS bandwidth limit rule.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy to
which rule is associated.
• rule_id (string) ID of rule to update.
• max_kbps (int) Maximum bandwidth limit value (in kilobits per sec-
ond).
• max_burst_kbps (int) Maximum burst value (in kilobits).
• direction (string) Ingress or egress. The direction in which the traf-
fic will be limited.
Returns The updated QoS bandwidth limit rule.
Raises OpenStackCloudException on operation error.
update_qos_dscp_marking_rule(policy_name_or_id, rule_id, **kwargs)
Update a QoS DSCP marking rule.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy to
which rule is associated.
• rule_id (string) ID of rule to update.
• dscp_mark (int) DSCP mark value
Returns The updated QoS bandwidth limit rule.
Raises OpenStackCloudException on operation error.
update_qos_minimum_bandwidth_rule(policy_name_or_id, rule_id, **kwargs)
Update a QoS minimum bandwidth rule.
Parameters
• policy_name_or_id (string) Name or ID of the QoS policy to
which rule is associated.
• rule_id (string) ID of rule to update.
• min_kbps (int) Minimum bandwidth value (in kilobits per second).
• direction (string) Ingress or egress. The direction in which the traf-
fic will be available.
Returns The updated QoS minimum bandwidth rule.
Raises OpenStackCloudException on operation error.
update_qos_policy(name_or_id, **kwargs)
Update an existing QoS policy.
Parameters
• name_or_id (string) Name or ID of the QoS policy to update.
• policy_name (string) The new name of the QoS policy.
• description (string) The new description of the QoS policy.
• shared (bool) If True, the QoS policy will be set as shared.
• default (bool) If True, the QoS policy will be set as default for project.
Returns The updated QoS policy object.
Raises OpenStackCloudException on operation error.
update_recordset(zone, name_or_id, **kwargs)
Update a recordset.
Parameters
• zone Name, ID or openstack.dns.v2.zone.Zone instance of the
zone managing the recordset.
• name_or_id Name or ID of the recordset being updated.
• records List of the recordset definitions
• description Description of the recordset
• ttl TTL (Time to live) value in seconds of the recordset
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b
,→ ",
"ip_address": "192.168.10.2"
}
]
[
{
"destination": "179.24.1.0/24",
"nexthop": "172.24.3.99"
}
]
update_security_group(name_or_id, **kwargs)
Update a security group
Parameters
• name_or_id (string) Name or ID of the security group to update.
• name (string) New name for the security group.
• description (string) New description for the security group.
Returns A munch.Munch describing the updated security group.
Raises OpenStackCloudException on operation error.
update_server(name_or_id, detailed=False, bare=False, **kwargs)
Update a server.
Parameters
• name_or_id Name of the server to be updated.
• detailed Whether or not to add detailed additional information. Defaults
to False.
• bare Whether to skip adding any additional information to the server
record. Defaults to False, meaning the addresses dict will be populated as
needed from neutron. Setting to True implies detailed = False.
Name New name for the server
Description New description for the server
Returns a dictionary representing the updated server.
Raises OpenStackCloudException on operation error.
update_stack(name_or_id, template_file=None, template_url=None, tem-
plate_object=None, files=None, rollback=True, tags=None,
wait=False, timeout=3600, environment_files=None, **parameters)
Update a stack.
Parameters
• name_or_id (string) Name or ID of the stack to update.
• template_file (string) Path to the template.
• template_url (string) URL of template.
• template_object (string) URL to retrieve template object.
• files (dict) dict of additional file content to include.
• rollback (boolean) Enable rollback on update failure.
• wait (boolean) Whether to wait for the delete to finish.
• timeout (int) Stack update timeout in seconds.
• environment_files Paths to environment files to apply.
Other arguments will be passed as stack parameters which will take precedence over any
parameters specified in the environments.
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
• dns_nameservers A list of DNS name servers for the subnet. For ex-
ample:
[ "8.8.8.7", "8.8.8.8" ]
• host_routes A list of host route dictionaries for the subnet. For exam-
ple:
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
Support exists for users coming from older releases of OpenStack SDK who have been using the
Profile interface.
Note: This section describes migrating code from a previous interface of openstacksdk and can be
ignored by people writing new code.
If you have code that currently uses the Profile object and/or an authenticator instance from
an object based on openstack.auth.base.BaseAuthPlugin, that code should be updated to
use the CloudRegion object instead.
Important: Profile is going away. Existing code using it should be migrated as soon as possible.
These examples should all work with both the old and new interface, with one caveat. With the old
interface, the CloudConfig object comes from the os-client-config library, and in the new
interface that has been moved into the SDK. In order to write code that works with both the old and new
interfaces, use the following code to import the config namespace:
try:
from openstack import config as occ
except ImportError:
from os_client_config import config as occ
The examples will assume that the config module has been imported in that manner.
Note: Yes, there is an easier and less verbose way to do all of these. These are verbose to handle both
the old and new interfaces in the same codebase.
Replacing authenticator
Replacing Profile
The right way to replace the use of openstack.profile.Profile depends a bit on what
youre trying to accomplish. Common patterns are listed below, but in general the approach is ei-
ther to pass a cloud name to the openstack.connection.Connection constructor, or to construct a open-
stack.config.cloud_region.CloudRegion object and pass it to the constructor.
All of the examples on this page assume that you want to support old and new interfaces simultane-
ously. There are easier and less verbose versions of each that are available if you can just make a clean
transition.
import openstack.connection
conn = connection.from_config(cloud_name='name-of-cloud-you-want')
If, on the other hand, you want to construct a openstack.connection.Connection, but are in a context
where reading config from a clouds.yaml file is undesirable, such as inside of a Service:
• create a openstack.config.loader.OpenStackConfig object, telling it to not load yaml files. Option-
ally pass an app_name and app_version which will be added to user-agent strings.
• get a openstack.config.cloud_region.CloudRegion object from it
• get a openstack.connection.Connection
try:
from openstack import config as occ
except ImportError:
from os_client_config import config as occ
from openstack import connection
loader = occ.OpenStackConfig(
load_yaml_files=False,
app_name='spectacular-app',
app_version='1.0')
cloud_region = loader.get_one_cloud(
region_name='my-awesome-region',
auth_type='password',
auth=dict(
auth_url='https://auth.example.com',
username='amazing-user',
user_domain_name='example-domain',
project_name='astounding-project',
user_project_name='example-domain',
password='super-secret-password',
))
conn = connection.from_config(cloud_config=cloud_region)
Note: app_name and app_version are completely optional, and auth_type defaults to password. They
are shown here for clarity as to where they should go if they want to be set.
If you want to make a connection from python arguments and want to allow one of them to optionally
be cloud to allow selection of a named cloud, its essentially the same as the previous example, except
without load_yaml_files=False.
try:
from openstack import config as occ
except ImportError:
from os_client_config import config as occ
from openstack import connection
loader = occ.OpenStackConfig(
app_name='spectacular-app',
app_version='1.0')
cloud_region = loader.get_one_cloud(
region_name='my-awesome-region',
auth_type='password',
auth=dict(
auth_url='https://auth.example.com',
username='amazing-user',
user_domain_name='example-domain',
project_name='astounding-project',
user_project_name='example-domain',
password='super-secret-password',
))
conn = connection.from_config(cloud_config=cloud_region)
Parameters to get_one_cloud
rameter for get_one_cloud. service_type is the key by which services are referred, so saying com-
pute_service_type=henry doesnt have any meaning.
Once you have a Connection instance, services are accessed through instances of Proxy or subclasses
of it that exist as attributes on the Connection.
Service Proxies
The following service proxies exist on the Connection. The service proxies are all always present on
the Connection object, but the combination of your CloudRegion and the catalog of the cloud in
question control which services can be used.
Accelerator API
Device Operations
devices(**query)
Retrieve a generator of devices.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the devices to be returned. Available parameters include: * hostname: The
hostname of the device. * type: The type of the device. * vendor: The vendor
ID of the device. * sort: A list of sorting keys separated by commas. Each
sorting key can optionally be attached with a sorting direction modifier which
can be asc or desc. * limit: Requests a specified size of returned items from
the query. Returns a number of items up to the specified limit value. * marker:
Specifies the ID of the last-seen item. Use the limit parameter to make an
initial limited request and use the ID of the last-seen item from the response as
the marker parameter value in a subsequent limited request.
Returns A generator of device instances.
get_device(uuid, fields=None)
Get a single device.
Parameters uuid The value can be the UUID of a device.
Returns One Device
Deployable Operations
deployables(**query)
Retrieve a generator of deployables.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the deployables to be returned.
Returns A generator of deployable instances.
get_deployable(uuid, fields=None)
Get a single deployable.
Parameters uuid The value can be the UUID of a deployable.
Returns One Deployable
Raises ResourceNotFound when no deployable matching the criteria could
be found.
update_deployable(uuid, patch)
Reconfig the FPGA with new bitstream.
Parameters
• uuid The value can be the UUID of a deployable
• patch The infomation of to reconfig.
Returns The results of FPGA reconfig.
device_profiles(**query)
Retrieve a generator of device profiles.
accelerator_requests(**query)
Retrieve a generator of accelerator requests.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the accelerator requests to be returned.
Returns A generator of accelerator request instances.
create_accelerator_request(**attrs)
Create an ARQs for a single device profile.
Parameters attrs (kwargs) request body.
delete_accelerator_request(name_or_id, ignore_missing=True)
Delete an device profile :param name_or_id: The value can be either the ID of an accelerator
request. :param bool ignore_missing: When set to False ResourceNotFound will be
raised when the device profile does not exist. When set to True, no exception will be set
when attempting to delete a nonexistent accelerator request. :returns: None
get_accelerator_request(uuid, fields=None)
Get a single accelerator request. :param uuid: The value can
be the UUID of a accelerator request. :returns: One :class:
~openstack.accelerator.v2.accelerator_request.AcceleratorRequest :raises:
ResourceNotFound when no accelerator request matching the criteria could be
found.
update_accelerator_request(uuid, properties)
Bind/Unbind an accelerator to VM. :param uuid: The uuid of the accelerator_request to be
binded/unbinded. :param properties: The info of VM that will bind/unbind the accelerator.
:returns: True if bind/unbind succeeded, False otherwise.
Baremetal API
The baremetal high-level interface is available through the baremetal member of a Connection
object. The baremetal member will only be added if the service is detected.
Node Operations
nodes(details=False, **query)
Retrieve a generator of nodes.
Parameters
• details A boolean indicating whether the detailed information for every
node should be returned.
• query (dict) Optional query parameters to be sent to restrict the nodes
returned. Available parameters include:
– associated: Only return those which are, or are not, associated with
an instance_id.
• node The value can be either the name or ID of a node or a Node instance.
• required List of interfaces that are required to pass validation. The de-
fault value is the list of minimum required interfaces for provisioning.
Returns dict mapping interface names to ValidationResult objects.
Raises ValidationException if validation fails for a required interface.
set_node_maintenance(node, reason=None)
Enable maintenance mode on the node.
Parameters
• node The value can be either the name or ID of a node or a Node instance.
• reason Optional reason for maintenance.
Returns This Node instance.
unset_node_maintenance(node)
Disable maintenance mode on the node.
Parameters node The value can be either the name or ID of a node or a Node
instance.
Returns This Node instance.
delete_node(node, ignore_missing=True)
Delete a node.
Parameters
• node The value can be either the name or ID of a node or a Node instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the node could not be found.
When set to True, no exception will be raised when attempting to delete a
non-existent node.
Returns The instance of the node which was deleted.
Return type Node.
Port Operations
ports(details=False, **query)
Retrieve a generator of ports.
Parameters
port_groups(details=False, **query)
Retrieve a generator of port groups.
Parameters
• details A boolean indicating whether the detailed information for every
port group should be returned.
• query (dict) Optional query parameters to be sent to restrict the port
groups returned. Available parameters include:
– address: Only return portgroups with the specified physical hardware
address, typically a MAC address.
– fields: A list containing one or more fields to be returned in the re-
sponse. This may lead to some performance gain because other fields of
the resource are not refreshed.
– limit: Requests at most the specified number of portgroups returned
from the query.
– marker: Specifies the ID of the last-seen portgroup. Use the limit
parameter to make an initial limited request and use the ID of the last-
seen portgroup from the response as the marker value in a subsequent
limited request.
– node:only return the ones associated with this specific node (name or
UUID), or an empty set if not found.
– sort_dir: Sorts the response by the requested sort direction. A valid
value is asc (ascending) or desc (descending). Default is asc. You
can specify multiple pairs of sort key and sort direction query parameters.
If you omit the sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the sort_key.
– sort_key: Sorts the response by the this attribute value. Default is
id. You can specify multiple pairs of sort key and sort direction query
parameters. If you omit the sort direction in a pair, the API uses the natural
sorting direction of the server attribute that is provided as the sort_key.
Returns A generator of port group instances.
create_port_group(**attrs)
Create a new portgroup from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
PortGroup.
Parameters
• port_group The value can be either the name or ID of a port group or a
PortGroup instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the port group could not be
found. When set to True, no exception will be raised when attempting to
delete a non-existent port group.
Returns The instance of the port group which was deleted.
Return type PortGroup.
Driver Operations
drivers(details=False)
Retrieve a generator of drivers.
Parameters details (bool) A boolean indicating whether the detailed infor-
mation for every driver should be returned.
Returns A generator of driver instances.
get_driver(driver)
Get a specific driver.
Parameters driver The value can be the name of a driver or a Driver in-
stance.
Returns One Driver
Raises ResourceNotFound when no driver matching the name could be found.
Chassis Operations
chassis(details=False, **query)
Retrieve a generator of chassis.
Parameters
• details A boolean indicating whether the detailed information for every
chassis should be returned.
• query (dict) Optional query parameters to be sent to restrict the chassis
to be returned. Available parameters include:
– fields: A list containing one or more fields to be returned in the re-
sponse. This may lead to some performance gain because other fields of
the resource are not refreshed.
– limit: Requests at most the specified number of items be returned from
the query.
– marker: Specifies the ID of the last-seen chassis. Use the limit pa-
rameter to make an initial limited request and use the ID of the last-seen
chassis from the response as the marker value in a subsequent limited
request.
– sort_dir: Sorts the response by the requested sort direction. A valid
value is asc (ascending) or desc (descending). Default is asc. You
can specify multiple pairs of sort key and sort direction query parameters.
If you omit the sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the sort_key.
– sort_key: Sorts the response by the this attribute value. Default is
id. You can specify multiple pairs of sort key and sort direction query
parameters. If you omit the sort direction in a pair, the API uses the natural
sorting direction of the server attribute that is provided as the sort_key.
Returns A generator of chassis instances.
create_chassis(**attrs)
Create a new chassis from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Chassis.
Returns The results of chassis creation.
Return type Chassis.
find_chassis(name_or_id, ignore_missing=True)
Find a single chassis.
Parameters
• name_or_id (str) The ID of a chassis.
• ignore_missing (bool) When set to False, an exception of
ResourceNotFound will be raised when the chassis does not exist.
When set to True‘, None will be returned when attempting to find a nonex-
istent chassis.
Returns One Chassis object or None.
get_chassis(chassis, fields=None)
Get a specific chassis.
Parameters
VIF Operations
Raises NotSupported if the server does not support the VIF API.
Allocation Operations
allocations(**query)
Retrieve a generator of allocations.
Parameters query (dict) Optional query parameters to be sent to restrict the
allocation to be returned. Available parameters include:
• fields: A list containing one or more fields to be returned in the response.
This may lead to some performance gain because other fields of the resource
are not refreshed.
• limit: Requests at most the specified number of items be returned from
the query.
• marker: Specifies the ID of the last-seen allocation. Use the limit pa-
rameter to make an initial limited request and use the ID of the last-seen
allocation from the response as the marker value in a subsequent limited
request.
• sort_dir: Sorts the response by the requested sort direction. A valid
value is asc (ascending) or desc (descending). Default is asc. You can
specify multiple pairs of sort key and sort direction query parameters. If you
omit the sort direction in a pair, the API uses the natural sorting direction of
the server attribute that is provided as the sort_key.
• sort_key: Sorts the response by the this attribute value. Default is id.
You can specify multiple pairs of sort key and sort direction query parame-
ters. If you omit the sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the sort_key.
Returns A generator of allocation instances.
create_allocation(**attrs)
Create a new allocation from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Allocation.
Returns The results of allocation creation.
Return type Allocation.
get_allocation(allocation, fields=None)
Get a specific allocation.
Parameters
• timeout How much (in seconds) to wait for the allocation. The value of
None (the default) means no client-side timeout.
• ignore_error If True, this call will raise an exception if the allocation
reaches the error state. Otherwise the error state is considered successful
and the call returns.
Returns The instance of the allocation.
Return type Allocation.
Raises ResourceFailure if allocation fails and ignore_error is False.
Raises ResourceTimeout on timeout.
volume_connectors(details=False, **query)
Retrieve a generator of volume_connector.
Parameters
• details A boolean indicating whether the detailed information for every
volume_connector should be returned.
• query (dict) Optional query parameters to be sent to restrict the vol-
ume_connectors returned. Available parameters include:
– fields: A list containing one or more fields to be returned in the re-
sponse. This may lead to some performance gain because other fields of
the resource are not refreshed.
– limit: Requests at most the specified number of volume_connector be
returned from the query.
– marker: Specifies the ID of the last-seen volume_connector. Use the
limit parameter to make an initial limited request and use the ID of the
last-seen volume_connector from the response as the marker value in
subsequent limited request.
– node:only return the ones associated with this specific node (name or
UUID), or an empty set if not found.
– sort_dir:Sorts the response by the requested sort direction. A valid
value is asc (ascending) or desc (descending). Default is asc. You
can specify multiple pairs of sort key and sort direction query parameters.
If you omit the sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the sort_key.
Parameters
• volume_connector The value can be the ID of a volume_connector or
a :class: ~openstack.baremetal.v1.volume_connector.VolumeConnector in-
stance.
• patch JSON patch to apply.
Returns The updated volume_connector.
Rtype::class ~openstack.baremetal.v1.volume_connector.VolumeConnector.
delete_volume_connector(volume_connector, ignore_missing=True)
Delete an volume_connector.
Parameters
• volume_connector The value can be either the ID of
a volume_connector.VolumeConnector or a :class: ~open-
stack.baremetal.v1.volume_connector.VolumeConnector instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the volume_connector could
not be found. When set to True, no exception will be raised when attempt-
ing to delete a non-existent volume_connector.
Returns The instance of the volume_connector which was deleted.
Rtype::class ~openstack.baremetal.v1.volume_connector.VolumeConnector.
volume_targets(details=False, **query)
Retrieve a generator of volume_target.
Parameters
• details A boolean indicating whether the detailed information for every
volume_target should be returned.
• query (dict) Optional query parameters to be sent to restrict the vol-
ume_targets returned. Available parameters include:
– fields: A list containing one or more fields to be returned in the re-
sponse. This may lead to some performance gain because other fields of
the resource are not refreshed.
– limit: Requests at most the specified number of volume_connector be
returned from the query.
update_volume_target(volume_target, **attrs)
Update a volume_target.
:param volume_target:Either the ID of a volume_target or an instance of :param dict at-
trs: The attributes to update on the volume_target represented by the volume_target
parameter.‘
Returns The updated volume_target.
Rtype::class ~openstack.baremetal.v1.volume_target.VolumeTarget.
patch_volume_target(volume_target, patch)
Apply a JSON patch to the volume_target.
Parameters
• volume_target The value can be the ID of a volume_target or a :class:
~openstack.baremetal.v1.volume_target.VolumeTarget instance.
• patch JSON patch to apply.
Returns The updated volume_target.
Rtype::class ~openstack.baremetal.v1.volume_target.VolumeTarget.
delete_volume_target(volume_target, ignore_missing=True)
Delete an volume_target.
Parameters
• volume_target The value can be either the ID
of a volume_target.VolumeTarget or a :class: ~open-
stack.baremetal.v1.volume_target.VolumeTarget instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the volume_target could not
be found. When set to True, no exception will be raised when attempting
to delete a non-existent volume_target.
Returns The instance of the volume_target which was deleted.
Rtype::class ~openstack.baremetal.v1.volume_target.VolumeTarget.
Utilities
Helpers for building configdrive compatible with the Bare Metal service.
class openstack.baremetal_introspection.v1._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
in-
fluxdb_config=None,
in-
fluxdb_client=None,
*args,
**kwargs)
introspections(**query)
Retrieve a generator of introspection records.
Parameters query (dict) Optional query parameters to be sent to restrict the
records to be returned. Available parameters include:
• fields: A list containing one or more fields to be returned in the response.
This may lead to some performance gain because other fields of the resource
are not refreshed.
• limit: Requests at most the specified number of items be returned from
the query.
• marker: Specifies the ID of the last-seen introspection. Use the limit
parameter to make an initial limited request and use the ID of the last-seen
introspection from the response as the marker value in a subsequent lim-
ited request.
• sort_dir: Sorts the response by the requested sort direction. A valid
value is asc (ascending) or desc (descending). Default is asc. You can
specify multiple pairs of sort key and sort direction query parameters. If you
omit the sort direction in a pair, the API uses the natural sorting direction of
the server attribute that is provided as the sort_key.
• sort_key: Sorts the response by the this attribute value. Default is id.
You can specify multiple pairs of sort key and sort direction query parame-
ters. If you omit the sort direction in a pair, the API uses the natural sorting
direction of the server attribute that is provided as the sort_key.
Returns A generator of Introspection objects
start_introspection(node, manage_boot=None)
Create a new introspection from attributes.
Parameters
• node The value can be either the name or ID of a node or a Node instance.
• manage_boot (bool) Whether to manage boot parameters for the node.
Defaults to the server default (which is True).
Returns Introspection instance.
get_introspection(introspection)
Get a specific introspection.
Parameters introspection The value can be the name or ID of an introspec-
tion (matching bare metal node name or ID) or an Introspection instance.
Returns Introspection instance.
Raises ResourceNotFound when no introspection matching the name or ID
could be found.
get_introspection_data(introspection, processed=True)
Get introspection data.
Parameters
• introspection The value can be the name or ID of an introspection
(matching bare metal node name or ID) or an Introspection instance.
• processed Whether to fetch the final processed data (the default) or the
raw unprocessed data as received from the ramdisk.
Returns introspection data from the most recent successful run.
Return type dict
abort_introspection(introspection, ignore_missing=True)
Abort an introspection.
Note that the introspection is not aborted immediately, you may use wait_for_introspection
with ignore_error=True.
Parameters
• introspection The value can be the name or ID of an introspection
(matching bare metal node name or ID) or an Introspection instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the introspection could not be
found. When set to True, no exception will be raised when attempting to
abort a non-existent introspection.
Returns nothing
wait_for_introspection(introspection, timeout=None, ignore_error=False)
Wait for the introspection to finish.
Parameters
• introspection The value can be the name or ID of an introspection
(matching bare metal node name or ID) or an Introspection instance.
• timeout How much (in seconds) to wait for the introspection. The value
of None (the default) means no client-side timeout.
• ignore_error If True, this call will raise an exception if the intro-
spection reaches the error state. Otherwise the error state is considered
successful and the call returns.
Returns Introspection instance.
Raises ResourceFailure if introspection fails and ignore_error is
False.
Raises ResourceTimeout on timeout.
For details on how to use block_storage, see Using OpenStack Block Storage
Volume Operations
class openstack.block_storage.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
get_volume(volume)
Get a single volume
Parameters volume The value can be the ID of a volume or a Volume instance.
Returns One Volume
Raises ResourceNotFound when no resource can be found.
volumes(details=True, **query)
Retrieve a generator of volumes
Parameters
• details (bool) When set to False no extended attributes will be re-
turned. The default, True, will cause objects with additional attributes to
be returned.
• query (kwargs) Optional query parameters to be sent to limit the vol-
umes being returned. Available parameters include:
Backup Operations
class openstack.block_storage.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
backups(details=True, **query)
Retrieve a generator of backups
Parameters
• details (bool) When set to False no additional details will be re-
turned. The default, True, will cause objects with additional attributes to
be returned.
• query (dict) Optional query parameters to be sent to limit the resources
being returned:
– offset: pagination marker
– limit: pagination limit
Type Operations
class openstack.block_storage.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
get_type(type)
Get a single type
Parameters type The value can be the ID of a type or a Type instance.
Returns One Type
Raises ResourceNotFound when no resource can be found.
types(**query)
Retrieve a generator of volume types
Returns A generator of volume type objects.
create_type(**attrs)
Create a new type from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Type, comprised of the properties on the Type class.
Returns The results of type creation
Return type Type
delete_type(type, ignore_missing=True)
Delete a type
Parameters
• type The value can be either the ID of a type or a Type instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the type does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent type.
Returns None
Snapshot Operations
class openstack.block_storage.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
get_snapshot(snapshot)
Get a single snapshot
Parameters snapshot The value can be the ID of a snapshot or a Snapshot
instance.
Returns One Snapshot
Raises ResourceNotFound when no resource can be found.
snapshots(details=True, **query)
Retrieve a generator of snapshots
Parameters
• details (bool) When set to False Snapshot objects will be re-
turned. The default, True, will cause SnapshotDetail objects to be
returned.
• query (kwargs) Optional query parameters to be sent to limit the snap-
shots being returned. Available parameters include:
– name: Name of the snapshot as a string.
– all_projects: Whether return the snapshots in all projects.
– volume_id: volume id of a snapshot.
– status: Value of the status of the snapshot so that you can filter on
available for example.
Returns A generator of snapshot objects.
create_snapshot(**attrs)
Create a new snapshot from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Snapshot, comprised of the properties on the Snapshot class.
Returns The results of snapshot creation
Return type Snapshot
delete_snapshot(snapshot, ignore_missing=True)
Delete a snapshot
Parameters
• snapshot The value can be either the ID of a snapshot or a Snapshot
instance.
Stats Operations
class openstack.block_storage.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
backend_pools()
Returns a generator of cinder Back-end storage pools
:returns A generator of cinder Back-end storage pools objects
Cluster API
The cluster high-level interface is available through the cluster member of a Connection object.
The cluster member will only be added if the service is detected.
get_build_info()
Get build info for service engine and API
Returns A dictionary containing the API and engine revision string.
profile_types(**query)
Get a generator of profile types.
Returns A generator of objects that are of type ProfileType
get_profile_type(profile_type)
Get the details about a profile type.
Parameters profile_type The name of the profile_type to retrieve or an ob-
ject of ProfileType.
Returns A ProfileType object.
Raises ResourceNotFound when no profile_type matching the name could be
found.
Profile Operations
create_profile(**attrs)
Create a new profile from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Profile, it is comprised of the properties on the Profile class.
Returns The results of profile creation.
Return type Profile.
delete_profile(profile, ignore_missing=True)
Delete a profile.
Parameters
• profile The value can be either the name or ID of a profile or a Profile
instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the profile could not be found.
policy_types(**query)
Get a generator of policy types.
Returns A generator of objects that are of type PolicyType
get_policy_type(policy_type)
Get the details about a policy type.
Parameters policy_type The name of a poicy_type or an object of
PolicyType.
Returns A PolicyType object.
Raises ResourceNotFound when no policy_type matching the name could be
found.
Policy Operations
create_policy(**attrs)
Create a new policy from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Policy, it is comprised of the properties on the Policy class.
Returns The results of policy creation.
Return type Policy.
delete_policy(policy, ignore_missing=True)
Delete a policy.
Parameters
• policy The value can be either the name or ID of a policy or a Policy
instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the policy could not be found.
When set to True, no exception will be raised when attempting to delete a
non-existent policy.
Returns None
find_policy(name_or_id, ignore_missing=True)
Find a single policy.
Parameters
• name_or_id (str) The name or ID of a policy.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the specified policy does not exist. When set to True,
None will be returned when attempting to find a nonexistent policy.
Returns A policy object or None.
Return type Policy
get_policy(policy)
Get a single policy.
Parameters policy The value can be the name or ID of a policy or a Policy
instance.
Returns A policy object.
Return type Policy
Raises ResourceNotFound when no policy matching the criteria could be
found.
policies(**query)
Retrieve a generator of policies.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the policies to be returned. Available parameters include:
• name: The name of a policy.
• type: The type name of a policy.
• sort: A list of sorting keys separated by commas. Each sorting key can
optionally be attached with a sorting direction modifier which can be asc
or desc.
• limit: Requests a specified size of returned items from the query. Re-
turns a number of items up to the specified limit value.
• marker: Specifies the ID of the last-seen item. Use the limit parameter
to make an initial limited request and use the ID of the last-seen item
from the response as the marker parameter value in a subsequent limited
request.
• global_project: A boolean value indicating whether policies from all
projects will be returned.
Returns A generator of policy instances.
update_policy(policy, **attrs)
Update a policy.
Parameters
• policy Either the name or the ID of a policy, or an instance of Policy.
• attrs The attributes to update on the policy represented by the value
parameter.
Returns The updated policy.
Return type Policy
validate_policy
Cluster Operations
create_cluster(**attrs)
Create a new cluster from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Cluster, it is comprised of the properties on the Cluster class.
Returns The results of cluster creation.
Return type Cluster.
delete_cluster(cluster, ignore_missing=True, force_delete=False)
Delete a cluster.
Parameters
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• count Optional parameter specifying the number of nodes to be added.
Returns A dict containing the action initiated by this operation.
scale_in_cluster(cluster, count=None)
Shrink the size of a cluster.
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• count Optional parameter specifying the number of nodes to be removed.
Returns A dict containing the action initiated by this operation.
resize_cluster(cluster, **params)
Resize of cluster.
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• params (dict) A dictionary providing the parameters for the resize ac-
tion.
Returns A dict containing the action initiated by this operation.
attach_policy_to_cluster(cluster, policy, **params)
Attach a policy to a cluster.
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• policy Either the name or the ID of a policy.
• params (dict) A dictionary containing the properties for the policy to be
attached.
Returns A dict containing the action initiated by this operation.
detach_policy_from_cluster(cluster, policy)
Detach a policy from a cluster.
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• policy Either the name or the ID of a policy.
Returns A dict containing the action initiated by this operation.
update_cluster_policy(cluster, policy, **params)
Change properties of a policy which is bound to the cluster.
Parameters
• cluster Either the name or the ID of the cluster, or an instance of
Cluster.
• policy Either the name or the ID of a policy.
• params (dict) A dictionary containing the new properties for the policy.
Returns A dict containing the action initiated by this operation.
collect_cluster_attrs(cluster, path)
Collect attribute values across a cluster.
Parameters
• cluster The value can be either the ID of a cluster or a Cluster in-
stance.
• path A Json path string specifying the attribute to collect.
Returns A dictionary containing the list of attribute values.
check_cluster(cluster, **params)
Check a cluster.
Parameters
• cluster The value can be either the ID of a cluster or a Cluster in-
stance.
• params (dict) A dictionary providing the parameters for the check ac-
tion.
Returns A dictionary containing the action ID.
recover_cluster(cluster, **params)
recover a cluster.
Parameters
• cluster The value can be either the ID of a cluster or a Cluster in-
stance.
• params (dict) A dictionary providing the parameters for the recover
action.
Returns A dictionary containing the action ID.
perform_operation_on_cluster(cluster, operation, **params)
Perform an operation on the specified cluster.
Parameters
• cluster The value can be either the ID of a cluster or a Cluster in-
stance.
• operation A string specifying the operation to be performed.
• params (dict) A dictionary providing the parameters for the operation.
Returns A dictionary containing the action ID.
cluster_policies(cluster, **query)
Retrieve a generator of cluster-policy bindings.
Parameters
• cluster The value can be the name or ID of a cluster or a Cluster
instance.
• query (kwargs) Optional query parameters to be sent to restrict the poli-
cies to be returned. Available parameters include:
– enabled: A boolean value indicating whether the policy is enabled on
the cluster.
Returns A generator of cluster-policy binding instances.
get_cluster_policy(cluster_policy, cluster)
Get a cluster-policy binding.
Parameters
• cluster_policy The value can be the name or ID of a policy or a
Policy instance.
• cluster The value can be the name or ID of a cluster or a Cluster
instance.
Returns a cluster-policy binding object.
Return type CLusterPolicy
Raises ResourceNotFound when no cluster-policy binding matching the cri-
teria could be found.
Node Operations
create_node(**attrs)
Create a new node from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Node, it is comprised of the properties on the Node class.
Returns The results of node creation.
Return type Node.
delete_node(node, ignore_missing=True, force_delete=False)
Delete a node.
Parameters
• node The value can be either the name or ID of a node or a Node instance.
Receiver Operations
create_receiver(**attrs)
Create a new receiver from attributes.
Parameters attrs (dict) Keyword arguments that will be used to create a
Receiver, it is comprised of the properties on the Receiver class.
Returns The results of receiver creation.
Return type Receiver.
update_receiver(receiver, **attrs)
Update a receiver.
Parameters
• receiver The value can be either the name or ID of a receiver or a
Receiver instance.
• attrs The attributes to update on the receiver parameter. Valid attribute
names include name, action and params.
Returns The updated receiver.
Return type Receiver
delete_receiver(receiver, ignore_missing=True)
Delete a receiver.
Parameters
• receiver The value can be either the name or ID of a receiver or a
Receiver instance.
• ignore_missing (bool) When set to False, an exception
ResourceNotFound will be raised when the receiver could not be found.
When set to True, no exception will be raised when attempting to delete a
non-existent receiver.
Returns None
find_receiver(name_or_id, ignore_missing=True)
Find a single receiver.
Parameters
• name_or_id (str) The name or ID of a receiver.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the specified receiver does not exist. When set to True,
None will be returned when attempting to find a nonexistent receiver.
Returns A receiver object or None.
Return type Receiver
get_receiver(receiver)
Get a single receiver.
Parameters receiver The value can be the name or ID of a receiver or a
Receiver instance.
Returns A receiver object.
Return type Receiver
Raises ResourceNotFound when no receiver matching the criteria could be
found.
receivers(**query)
Retrieve a generator of receivers.
Parameters query (kwargs) Optional query parameters for restricting the re-
ceivers to be returned. Available parameters include:
• name: The name of a receiver object.
• type: The type of receiver objects.
• cluster_id: The ID of the associated cluster.
• action: The name of the associated action.
• sort: A list of sorting keys separated by commas. Each sorting key can
optionally be attached with a sorting direction modifier which can be asc
or desc.
• global_project: A boolean value indicating whether receivers
Action Operations
get_action(action)
Get a single action.
Parameters action The value can be the name or ID of an action or a Action
instance.
Returns an action object.
Return type Action
Raises ResourceNotFound when no action matching the criteria could be
found.
actions(**query)
Retrieve a generator of actions.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the actions to be returned. Available parameters include:
• name: name of action for query.
• target: ID of the target object for which the actions should be returned.
• action: built-in action types for query.
• sort: A list of sorting keys separated by commas. Each sorting key can
optionally be attached with a sorting direction modifier which can be asc
or desc.
• limit: Requests a specified size of returned items from the query. Re-
turns a number of items up to the specified limit value.
• marker: Specifies the ID of the last-seen item. Use the limit parameter
to make an initial limited request and use the ID of the last-seen item
from the response as the marker parameter value in a subsequent limited
request.
Returns A generator of action instances.
Event Operations
get_event(event)
Get a single event.
Parameters event The value can be the name or ID of an event or a Event
instance.
Returns an event object.
Return type Event
Raises ResourceNotFound when no event matching the criteria could be
found.
events(**query)
Retrieve a generator of events.
Parameters query (kwargs) Optional query parameters to be sent to restrict
the events to be returned. Available parameters include:
• obj_name: name string of the object associated with an event.
• obj_type: type string of the object related to an event. The value can be
cluster, node, policy etc.
• obj_id: ID of the object associated with an event.
• cluster_id: ID of the cluster associated with the event, if any.
• action: name of the action associated with an event.
• sort: A list of sorting keys separated by commas. Each sorting key can
optionally be attached with a sorting direction modifier which can be asc
or desc.
• limit: Requests a specified size of returned items from the query. Re-
turns a number of items up to the specified limit value.
• marker: Specifies the ID of the last-seen item. Use the limit parameter
to make an initial limited request and use the ID of the last-seen item
from the response as the marker parameter value in a subsequent limited
request.
• global_project: A boolean specifying whether events from all projects
should be returned. This option is subject to access control checking.
Returns A generator of event instances.
Helper Operations
Service Operations
services(**query)
Get a generator of services.
Returns A generator of objects that are of type Service
Compute API
The compute high-level interface is available through the compute member of a Connection object.
The compute member will only be added if the service is detected.
Server Operations
create_server(**attrs)
Create a new server from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Server, comprised of the properties on the Server class.
Returns The results of server creation
Return type Server
delete_server(server, ignore_missing=True, force=False)
Delete a server
Parameters
• server The value can be either the ID of a server or a Server instance.
Network Actions
fetch_server_security_groups(server)
Fetch security groups with details for a server.
Parameters server Either the ID of a server or a Server instance.
Returns updated Server instance
add_security_group_to_server(server, security_group)
Add a security group to a server
Parameters
• server Either the ID of a server or a Server instance.
• security_group Either the ID, Name of a security group or a
SecurityGroup instance.
Returns None
remove_security_group_from_server(server, security_group)
Remove a security group from a server
Parameters
• server Either the ID of a server or a Server instance.
reboot_server(server, reboot_type)
Reboot a server
Parameters
• server Either the ID of a server or a Server instance.
• reboot_type (str) The type of reboot to perform. HARD and SOFT
are the current options.
Returns None
pause_server(server)
Pauses a server and changes its status to PAUSED.
Parameters server Either the ID of a server or a Server instance.
Returns None
unpause_server(server)
Unpauses a paused server and changes its status to ACTIVE.
Parameters server Either the ID of a server or a Server instance.
Returns None
suspend_server(server)
Suspends a server and changes its status to SUSPENDED.
Parameters server Either the ID of a server or a Server instance.
Returns None
resume_server(server)
Resumes a suspended server and changes its status to ACTIVE.
Parameters server Either the ID of a server or a Server instance.
Returns None
lock_server(server)
Locks a server.
Parameters server Either the ID of a server or a Server instance.
Returns None
unlock_server(server)
Unlocks a locked server.
Parameters server Either the ID of a server or a Server instance.
Returns None
rescue_server(server, admin_pass=None, image_ref=None)
Puts a server in rescue mode and changes it status to RESCUE.
Parameters
• server Either the ID of a server or a Server instance.
• admin_pass The password for the rescued server. If you omit this pa-
rameter, the operation generates a new password.
• image_ref The image reference to use to rescue your server. This can
be the image ID or its full URL. If you omit this parameter, the base image
reference will be used.
Returns None
unrescue_server(server)
Unrescues a server and changes its status to ACTIVE.
Parameters server Either the ID of a server or a Server instance.
Returns None
evacuate_server(server, host=None, admin_pass=None, force=None)
Evacuates a server from a failed host to a new host.
Parameters
• server Either the ID of a server or a Server instance.
• host An optional parameter specifying the name or ID of the host to which
the server is evacuated.
• admin_pass An optional parameter specifying the administrative pass-
word to access the evacuated or rebuilt server.
• force Force an evacuation by not verifying the provided destination host
by the scheduler. (New in API version 2.29).
Returns None
start_server(server)
Starts a stopped server and changes its state to ACTIVE.
Parameters server Either the ID of a server or a Server instance.
Returns None
stop_server(server)
Stops a running server and changes its state to SHUTOFF.
Parameters server Either the ID of a server or a Server instance.
Returns None
shelve_server(server)
Shelves a server.
All associated data and resources are kept but anything still in memory is not retained. Policy
defaults enable only users with administrative role or the owner of the server to perform this
operation. Cloud provides could change this permission though.
Modifying a Server
change_server_password(server, new_password)
Change the administrator password
Parameters
• server Either the ID of a server or a Server instance.
• new_password (str) The new password to be set.
Returns None
get_server_password(server)
Get the administrator password
Parameters server Either the ID of a server or a Server instance.
Returns encrypted password.
reset_server_state(server, state)
Reset the state of server
Parameters
• server The server can be either the ID of a server or a Server.
• state The state of the server to be set, active or error are valid.
Returns None
rebuild_server(server, name, admin_password, **attrs)
Rebuild a server
Parameters
• server Either the ID of a server or a Server instance.
• name (str) The name of the server
• admin_password (str) The administrator password
• preserve_ephemeral (bool) Indicates whether the server is rebuilt
with the preservation of the ephemeral partition. Default: False
• image (str) The id of an image to rebuild with. Default: None
• access_ipv4 (str) The IPv4 address to rebuild with. Default: None
• access_ipv6 (str) The IPv6 address to rebuild with. Default: None
• metadata (dict) A dictionary of metadata to rebuild with. Default:
None
Image Operations
delete_image(image, ignore_missing=True)
Delete an image
Parameters
• image The value can be either the ID of an image or a Image instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the image does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent image.
Returns None
find_image(name_or_id, ignore_missing=True)
Find a single image
Parameters
• name_or_id The name or ID of a image.
Flavor Operations
get_flavor_extra_specs_property(flavor, prop)
Get specific Extra Spec property of a flavor
Parameters
• flavor Either the ID of a flavor or a Flavor instance.
• prop (str) Property name.
Returns String value of the requested property.
update_flavor_extra_specs_property(flavor, prop, val)
Update specific Extra Spec property of a flavor
Parameters
• flavor Either the ID of a flavor or a Flavor instance.
• prop (str) Property name.
• val (str) Property value.
Returns String value of the requested property.
delete_flavor_extra_specs_property(flavor, prop)
Delete specific Extra Spec property of a flavor
Parameters
• flavor Either the ID of a flavor or a Flavor instance.
• prop (str) Property name.
Returns None
Service Operations
create_volume_attachment(server, **attrs)
Create a new volume attachment from attributes
Parameters
• server The server can be either the ID of a server or a Server instance.
• attrs (dict) Keyword arguments which will be used to create a
VolumeAttachment, comprised of the properties on the VolumeAttach-
ment class.
Returns The results of volume attachment creation
Return type VolumeAttachment
update_volume_attachment(volume_attachment, server, **attrs)
update a volume attachment
Parameters
Keypair Operations
create_keypair(**attrs)
Create a new keypair from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Keypair, comprised of the properties on the Keypair class.
Returns The results of keypair creation
Return type Keypair
delete_keypair(keypair, ignore_missing=True, user_id=None)
Delete a keypair
Parameters
• keypair The value can be either the ID of a keypair or a Keypair in-
stance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the keypair does not exist. When set to True, no ex-
ception will be set when attempting to delete a nonexistent keypair.
• user_id (str) Optional user_id owning the keypair
Returns None
get_keypair(keypair, user_id=None)
Get a single keypair
Parameters
• keypair The value can be the ID of a keypair or a Keypair instance.
• user_id (str) Optional user_id owning the keypair
Returns One Keypair
Raises ResourceNotFound when no resource can be found.
find_keypair(name_or_id, ignore_missing=True, user_id=None)
Find a single keypair
Parameters
• name_or_id The name or ID of a keypair.
Server IPs
server_ips(server, network_label=None)
Return a generator of server IPs
Parameters
• server The server can be either the ID of a server or a Server.
• network_label The name of a particular network to list IP addresses
from.
Returns A generator of ServerIP objects
Return type ServerIP
create_server_group(**attrs)
Create a new server group from attributes
create_server_interface(server, **attrs)
Create a new server interface from attributes
Parameters
• server The server can be either the ID of a server or a Server instance
that the interface belongs to.
• attrs (dict) Keyword arguments which will be used to create a
ServerInterface, comprised of the properties on the ServerInterface
class.
Returns The results of server interface creation
Return type ServerInterface
delete_server_interface(server_interface, server=None, ignore_missing=True)
Delete a server interface
Parameters
• server_interface The value can be either the ID of a server interface
or a ServerInterface instance.
• server This parameter need to be specified when ServerInterface ID is
given as value. It can be either the ID of a server or a Server instance that
the interface belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the server interface does not exist. When set to True,
no exception will be set when attempting to delete a nonexistent server in-
terface.
Returns None
get_server_interface(server_interface, server=None)
Get a single server interface
Parameters
• server_interface The value can be the ID of a server interface or a
ServerInterface instance.
• server This parameter need to be specified when ServerInterface ID is
given as value. It can be either the ID of a server or a Server instance that
the interface belongs to.
Returns One ServerInterface
Raises ResourceNotFound when no resource can be found.
server_interfaces(server)
Return a generator of server interfaces
Parameters server The server can be either the ID of a server or a Server.
Returns A generator of ServerInterface objects
Return type ServerInterface
availability_zones(details=False)
Return a generator of availability zones
Parameters details (bool) Return extra details about the availability zones.
This defaults to False as it generally requires extra permission.
Returns A generator of availability zone
Return type AvailabilityZone
Limits Operations
get_limits()
Retrieve limits that are applied to the projects account
Returns A Limits object, including both AbsoluteLimits and RateLimits
Return type Limits
Hypervisor Operations
hypervisors(details=False, **query)
Return a generator of hypervisor
Parameters
• details (bool) When set to the default, False, Hypervisor in-
stances will be returned with only basic information populated.
• query (kwargs) Optional query parameters to be sent to limit the re-
sources being returned.
Returns A generator of hypervisor
Return type class: ~openstack.compute.v2.hypervisor.Hypervisor
find_hypervisor(name_or_id, ignore_missing=True)
Find a hypervisor from name or id to get the corresponding info
Parameters name_or_id The name or id of a hypervisor
Returns One: class:~openstack.compute.v2.hypervisor.Hypervisor object or None
get_hypervisor(hypervisor)
Get a single hypervisor
Parameters hypervisor The value can be the ID of a hypervisor or a
Hypervisor instance.
Returns A Hypervisor object.
Raises ResourceNotFound when no resource can be found.
Extension Operations
find_extension(name_or_id, ignore_missing=True)
Find a single extension
Parameters
• name_or_id The name or ID of an extension.
Database API
The database high-level interface is available through the database member of a Connection ob-
ject. The database member will only be added if the service is detected.
Database Operations
create_database(instance, **attrs)
Create a new database from attributes
Parameters
• instance This can be either the ID of an instance or a Instance
• attrs (dict) Keyword arguments which will be used to create a
Database, comprised of the properties on the Database class.
Returns The results of server creation
Return type Database
delete_database(database, instance=None, ignore_missing=True)
Delete a database
Parameters
• database The value can be either the ID of a database or a Database
instance.
Flavor Operations
find_flavor(name_or_id, ignore_missing=True)
Find a single flavor
Parameters
• name_or_id The name or ID of a flavor.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Flavor or None
get_flavor(flavor)
Get a single flavor
Parameters flavor The value can be the ID of a flavor or a Flavor instance.
Returns One Flavor
Raises ResourceNotFound when no resource can be found.
flavors(**query)
Return a generator of flavors
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of flavor objects
Return type Flavor
Instance Operations
create_instance(**attrs)
Create a new instance from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Instance, comprised of the properties on the Instance class.
User Operations
create_user(instance, **attrs)
Create a new user from attributes
Parameters
• instance This can be either the ID of an instance or a Instance
• attrs (dict) Keyword arguments which will be used to create a User,
comprised of the properties on the User class.
Returns The results of server creation
Return type User
delete_user(user, instance=None, ignore_missing=True)
Delete a user
Parameters
• user The value can be either the ID of a user or a User instance.
• instance This parameter needs to be specified when an ID is given as
user. It can be either the ID of an instance or a Instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the user does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent user.
Returns None
find_user(name_or_id, instance, ignore_missing=True)
Find a single user
Parameters
• name_or_id The name or ID of a user.
• instance This can be either the ID of an instance or a Instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One User or None
users(instance, **query)
Return a generator of users
Parameters
• instance This can be either the ID of an instance or a Instance
DNS API
The dns high-level interface is available through the dns member of a Connection object. The dns
member will only be added if the service is detected.
zones(**query)
Retrieve a generator of zones
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
• name: Zone Name field.
• type: Zone Type field.
• email: Zone email field.
• status: Status of the zone.
• ttl: TTL field filter.abs
• description: Zone description field filter.
Recordset Operations
recordsets(zone=None, **query)
Retrieve a generator of recordsets
Parameters
• zone The optional value can be the ID of a zone or a Zone instance. If it
is not given all recordsets for all zones of the tenant would be retrieved
• query (dict) Optional query parameters to be sent to limit the resources
being returned.
– name: Recordset Name field.
– type: Type field.
– status: Status of the recordset.
– ttl: TTL field filter.
– description: Recordset description field filter.
Returns A generator of zone (Recordset) instances
create_recordset(zone, **attrs)
Create a new recordset in the zone
Parameters
• zone The value can be the ID of a zone or a Zone instance.
• attrs (dict) Keyword arguments which will be used to create a
Recordset, comprised of the properties on the Recordset class.
Returns The results of zone creation
Return type Recordset
update_recordset(recordset, **attrs)
Update Recordset attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Recordset, comprised of the properties on the Recordset class.
Returns The results of zone creation
Return type Recordset
get_recordset(recordset, zone)
Get a recordset
Parameters
• zone The value can be the ID of a zone or a Zone instance.
zone_imports(**query)
Retrieve a generator of zone imports
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
• zone_id: Zone I field.
• message: Message field.
• status: Status of the zone import record.
Returns A generator of zone ZoneImport instances.
create_zone_import(**attrs)
Create a new zone import from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
ZoneImport, comprised of the properties on the ZoneImport class.
Returns The results of zone creation.
Return type ZoneImport
get_zone_import(zone_import)
Get a zone import record
zone_exports(**query)
Retrieve a generator of zone exports
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
• zone_id: Zone I field.
• message: Message field.
• status: Status of the zone import record.
Returns A generator of zone ZoneExport instances.
create_zone_export(zone, **attrs)
Create a new zone export from attributes
Parameters
• zone The value can be the ID of a zone to be exported or a ZoneExport
instance.
• attrs (dict) Keyword arguments which will be used to create a
ZoneExport, comprised of the properties on the ZoneExport class.
Returns The results of zone creation.
Return type ZoneExport
get_zone_export(zone_export)
Get a zone export record
Parameters zone The value can be the ID of a zone import or a ZoneExport
instance.
Returns ZoneExport instance.
Return type ZoneExport
get_zone_export_text(zone_export)
Get a zone export record as text
Parameters zone The value can be the ID of a zone import or a ZoneExport
instance.
Returns ZoneExport instance.
Return type ZoneExport
delete_zone_export(zone_export, ignore_missing=True)
Delete a zone export
Parameters
• zone_export The value can be the ID of a zone import or a
ZoneExport instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the zone does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent zone.
Returns None
FloatingIP Operations
floating_ips(**query)
Retrieve a generator of recordsets
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
• name: Recordset Name field.
• type: Type field.
• status: Status of the recordset.
• ttl: TTL field filter.
• description: Recordset description field filter.
Returns A generator of floatingips (FloatingIP) instances
get_floating_ip(floating_ip)
Get a Floating IP
Parameters floating_ip The value can be the ID of a floating ip or a
FloatingIP instance. The ID is in format region_name:floatingip_id
Returns FloatingIP instance.
Return type FloatingIP
update_floating_ip(floating_ip, **attrs)
Update floating ip attributes
Parameters
• floating_ip The id or an instance of FloatingIP.
• attrs (dict) attributes for update on FloatingIP.
Return type FloatingIP
zone_transfer_requests(**query)
Retrieve a generator of zone transfer requests
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
• status: Status of the recordset.
Returns A generator of transfer requests (ZoneTransferRequest) instances
get_zone_transfer_request(request)
Get a ZoneTransfer Request info
Parameters request The value can be the ID of a transfer request or a
ZoneTransferRequest instance.
Returns Zone transfer request instance.
Return type ZoneTransferRequest
create_zone_transfer_request(zone, **attrs)
Create a new ZoneTransfer Request from attributes
Parameters
• zone The value can be the ID of a zone to be transferred or a
ZoneExport instance.
Identity API v2
The identity high-level interface is available through the identity member of a Connection object.
The identity member will only be added if the service is detected.
Extension Operations
extensions()
Retrieve a generator of extensions
Returns A generator of extension instances.
Return type Extension
get_extension(extension)
Get a single extension
Parameters extension The value can be the ID of an extension or a
Extension instance.
Returns One Extension
Raises ResourceNotFound when no extension can be found.
User Operations
create_user(**attrs)
Create a new user from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
User, comprised of the properties on the User class.
Returns The results of user creation
Role Operations
create_role(**attrs)
Create a new role from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Role, comprised of the properties on the Role class.
Returns The results of role creation
Return type Role
delete_role(role, ignore_missing=True)
Delete a role
Parameters
• role The value can be either the ID of a role or a Role instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the role does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent role.
Returns None
find_role(name_or_id, ignore_missing=True)
Find a single role
Parameters
• name_or_id The name or ID of a role.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Role or None
get_role(role)
Get a single role
Parameters role The value can be the ID of a role or a Role instance.
Returns One Role
Raises ResourceNotFound when no resource can be found.
roles(**query)
Retrieve a generator of roles
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Tenant Operations
create_tenant(**attrs)
Create a new tenant from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Tenant, comprised of the properties on the Tenant class.
Returns The results of tenant creation
Return type Tenant
delete_tenant(tenant, ignore_missing=True)
Delete a tenant
Parameters
• tenant The value can be either the ID of a tenant or a Tenant instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the tenant does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent tenant.
Returns None
find_tenant(name_or_id, ignore_missing=True)
Find a single tenant
Parameters
• name_or_id The name or ID of a tenant.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Tenant or None
get_tenant(tenant)
Get a single tenant
Parameters tenant The value can be the ID of a tenant or a Tenant instance.
Returns One Tenant
Raises ResourceNotFound when no resource can be found.
tenants(**query)
Retrieve a generator of tenants
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of tenant instances.
Return type Tenant
update_tenant(tenant, **attrs)
Update a tenant
Parameters tenant Either the ID of a tenant or a Tenant instance.
Attrs kwargs The attributes to update on the tenant represented by value.
Returns The updated tenant
Return type Tenant
Identity API v3
The identity high-level interface is available through the identity member of a Connection object.
The identity member will only be added if the service is detected.
Credential Operations
create_credential(**attrs)
Create a new credential from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Credential, comprised of the properties on the Credential class.
Returns The results of credential creation
Domain Operations
create_domain(**attrs)
Create a new domain from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Domain, comprised of the properties on the Domain class.
Returns The results of domain creation
Return type Domain
delete_domain(domain, ignore_missing=True)
Delete a domain
Parameters
• domain The value can be either the ID of a domain or a Domain instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the domain does not exist. When set to True, no ex-
ception will be set when attempting to delete a nonexistent domain.
Returns None
find_domain(name_or_id, ignore_missing=True)
Find a single domain
Parameters
• name_or_id The name or ID of a domain.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Domain or None
get_domain(domain)
Get a single domain
Parameters domain The value can be the ID of a domain or a Domain instance.
Returns One Domain
Raises ResourceNotFound when no resource can be found.
domains(**query)
Retrieve a generator of domains
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Endpoint Operations
create_endpoint(**attrs)
Create a new endpoint from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Endpoint, comprised of the properties on the Endpoint class.
Returns The results of endpoint creation
Return type Endpoint
delete_endpoint(endpoint, ignore_missing=True)
Delete an endpoint
Parameters
• endpoint The value can be either the ID of an endpoint or a Endpoint
instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the endpoint does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent endpoint.
Returns None
find_endpoint(name_or_id, ignore_missing=True)
Find a single endpoint
Parameters
• name_or_id The name or ID of a endpoint.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Group Operations
create_group(**attrs)
Create a new group from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Group, comprised of the properties on the Group class.
Returns The results of group creation
Return type Group
delete_group(group, ignore_missing=True)
Delete a group
Parameters
• group The value can be either the ID of a group or a Group instance.
Policy Operations
create_policy(**attrs)
Create a new policy from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Policy, comprised of the properties on the Policy class.
Returns The results of policy creation
Return type Policy
delete_policy(policy, ignore_missing=True)
Delete a policy
Parameters
• policy The value can be either the ID of a policy or a Policy instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the policy does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent policy.
Returns None
find_policy(name_or_id, ignore_missing=True)
Find a single policy
Parameters
• name_or_id The name or ID of a policy.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Policy or None
get_policy(policy)
Get a single policy
Parameters policy The value can be the ID of a policy or a Policy instance.
Returns One Policy
Raises ResourceNotFound when no resource can be found.
policies(**query)
Retrieve a generator of policies
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of policy instances.
Return type Policy
update_policy(policy, **attrs)
Update a policy
Parameters policy Either the ID of a policy or a Policy instance.
Attrs kwargs The attributes to update on the policy represented by value.
Returns The updated policy
Project Operations
create_project(**attrs)
Create a new project from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Project, comprised of the properties on the Project class.
Returns The results of project creation
Return type Project
delete_project(project, ignore_missing=True)
Delete a project
Parameters
• project The value can be either the ID of a project or a Project in-
stance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the project does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent project.
Returns None
find_project(name_or_id, ignore_missing=True, **attrs)
Find a single project
Parameters
• name_or_id The name or ID of a project.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Project or None
get_project(project)
Get a single project
Parameters project The value can be the ID of a project or a Project in-
stance.
Returns One Project
Raises ResourceNotFound when no resource can be found.
projects(**query)
Retrieve a generator of projects
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of project instances.
Return type Project
update_project(project, **attrs)
Update a project
Parameters project Either the ID of a project or a Project instance.
Attrs kwargs The attributes to update on the project represented by value.
Returns The updated project
Return type Project
Region Operations
create_region(**attrs)
Create a new region from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Region, comprised of the properties on the Region class.
Returns The results of region creation.
Return type Region
delete_region(region, ignore_missing=True)
Delete a region
Parameters
• region The value can be either the ID of a region or a Region instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the region does not exist. When set to True, no excep-
tion will be thrown when attempting to delete a nonexistent region.
Returns None
find_region(name_or_id, ignore_missing=True)
Find a single region
Parameters
• name_or_id The name or ID of a region.
Role Operations
create_role(**attrs)
Create a new role from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Role, comprised of the properties on the Role class.
Returns The results of role creation.
Return type Role
delete_role(role, ignore_missing=True)
Delete a role
Parameters
Service Operations
create_service(**attrs)
Create a new service from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Service, comprised of the properties on the Service class.
Returns The results of service creation
Return type Service
delete_service(service, ignore_missing=True)
Delete a service
Parameters
• service The value can be either the ID of a service or a Service in-
stance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the service does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent service.
Returns None
find_service(name_or_id, ignore_missing=True)
Find a single service
Parameters
• name_or_id The name or ID of a service.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Service or None
get_service(service)
Get a single service
Parameters service The value can be the ID of a service or a Service in-
stance.
Returns One Service
Raises ResourceNotFound when no resource can be found.
services(**query)
Retrieve a generator of services
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of service instances.
Return type Service
update_service(service, **attrs)
Update a service
Parameters service Either the ID of a service or a Service instance.
Attrs kwargs The attributes to update on the service represented by value.
Trust Operations
create_trust(**attrs)
Create a new trust from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Trust, comprised of the properties on the Trust class.
Returns The results of trust creation
Return type Trust
delete_trust(trust, ignore_missing=True)
Delete a trust
Parameters
• trust The value can be either the ID of a trust or a Trust instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the credential does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent credential.
Returns None
find_trust(name_or_id, ignore_missing=True)
Find a single trust
Parameters
• name_or_id The name or ID of a trust.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Trust or None
get_trust(trust)
Get a single trust
Parameters trust The value can be the ID of a trust or a Trust instance.
Returns One Trust
Raises ResourceNotFound when no resource can be found.
trusts(**query)
Retrieve a generator of trusts
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of trust instances.
Return type Trust
User Operations
user_projects(user, **query)
Retrieve a generator of projects to which the user has authorization to access.
Parameters
• user Either the user id or an instance of User
• query (kwargs) Optional query parameters to be sent to limit the re-
sources being returned.
Returns A generator of project instances.
Return type UserProject
create_user(**attrs)
Create a new user from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
User, comprised of the properties on the User class.
Returns The results of user creation
Return type User
delete_user(user, ignore_missing=True)
Delete a user
Parameters
• user The value can be either the ID of a user or a User instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the user does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent user.
Returns None
find_user(name_or_id, ignore_missing=True, **attrs)
Find a single user
Parameters
• name_or_id The name or ID of a user.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One User or None
get_user(user)
Get a single user
Parameters user The value can be the ID of a user or a User instance.
Returns One User
Raises ResourceNotFound when no resource can be found.
users(**query)
Retrieve a generator of users
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of user instances.
Return type User
update_user(user, **attrs)
Update a user
Parameters user Either the ID of a user or a User instance.
Attrs kwargs The attributes to update on the user represented by value.
Returns The updated user
Return type User
Image API v1
The image high-level interface is available through the image member of a Connection object. The
image member will only be added if the service is detected.
class openstack.image.v1._proxy.Proxy(session, statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args, **kwargs)
upload_image(**attrs)
Upload a new image from attributes
Image API v2
The image high-level interface is available through the image member of a Connection object. The
image member will only be added if the service is detected.
Image Operations
Returns When output is not given - the bytes comprising the given Image when
stream is False, otherwise a requests.Response instance. When output
is given - a Image instance.
delete_image(image, ignore_missing=True)
Delete an image
Parameters
• image The value can be either the ID of an image or a Image instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the image does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent image.
Returns None
find_image(name_or_id, ignore_missing=True)
Find a single image
Parameters
• name_or_id The name or ID of a image.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Image or None
get_image(image)
Get a single image
Parameters image The value can be the ID of a image or a Image instance.
Returns One Image
Raises ResourceNotFound when no resource can be found.
images(**query)
Return a generator of images
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of image objects
Return type Image
update_image(image, **attrs)
Update a image
Parameters image Either the ID of a image or a Image instance.
Attrs kwargs The attributes to update on the image represented by value.
Returns The updated image
Return type Image
deactivate_image(image)
Deactivate an image
Parameters image Either the ID of a image or a Image instance.
Returns None
reactivate_image(image)
Deactivate an image
Parameters image Either the ID of a image or a Image instance.
Returns None
add_tag(image, tag)
Add a tag to an image
Parameters
• image The value can be the ID of a image or a Image instance that the
member will be created for.
• tag (str) The tag to be added
Returns None
remove_tag(image, tag)
Remove a tag to an image
Parameters
• image The value can be the ID of a image or a Image instance that the
member will be created for.
• tag (str) The tag to be removed
Returns None
create_image(name, filename=None, container=None, md5=None,
sha256=None, disk_format=None, container_format=None,
disable_vendor_agent=True, allow_duplicates=False,
meta=None, wait=False, timeout=3600, data=None, val-
idate_checksum=False, use_import=False, stores=None,
all_stores=None, all_stores_must_succeed=None, **kwargs)
Upload an image.
Parameters
• name (str) Name of the image to create. If it is a pathname of an image,
the name will be constructed from the extensionless basename of the path.
• filename (str) The path to the file to upload, if needed. (optional,
defaults to None)
• data Image data (string or file-like object). It is mutually exclusive with
filename
• container (str) Name of the container in swift where images should
be uploaded for import if the cloud requires such a thing. (optional, defaults
to images)
• md5 (str) md5 sum of the image file. If not given, an md5 will be calcu-
lated.
• sha256 (str) sha256 sum of the image file. If not given, an md5 will be
calculated.
• disk_format (str) The disk format the image is in. (optional, defaults
to the os-client-config config value for this cloud)
• container_format (str) The container format the image is in. (op-
tional, defaults to the os-client-config config value for this cloud)
• disable_vendor_agent (bool) Whether or not to append metadata
flags to the image to inform the cloud in question to not expect a vendor
agent to be runing. (optional, defaults to True)
• allow_duplicates If true, skips checks that enforce unique image
name. (optional, defaults to False)
• meta A dict of key/value pairs to use for metadata that bypasses automatic
type conversion.
• wait (bool) If true, waits for image to be created. Defaults to true -
however, be aware that one of the upload methods is always synchronous.
• timeout Seconds to wait for image creation. None is forever.
• validate_checksum (bool) If true and cloud returns checksum, com-
pares return value with the one calculated or passed into this call. If value
does not match - raises exception. Default is false
• use_import (bool) Use the interoperable image import mechanism to
import the image. This defaults to false because it is harder on the target
cloud so should only be used when needed, such as when the user needs the
cloud to transform image format. If the cloud has disabled direct uploads,
this will default to true.
• stores List of stores to be used when enabled_backends is activated in
glance. List values can be the id of a store or a Store instance. Implies
use_import equals True.
• all_stores Upload to all available stores. Mutually exclusive with
store and stores. Implies use_import equals True.
• all_stores_must_succeed When set to True, if an error occurs dur-
ing the upload in at least one store, the worfklow fails, the data is deleted
from stores where copying is done (not staging), and the state of the image
is unchanged. When set to False, the workflow will fail (data deleted from
stores, ) only if the import fails on all stores specified by the user. In case of a
partial success, the locations added to the image will be the stores where the
data has been correctly uploaded. Default is True. Implies use_import
equals True.
Additional kwargs will be passed to the image creation as additional metadata for the im-
age and will have all values converted to string except for min_disk, min_ram, size and
virtual_size which will be converted to int.
If you are sure you have all of your data types correct or have an advanced need to be explicit,
use meta. If you are just a normal consumer, using kwargs is likely the right choice.
If a value is in meta and kwargs, meta wins.
Returns A munch.Munch of the Image object
Raises SDKException if there are problems uploading
Member Operations
add_member(image, **attrs)
Create a new member from attributes
Parameters
• image The value can be the ID of a image or a Image instance that the
member will be created for.
• attrs (dict) Keyword arguments which will be used to create a
Member, comprised of the properties on the Member class.
Returns The results of member creation
Return type Member
remove_member(member, image, ignore_missing=True)
Delete a member
Parameters
• member The value can be either the ID of a member or a Member instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the member does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent member.
Returns None
find_member(name_or_id, image, ignore_missing=True)
Find a single member
Parameters
• name_or_id The name or ID of a member.
• image This is the image that the member belongs to, the value can be the
ID of a image or a Image instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Member or None
get_member(member, image)
Get a single member on an image
Parameters
• member The value can be the ID of a member or a Member instance.
• image This is the image that the member belongs to. The value can be the
ID of a image or a Image instance.
Returns One Member
Raises ResourceNotFound when no resource can be found.
members(image)
Return a generator of members
Parameters image This is the image that the member belongs to, the value can
be the ID of a image or a Image instance.
Returns A generator of member objects
Return type Member
update_member(member, image, **attrs)
Update the member of an image
Parameters
• member Either the ID of a member or a Member instance.
• image This is the image that the member belongs to. The value can be the
ID of a image or a Image instance.
Attrs kwargs The attributes to update on the member represented by value.
Returns The updated member
Return type Member
Task Operations
tasks(**query)
Return a generator of tasks
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of task objects
Return type Task
get_task(task)
Get task details
Parameters task The value can be the ID of a task or a Task instance.
Returns One Task
Raises ResourceNotFound when no resource can be found.
create_task(**attrs)
Create a new task from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Task, comprised of the properties on the Task class.
Returns The results of task creation
Return type Task
wait_for_task(task, status=’success’, failures=None, interval=2, wait=120)
Wait for a task to be in a particular status.
Parameters
• task The resource to wait on to reach the specified status. The resource
must have a status attribute.
• status Desired status.
• failures (list) Statuses that would be interpreted as failures.
• interval Number of seconds to wait before to consecutive checks. De-
fault to 2.
• wait Maximum number of seconds to wait before the change. Default to
120.
Returns The resource is returned on success.
Raises ResourceTimeout if transition to the desired status failed to occur in
specified seconds.
Raises ResourceFailure if the resource has transited to one of the failure
statuses.
Raises AttributeError if the resource does not have a status attribute.
Schema Operations
get_images_schema()
Get images schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
get_image_schema()
Get single image schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
get_members_schema()
Get image members schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
get_member_schema()
Get image member schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
get_tasks_schema()
Get image tasks schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
get_task_schema()
Get image task schema
Returns One Schema
Raises ResourceNotFound when no resource can be found.
stores(**query)
Return a generator of supported image stores
Returns A generator of store objects
Return type Store
get_import_info()
Get a info about image constraints
Returns One Import
Raises ResourceNotFound when no resource can be found.
KeyManager API
For details on how to use key_management, see Using OpenStack Key Manager
Secret Operations
create_secret(**attrs)
Create a new secret from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Secret, comprised of the properties on the Order class.
Returns The results of secret creation
Return type Secret
delete_secret(secret, ignore_missing=True)
Delete a secret
Parameters
• secret The value can be either the ID of a secret or a Secret instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the secret does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent secret.
Returns None
find_secret(name_or_id, ignore_missing=True)
Find a single secret
Parameters
• name_or_id The name or ID of a secret.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Secret or None
get_secret(secret)
Get a single secret
Parameters secret The value can be the ID of a secret or a Secret instance.
Returns One Secret
Raises ResourceNotFound when no resource can be found.
secrets(**query)
Return a generator of secrets
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of secret objects
Return type Secret
update_secret(secret, **attrs)
Update a secret
Parameters secret Either the id of a secret or a Secret instance.
Attrs kwargs The attributes to update on the secret represented by value.
Returns The updated secret
Return type Secret
Container Operations
create_container(**attrs)
Create a new container from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Container, comprised of the properties on the Container class.
Returns The results of container creation
Return type Container
delete_container(container, ignore_missing=True)
Delete a container
Parameters
• container The value can be either the ID of a container or a
Container instance.
Order Operations
create_order(**attrs)
Create a new order from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Order, comprised of the properties on the Order class.
Returns The results of order creation
Return type Order
delete_order(order, ignore_missing=True)
Delete an order
Parameters
• order The value can be either the ID of a order or a Order instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the order does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent order.
Returns None
find_order(name_or_id, ignore_missing=True)
Find a single order
Parameters
• name_or_id The name or ID of a order.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Order or None
get_order(order)
Get a single order
Parameters order The value can be the ID of an order or a Order instance.
Returns One Order
Raises ResourceNotFound when no resource can be found.
orders(**query)
Return a generator of orders
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of order objects
Return type Order
update_order(order, **attrs)
Update a order
Parameters order Either the id of a order or a Order instance.
Attrs kwargs The attributes to update on the order represented by value.
Returns The updated order
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_load_balancer(**attrs)
Create a new load balancer from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
LoadBalancer, comprised of the properties on the LoadBalancer class.
Returns The results of load balancer creation
Return type LoadBalancer
get_load_balancer(*attrs)
Get a load balancer
Parameters load_balancer The value can be the name of a load balancer or
LoadBalancer instance.
Returns One LoadBalancer
get_load_balancer_statistics(name_or_id)
Get the load balancer statistics
Parameters name_or_id The name or ID of a load balancer
Returns One LoadBalancerStats
load_balancers(**query)
Retrieve a generator of load balancers
Returns A generator of load balancer instances
delete_load_balancer(load_balancer, ignore_missing=True, cascade=False)
Delete a load balancer
Parameters
Listener Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_listener(**attrs)
Create a new listener from attributes
update_listener(listener, **attrs)
Update a listener
Parameters
• listener Either the id of a listener or a Listener instance.
• attrs (dict) The attributes to update on the listener represented by
listener.
Returns The updated listener
Return type Listener
Pool Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_pool(**attrs)
Create a new pool from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Pool, comprised of the properties on the Pool class.
Returns The results of Pool creation
Return type Pool
get_pool(*attrs)
Get a pool
Parameters pool Value is Pool instance.
Returns One Pool
pools(**query)
Retrieve a generator of pools
Returns A generator of Pool instances
delete_pool(pool, ignore_missing=True)
Delete a pool
Parameters
• pool The pool is a Pool instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the pool does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent pool.
Returns None
find_pool(name_or_id, ignore_missing=True)
Find a single pool
Parameters
• name_or_id The name or ID of a pool
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the pool does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent pool.
Returns None
update_pool(pool, **attrs)
Update a pool
Parameters
• pool Either the id of a pool or a Pool instance.
• attrs (dict) The attributes to update on the pool represented by pool.
Returns The updated pool
Return type Pool
Member Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_member(pool, **attrs)
Create a new member from attributes
Parameters
• pool The pool can be either the ID of a pool or a Pool instance that the
member will be created in.
• attrs (dict) Keyword arguments which will be used to create a
Member, comprised of the properties on the Member class.
Returns The results of member creation
Return type Member
delete_member(member, pool, ignore_missing=True)
Delete a member
Parameters
• member The member can be either the ID of a member or a Member
instance.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the member does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent member.
Returns None
find_member(name_or_id, pool, ignore_missing=True)
Find a single member
Parameters
• name_or_id (str) The name or ID of a member.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One Member or None
get_member(member, pool)
Get a single member
Parameters
• member The member can be the ID of a member or a Member instance.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
Returns One Member
Raises ResourceNotFound when no resource can be found.
members(pool, **query)
Return a generator of members
Parameters
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• query (dict) Optional query parameters to be sent to limit the resources
being returned. Valid parameters are:
Returns A generator of member objects
Return type Member
update_member(member, pool, **attrs)
Update a member
Parameters
• member Either the ID of a member or a Member instance.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
find_health_monitor(name_or_id, ignore_missing=True)
Find a single health monitor
Parameters
• name_or_id The name or ID of a health monitor
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the health monitor does not exist. When set to True, no
exception will be set when attempting to find a nonexistent health monitor.
Returns The openstack.load_balancer.v2.healthmonitor.
HealthMonitor object matching the given name or id or None if nothing
matches.
Raises openstack.exceptions.DuplicateResource if more than one
resource is found for this request.
Raises openstack.exceptions.ResourceNotFound if nothing is found
and ignore_missing is False.
create_health_monitor(**attrs)
Create a new health monitor from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
HealthMonitor, comprised of the properties on the HealthMonitor class.
Returns The results of HealthMonitor creation
Return type HealthMonitor
get_health_monitor(healthmonitor)
Get a health monitor
Parameters healthmonitor The value can be the ID of a health monitor or
HealthMonitor instance.
Returns One health monitor
Return type HealthMonitor
health_monitors(**query)
Retrieve a generator of health monitors
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned. Valid parameters are: name, created_at, updated_at,
delay, expected_codes, http_method, max_retries, max_retries_down, pool_id,
provisioning_status, operating_status, timeout, project_id, type, url_path,
is_admin_state_up.
Returns A generator of health monitor instances
delete_health_monitor(healthmonitor, ignore_missing=True)
Delete a health monitor
Parameters
• healthmonitor The healthmonitor can be either the ID of the health
monitor or a HealthMonitor instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the healthmonitor does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent healthmonitor.
Returns None
update_health_monitor(healthmonitor, **attrs)
Update a health monitor
Parameters
• healthmonitor The healthmonitor can be either the ID of the health
monitor or a HealthMonitor instance
• attrs (dict) The attributes to update on the health monitor represented
by healthmonitor.
Returns The updated health monitor
Return type HealthMonitor
L7 Policy Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_l7_policy(**attrs)
Create a new l7policy from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
L7Policy, comprised of the properties on the L7Policy class.
Returns The results of l7policy creation
L7 Rule Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_l7_rule(l7_policy, **attrs)
Create a new l7rule from attributes
Parameters
• l7_policy The l7_policy can be either the ID of a l7policy or
L7Policy instance that the l7rule will be created in.
• attrs (dict) Keyword arguments which will be used to create a
L7Rule, comprised of the properties on the L7Rule class.
Returns The results of l7rule creation
Return type L7Rule
delete_l7_rule(l7rule, l7_policy, ignore_missing=True)
Delete a l7rule
Parameters
• l7rule The l7rule can be either the ID of a l7rule or a L7Rule instance.
• l7_policy The l7_policy can be either the ID of a l7policy or
L7Policy instance that the l7rule belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the l7rule does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent l7rule.
Returns None
find_l7_rule(name_or_id, l7_policy, ignore_missing=True)
Find a single l7rule
Parameters
• name_or_id (str) The name or ID of a l7rule.
• l7_policy The l7_policy can be either the ID of a l7policy or
L7Policy instance that the l7rule belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
Returns One L7Rule or None
get_l7_rule(l7rule, l7_policy)
Get a single l7rule
Parameters
• l7rule The l7rule can be the ID of a l7rule or a L7Rule instance.
• l7_policy The l7_policy can be either the ID of a l7policy or
L7Policy instance that the l7rule belongs to.
Returns One L7Rule
Raises ResourceNotFound when no resource can be found.
l7_rules(l7_policy, **query)
Return a generator of l7rules
Parameters
• l7_policy The l7_policy can be either the ID of a l7_policy or
L7Policy instance that the l7rule belongs to.
• query (dict) Optional query parameters to be sent to limit the resources
being returned. Valid parameters are:
Returns A generator of l7rule objects
Return type L7Rule
update_l7_rule(l7rule, l7_policy, **attrs)
Update a l7rule
Parameters
• l7rule Either the ID of a l7rule or a L7Rule instance.
• l7_policy The l7_policy can be either the ID of a l7policy or
L7Policy instance that the l7rule belongs to.
• attrs (dict) The attributes to update on the l7rule represented by
l7rule.
Returns The updated l7rule
Return type L7Rule
Provider Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
providers(**query)
Retrieve a generator of providers
Returns A generator of providers instances
provider_flavor_capabilities(provider, **query)
Retrieve a generator of provider flavor capabilities
Returns A generator of provider flavor capabilities instances
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_flavor_profile(**attrs)
Create a new flavor profile from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
FlavorProfile, comprised of the properties on the FlavorProfile class.
Returns The results of profile creation creation
Return type FlavorProfile
get_flavor_profile(*attrs)
Get a flavor profile
Parameters flavor_profile The value can be the name of a flavor profile
or FlavorProfile instance.
Returns One FlavorProfile
flavor_profiles(**query)
Retrieve a generator of flavor profiles
Returns A generator of flavor profiles instances
delete_flavor_profile(flavor_profile, ignore_missing=True)
Delete a flavor profile
Parameters
• flavor_profile The flavor_profile can be either the name or a
FlavorProfile instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the flavor profile does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent flavor profile.
Returns None
find_flavor_profile(name_or_id, ignore_missing=True)
Find a single flavor profile
Parameters
• name_or_id The name or ID of a flavor profile
Flavor Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_flavor(**attrs)
Create a new flavor from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Flavor, comprised of the properties on the Flavorclass.
Returns The results of flavor creation creation
Return type Flavor
get_flavor(*attrs)
Get a flavor
Parameters flavor The value can be the name of a flavor or Flavor instance.
Returns One Flavor
flavors(**query)
Retrieve a generator of flavors
Returns A generator of flavor instances
delete_flavor(flavor, ignore_missing=True)
Delete a flavor
Parameters
• flavor The flavorcan be either the name or a Flavor instance
Quota Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
quotas(**query)
Return a generator of quotas
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned. Currently no query parameter is supported.
Returns A generator of quota objects
Return type Quota
get_quota(quota)
Get a quota
Parameters quota The value can be the ID of a quota or a Quota instance. The
ID of a quota is the same as the project ID for the quota.
Amphora Operations
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
amphorae(**query)
Retrieve a generator of amphorae
Returns A generator of amphora instances
get_amphora(*attrs)
Get a amphora
Parameters amphora The value can be the ID of an amphora or Amphora
instance.
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_availability_zone_profile(**attrs)
Create a new availability zone profile from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
AvailabilityZoneProfile, comprised of the properties on the Avail-
abilityZoneProfile class.
Returns The results of profile creation creation
Return type AvailabilityZoneProfile
get_availability_zone_profile(*attrs)
Get an availability zone profile
Parameters availability_zone_profile The value can be the name of
an availability_zone profile or AvailabilityZoneProfile instance.
Returns One AvailabilityZoneProfile
availability_zone_profiles(**query)
Retrieve a generator of availability zone profiles
Returns A generator of availability zone profiles instances
delete_availability_zone_profile(availability_zone_profile, ig-
nore_missing=True)
Delete an availability zone profile
Parameters
• availability_zone_profile The availability_zone_profile can be
either the name or a AvailabilityZoneProfile instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the availability zone profile does not exist. When set
to True, no exception will be set when attempting to delete a nonexistent
availability zone profile.
Returns None
find_availability_zone_profile(name_or_id, ignore_missing=True)
Find a single availability zone profile
Parameters
• name_or_id The name or ID of a availability zone profile
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the availability zone profile does not exist. When set
to True, no exception will be set when attempting to delete a nonexistent
availability zone profile.
Returns None
update_availability_zone_profile(availability_zone_profile, **attrs)
Update an availability zone profile
Parameters
• availability_zone_profile The availability_zone_profile can be
either the name or a AvailabilityZoneProfile instance
• attrs (dict) The attributes to update on the availability_zone profile
represented by availability_zone_profile.
Returns The updated availability zone profile
Return type AvailabilityZoneProfile
class openstack.load_balancer.v2._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_availability_zone(**attrs)
Create a new availability zone from attributes
Parameters attrs (dict) Keyword arguments which will be used to create
a AvailabilityZone, comprised of the properties on the Availability-
Zoneclass.
Returns The results of availability_zone creation creation
Return type AvailabilityZone
get_availability_zone(*attrs)
Get an availability zone
Parameters availability_zone The value can be the name of a availabil-
ity_zone or AvailabilityZone instance.
Returns One AvailabilityZone
availability_zones(**query)
Retrieve a generator of availability zones
Returns A generator of availability zone instances
delete_availability_zone(availability_zone, ignore_missing=True)
Delete an availability_zone
Parameters
• availability_zone The availability_zone can be either the name or a
AvailabilityZone instance
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the availability zone does not exist. When set to True,
no exception will be set when attempting to delete a nonexistent availability
zone.
Returns None
find_availability_zone(name_or_id, ignore_missing=True)
Find a single availability zone
Parameters
• name_or_id The name or ID of a availability zone
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the availability zone does not exist. When set to True,
Message API v2
The message high-level interface is available through the message member of a Connection object.
The message member will only be added if the service is detected.
Message Operations
post_message(queue_name, messages)
Post messages to given queue
Parameters
• queue_name The name of target queue to post message to.
• messages (list) List of messages body and TTL to post.
Returns A string includes location of messages successfully posted.
messages(queue_name, **query)
Retrieve a generator of messages
Parameters
• queue_name The name of target queue to query messages from.
Queue Operations
create_queue(**attrs)
Create a new queue from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Queue, comprised of the properties on the Queue class.
Returns The results of queue creation
Return type Queue
get_queue(queue)
Get a queue
Parameters queue The value can be the name of a queue or a Queue instance.
Returns One Queue
Raises ResourceNotFound when no queue matching the name could be
found.
queues(**query)
Retrieve a generator of queues
Parameters query (kwargs) Optional query parameters to be sent to restrict
the queues to be returned. Available parameters include:
• limit: Requests at most the specified number of items be returned from
the query.
• marker: Specifies the ID of the last-seen queue. Use the limit
parameter to make an initial limited request and use the ID of the
last-seen queue from the response as the marker parameter value in a
subsequent limited request.
Returns A generator of queue instances.
delete_queue(value, ignore_missing=True)
Delete a queue
Parameters
• value The value can be either the name of a queue or a Queue instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the queue does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent queue.
Returns None
Claim Operations
create_claim(queue_name, **attrs)
Create a new claim from attributes
Parameters
• queue_name The name of target queue to claim message from.
• attrs (dict) Keyword arguments which will be used to create a Claim,
comprised of the properties on the Claim class.
Returns The results of claim creation
Return type Claim
get_claim(queue_name, claim)
Get a claim
Parameters
• queue_name The name of target queue to claim message from.
• claim The value can be either the ID of a claim or a Claim instance.
Returns One Claim
Raises ResourceNotFound when no claim matching the criteria could be
found.
update_claim(queue_name, claim, **attrs)
Update an existing claim from attributes
Parameters
• queue_name The name of target queue to claim message from.
• claim The value can be either the ID of a claim or a Claim instance.
• attrs (dict) Keyword arguments which will be used to update a Claim,
comprised of the properties on the Claim class.
Returns The results of claim update
Return type Claim
delete_claim(queue_name, claim, ignore_missing=True)
Delete a claim
Parameters
• queue_name The name of target queue to claim messages from.
• claim The value can be either the ID of a claim or a Claim instance.
Subscription Operations
create_subscription(queue_name, **attrs)
Create a new subscription from attributes
Parameters
• queue_name The name of target queue to subscribe on.
• attrs (dict) Keyword arguments which will be used to create a
Subscription, comprised of the properties on the Subscription class.
Returns The results of subscription creation
Return type Subscription
subscriptions(queue_name, **query)
Retrieve a generator of subscriptions
Parameters
• queue_name The name of target queue to subscribe on.
• query (kwargs) Optional query parameters to be sent to restrict the sub-
scriptions to be returned. Available parameters include:
– limit: Requests at most the specified number of items be returned
from the query.
– marker: Specifies the ID of the last-seen subscription. Use the limit
parameter to make an initial limited request and use the ID of the
last-seen subscription from the response as the marker parameter value
in a subsequent limited request.
Returns A generator of subscription instances.
get_subscription(queue_name, subscription)
Get a subscription
Parameters
• queue_name The name of target queue of subscription.
• message The value can be the ID of a subscription or a Subscription
instance.
Network API
The network high-level interface is available through the network member of a Connection object.
The network member will only be added if the service is detected.
Network Operations
dhcp_agent_hosting_networks(agent, **query)
A generator of networks hosted by a DHCP agent.
Parameters
• agent Either the agent id of an instance of Agent
• query kwargs query: Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of networks
add_dhcp_agent_to_network(agent, network)
Add a DHCP Agent to a network
Parameters
• agent Either the agent id of an instance of Agent
• network Network instance
Returns
remove_dhcp_agent_from_network(agent, network)
Remove a DHCP Agent from a network
Parameters
• agent Either the agent id of an instance of Agent
• network Network instance
Returns
create_network(**attrs)
Create a new network from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Network, comprised of the properties on the Network class.
Returns The results of network creation
Return type Network
delete_network(network, ignore_missing=True, if_revision=None)
Delete a network
Parameters
• network The value can be either the ID of a network or a Network
instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the network does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent network.
• if_revision (int) Revision to put in If-Match header of update request
to perform compare-and-swap update.
Returns None
find_network(name_or_id, ignore_missing=True, **args)
Find a single network
Parameters
• name_or_id The name or ID of a network.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One Network or None
get_network(network)
Get a single network
Parameters
• name_or_id The name or ID of a network.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One NetworkIPAvailability or None
get_network_ip_availability(network)
Get IP availability of a network
Parameters network The value can be the ID of a network or a Network
instance.
Returns One NetworkIPAvailability
Raises ResourceNotFound when no resource can be found.
network_ip_availabilities(**query)
Return a generator of network ip availabilities
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned. Available parameters include:
• ip_version: IP version of the network
• network_id: ID of network to use when listening network IP
availability.
• network_name: The name of the network for the particular network
IP availability.
• project_id: Owner tenant ID
Returns A generator of network ip availability objects
Return type NetworkIPAvailability
Port Operations
create_port(**attrs)
Create a new port from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Port, comprised of the properties on the Port class.
Returns The results of port creation
Router Operations
create_router(**attrs)
Create a new router from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Router, comprised of the properties on the Router class.
Returns The results of router creation
Return type Router
delete_router(router, ignore_missing=True, if_revision=None)
Delete a router
Parameters
remove_extra_routes_from_router(router, body)
Remove extra routes from a router
Parameters
• router Either the router ID or an instance of Router
• body The request body as documented in the api-ref.
Returns Router with updated extra routes
Return type
class ~openstack.network.v2.router.Router
add_gateway_to_router(router, **body)
Add Gateway to a router
Parameters
• router Either the router ID or an instance of Router
• body Body with the gateway information
Returns Router with updated interface
Return type
class ~openstack.network.v2.router.Router
remove_gateway_from_router(router, **body)
Remove Gateway from a router
Parameters
• router Either the router ID or an instance of Router
• body Body with the gateway information
Returns Router with updated interface
Return type
class ~openstack.network.v2.router.Router
Floating IP Operations
create_ip(**attrs)
Create a new floating ip from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
FloatingIP, comprised of the properties on the FloatingIP class.
Returns The results of floating ip creation
Pool Operations
create_pool(**attrs)
Create a new pool from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Pool, comprised of the properties on the Pool class.
Returns The results of pool creation
Return type Pool
delete_pool(pool, ignore_missing=True)
Delete a pool
Parameters
• pool The value can be either the ID of a pool or a Pool instance.
update_pool(pool, **attrs)
Update a pool
Parameters
• pool Either the id of a pool or a Pool instance.
• attrs (dict) The attributes to update on the pool represented by pool.
Returns The updated pool
Return type Pool
create_pool_member(pool, **attrs)
Create a new pool member from attributes
Parameters
• pool The pool can be either the ID of a pool or a Pool instance that the
member will be created in.
• attrs (dict) Keyword arguments which will be used to create a
PoolMember, comprised of the properties on the PoolMember class.
Returns The results of pool member creation
Return type PoolMember
delete_pool_member(pool_member, pool, ignore_missing=True)
Delete a pool member
Parameters
• pool_member The member can be either the ID of a pool member or a
PoolMember instance.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the pool member does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent pool member.
Returns None
find_pool_member(name_or_id, pool, ignore_missing=True, **args)
Find a single pool member
Parameters
• name_or_id (str) The name or ID of a pool member.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One PoolMember or None
get_pool_member(pool_member, pool)
Get a single pool member
Parameters
• pool_member The member can be the ID of a pool member or a
PoolMember instance.
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
Returns One PoolMember
Raises ResourceNotFound when no resource can be found.
pool_members(pool, **query)
Return a generator of pool members
Parameters
• pool The pool can be either the ID of a pool or a Pool instance that the
member belongs to.
• query (dict)
Optional query parameters to be sent to limit the resources being re-
turned. Valid parameters are:
get_auto_allocated_topology(project=None)
Get the auto-allocated topology of a given tenant
Parameters project The value is the ID or name of a project
Returns The auto-allocated topology
Return type AutoAllocatedTopology
delete_auto_allocated_topology(project=None, ignore_missing=False)
Delete auto-allocated topology
Parameters
• project The value is the ID or name of a project
• ignore_missing When set to False ResourceNotFound will be
raised when the topology does not exist. When set to True, no exception
will be raised when attempting to delete nonexistant topology
Returns None
validate_auto_allocated_topology(project=None)
Validate the resources for auto allocation
Parameters project The value is the ID or name of a project
Returns Whether all resources are correctly configured or not
Return type ValidateTopology
create_security_group(**attrs)
Create a new security group from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
SecurityGroup, comprised of the properties on the SecurityGroup class.
Returns The results of security group creation
Return type SecurityGroup
delete_security_group(security_group, ignore_missing=True, if_revision=None)
Delete a security group
Parameters
• security_group The value can be either the ID of a security group or
a SecurityGroup instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the security group does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent security group.
• if_revision (int) Revision to put in If-Match header of update request
to perform compare-and-swap update.
Returns None
find_security_group(name_or_id, ignore_missing=True, **args)
Find a single security group
Parameters
• name_or_id The name or ID of a security group.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One SecurityGroup or None
get_security_group(security_group)
Get a single security group
Parameters security_group The value can be the ID of a security group or
a SecurityGroup instance.
Returns One SecurityGroup
Raises ResourceNotFound when no resource can be found.
security_groups(**query)
Return a generator of security groups
Parameters query (dict)
Optional query parameters to be sent to limit the resources being returned.
Valid parameters are:
availability_zones(**query)
Return a generator of availability zones
Parameters query (dict)
optional query parameters to be set to limit the returned resources. Valid
parameters include:
create_address_scope(**attrs)
Create a new address scope from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
AddressScope, comprised of the properties on the AddressScope class.
Returns The results of address scope creation
Return type AddressScope
delete_address_scope(address_scope, ignore_missing=True)
Delete an address scope
Parameters
• address_scope The value can be either the ID of an address scope or a
AddressScope instance.
Quota Operations
delete_quota(quota, ignore_missing=True)
Delete a quota (i.e. reset to the default quota)
Parameters
• quota The value can be either the ID of a quota or a Quota instance. The
ID of a quota is the same as the project ID for the quota.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when quota does not exist. When set to True, no exception
will be set when attempting to delete a nonexistent quota.
Returns None
get_quota(quota, details=False)
Get a quota
Parameters
• quota The value can be the ID of a quota or a Quota instance. The ID of
a quota is the same as the project ID for the quota.
• details If set to True, details about quota usage will be returned.
Returns One Quota
Raises ResourceNotFound when no resource can be found.
get_quota_default(quota)
Get a default quota
Parameters quota The value can be the ID of a default quota or a
QuotaDefault instance. The ID of a default quota is the same as the project
ID for the default quota.
Returns One QuotaDefault
Raises ResourceNotFound when no resource can be found.
quotas(**query)
Return a generator of quotas
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned. Currently no query parameter is supported.
Returns A generator of quota objects
Return type Quota
update_quota(quota, **attrs)
Update a quota
Parameters
• quota Either the ID of a quota or a Quota instance. The ID of a quota is
the same as the project ID for the quota.
• attrs (dict) The attributes to update on the quota represented by
quota.
Returns The updated quota
Return type Quota
QoS Operations
create_qos_bandwidth_limit_rule(qos_policy, **attrs)
Create a new bandwidth limit rule
Parameters
• attrs (dict) Keyword arguments which will be used to create a
QoSBandwidthLimitRule, comprised of the properties on the QoS-
BandwidthLimitRule class.
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
Returns The results of resource creation
Return type QoSBandwidthLimitRule
delete_qos_bandwidth_limit_rule(qos_rule, qos_policy, ig-
nore_missing=True)
Delete a bandwidth limit rule
Parameters
• qos_rule The value can be either the ID of a bandwidth limit rule or a
QoSBandwidthLimitRule instance.
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent bandwidth
limit rule.
Returns None
Parameters
• qos_rule The value can be either the ID of a minimum bandwidth rule
or a QoSMinimumBandwidthRule instance.
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, no ex-
ception will be set when attempting to delete a nonexistent minimum band-
width rule.
Returns None
find_qos_minimum_bandwidth_rule(qos_rule_id, qos_policy, ig-
nore_missing=True, **args)
Find a minimum bandwidth rule
Parameters
• qos_rule_id The ID of a minimum bandwidth rule.
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One QoSMinimumBandwidthRule or None
get_qos_minimum_bandwidth_rule(qos_rule, qos_policy)
Get a single minimum bandwidth rule
Parameters
• qos_rule The value can be the ID of a minimum bandwidth rule or a
QoSMinimumBandwidthRule instance.
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
Returns One QoSMinimumBandwidthRule
Raises ResourceNotFound when no resource can be found.
qos_minimum_bandwidth_rules(qos_policy, **query)
Return a generator of minimum bandwidth rules
Parameters
• qos_policy The value can be the ID of the QoS policy that the rule
belongs or a QoSPolicy instance.
• query (kwargs) Optional query parameters to be sent to limit the re-
sources being returned.
Returns A generator of minimum bandwidth rule objects
qos_rule_types(**query)
Return a generator of QoS rule types
Parameters query (dict)
Optional query parameters to be sent to limit the resources returned.
Valid parameters include:
Agent Operations
agents(**query)
Return a generator of network agents
Parameters query (dict)
Optional query parameters to be sent to limit the resources being re-
turned.
RBAC Operations
create_rbac_policy(**attrs)
Create a new RBAC policy from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
RBACPolicy, comprised of the properties on the RBACPolicy class.
Returns The results of RBAC policy creation
Return type RBACPolicy
delete_rbac_policy(rbac_policy, ignore_missing=True)
Delete a RBAC policy
Parameters
• rbac_policy The value can be either the ID of a RBAC policy or a
RBACPolicy instance.
Listener Operations
create_listener(**attrs)
Create a new listener from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Listener, comprised of the properties on the Listener class.
Returns The results of listener creation
Return type Listener
delete_listener(listener, ignore_missing=True)
Delete a listener
Parameters
• listener The value can be either the ID of a listner or a Listener
instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the listner does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent listener.
Returns None
find_listener(name_or_id, ignore_missing=True, **args)
Find a single listener
Parameters
• name_or_id The name or ID of a listener.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One Listener or None
get_listener(listener)
Get a single listener
Parameters listener The value can be the ID of a listener or a Listener
instance.
Subnet Operations
create_subnet(**attrs)
Create a new subnet from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Subnet, comprised of the properties on the Subnet class.
Returns The results of subnet creation
Return type Subnet
delete_subnet(subnet, ignore_missing=True, if_revision=None)
Delete a subnet
Parameters
• subnet The value can be either the ID of a subnet or a Subnet instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the subnet does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent subnet.
• if_revision (int) Revision to put in If-Match header of update request
to perform compare-and-swap update.
Returns None
find_subnet(name_or_id, ignore_missing=True, **args)
Find a single subnet
Parameters
• name_or_id The name or ID of a subnet.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One Subnet or None
get_subnet(subnet)
Get a single subnet
Parameters subnet The value can be the ID of a subnet or a Subnet instance.
Returns One Subnet
Raises ResourceNotFound when no resource can be found.
subnets(**query)
Return a generator of subnets
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned. Available parameters include:
• cidr: Subnet CIDR
• description: The subnet description
• gateway_ip: Subnet gateway IP address
• ip_version: Subnet IP address version
create_load_balancer(**attrs)
Create a new load balancer from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
LoadBalancer, comprised of the properties on the LoadBalancer class.
Returns The results of load balancer creation
Return type LoadBalancer
delete_load_balancer(load_balancer, ignore_missing=True)
Delete a load balancer
Parameters
• load_balancer The value can be the ID of a load balancer or a
LoadBalancer instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the load balancer does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent load balancer.
Returns None
find_load_balancer(name_or_id, ignore_missing=True, **args)
Find a single load balancer
Parameters
• name_or_id The name or ID of a load balancer.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One LoadBalancer or None
get_load_balancer(load_balancer)
Get a single load balancer
Parameters load_balancer The value can be the ID of a load balancer or a
LoadBalancer instance.
Returns One LoadBalancer
Raises ResourceNotFound when no resource can be found.
load_balancers(**query)
Return a generator of load balancers
Parameters query (dict) Optional query parameters to be sent to limit the
resources being returned.
Returns A generator of load balancer objects
Return type LoadBalancer
update_load_balancer(load_balancer, **attrs)
Update a load balancer
Parameters
• load_balancer Either the id of a load balancer or a LoadBalancer
instance.
• attrs (dict) The attributes to update on the load balancer represented
by load_balancer.
Returns The updated load balancer
Return type LoadBalancer
create_health_monitor(**attrs)
Create a new health monitor from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
HealthMonitor, comprised of the properties on the HealthMonitor class.
Returns The results of health monitor creation
Return type HealthMonitor
delete_health_monitor(health_monitor, ignore_missing=True)
Delete a health monitor
Parameters
• health_monitor The value can be either the ID of a health monitor or
a HealthMonitor instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the health monitor does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent health monitor.
Returns None
Parameters
• health_monitor Either the id of a health monitor or a
HealthMonitor instance.
• attrs (dict) The attributes to update on the health monitor represented
by value.
Returns The updated health monitor
Return type HealthMonitor
create_metering_label(**attrs)
Create a new metering label from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
MeteringLabel, comprised of the properties on the MeteringLabel class.
Returns The results of metering label creation
Return type MeteringLabel
delete_metering_label(metering_label, ignore_missing=True)
Delete a metering label
Parameters
• metering_label The value can be either the ID of a metering label or
a MeteringLabel instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the metering label does not exist. When set to True,
no exception will be set when attempting to delete a nonexistent metering
label.
Returns None
find_metering_label(name_or_id, ignore_missing=True, **args)
Find a single metering label
Parameters
• name_or_id The name or ID of a metering label.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
delete_metering_label_rule(metering_label_rule, ignore_missing=True)
Delete a metering label rule
Parameters
• metering_label_rule The value can be either the ID of a metering
label rule or a MeteringLabelRule instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the metering label rule does not exist. When set to
True, no exception will be set when attempting to delete a nonexistent me-
tering label rule.
Returns None
find_metering_label_rule(name_or_id, ignore_missing=True, **args)
Find a single metering label rule
Parameters
• name_or_id The name or ID of a metering label rule.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One MeteringLabelRule or None
get_metering_label_rule(metering_label_rule)
Get a single metering label rule
Parameters metering_label_rule The value can be the ID of a metering
label rule or a MeteringLabelRule instance.
Returns One MeteringLabelRule
Raises ResourceNotFound when no resource can be found.
metering_label_rules(**query)
Return a generator of metering label rules
Parameters query (dict)
Optional query parameters to be sent to limit the resources being returned.
Valid parameters are:
Segment Operations
create_segment(**attrs)
Create a new segment from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Segment, comprised of the properties on the Segment class.
Returns The results of segment creation
Return type Segment
delete_segment(segment, ignore_missing=True)
Delete a segment
Parameters
• segment The value can be either the ID of a segment or a Segment
instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the segment does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent segment.
Returns None
find_segment(name_or_id, ignore_missing=True, **args)
Find a single segment
Parameters
• name_or_id The name or ID of a segment.
Flavor Operations
create_flavor(**attrs)
Create a new network service flavor from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Flavor, comprised of the properties on the Flavor class.
Returns The results of flavor creation
Return type Flavor
delete_flavor(flavor, ignore_missing=True)
Delete a network service flavor
Parameters
• flavor The value can be either the ID of a flavor or a Flavor instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the flavor does not exist. When set to True, no excep-
tion will be set when attempting to delete a nonexistent flavor.
Returns None
find_flavor(name_or_id, ignore_missing=True, **args)
Find a single network service flavor
Parameters
• name_or_id The name or ID of a flavor.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One Flavor or None
get_flavor(flavor)
Get a single network service flavor
Parameters flavor The value can be the ID of a flavor or a Flavor instance.
Returns One Flavor
Raises ResourceNotFound when no resource can be found.
update_flavor(flavor, **attrs)
Update a network service flavor
associate_flavor_with_service_profile(flavor, service_profile)
Associate network flavor with service profile.
Parameters
• flavor Either the id of a flavor or a Flavor instance.
• service_profile The value can be either the ID of a service profile or
a ServiceProfile instance.
Returns
disassociate_flavor_from_service_profile(flavor, service_profile)
Disassociate network flavor from service profile.
Parameters
• flavor Either the id of a flavor or a Flavor instance.
• service_profile The value can be either the ID of a service profile or
a ServiceProfile instance.
Returns
create_service_profile(**attrs)
Create a new network service flavor profile from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
ServiceProfile, comprised of the properties on the ServiceProfile class.
Returns The results of service profile creation
Return type ServiceProfile
delete_service_profile(service_profile, ignore_missing=True)
Delete a network service flavor profile
Parameters
• service_profile The value can be either the ID of a service profile or
a ServiceProfile instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the service profile does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent service profile.
Returns None
find_service_profile(name_or_id, ignore_missing=True, **args)
Find a single network service flavor profile
Parameters
• name_or_id The name or ID of a service profile.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• args (dict) Any additional parameters to be passed into underlying
methods. such as query filters.
Returns One ServiceProfile or None
get_service_profile(service_profile)
Get a single network service flavor profile
Parameters service_profile The value can be the ID of a service_profile
or a ServiceProfile instance.
Returns One ServiceProfile
Raises ResourceNotFound when no resource can be found.
service_profiles(**query)
Return a generator of network service flavor profiles
Parameters query (dict)
Optional query parameters to be sent to limit the resources returned.
Available parameters inclue:
Tag Operations
set_tags(resource, tags)
Replace tags of a specified resource with specified tags
Parameters
• resource Resource instance.
• tags ("list") New tags to be set.
Returns The updated resource
Return type Resource
VPN Operations
create_vpn_service(**attrs)
Create a new vpn service from attributes
Extension Operations
service_providers(**query)
Return a generator of service providers
For details on how to use this API, see Using OpenStack Object Store
The Object Store high-level interface is exposed as the object_store object on Connection ob-
jects.
Account Operations
get_account_metadata()
Get metadata for this account.
Return type Account
set_account_metadata(**metadata)
Set metadata for this account.
Parameters metadata (kwargs) Key/value pairs to be set as metadata on the
container. Custom metadata can be set. Custom metadata are keys and values
defined by the user.
delete_account_metadata(keys)
Delete metadata for this account.
Parameters keys The keys of metadata to be deleted.
Container Operations
containers(**query)
Obtain Container objects for this account.
Parameters query (kwargs) Optional query parameters to be sent to limit the
resources being returned.
Return type A generator of Container objects.
create_container(name, **attrs)
Create a new container from attributes
Parameters
• container Name of the container to create.
• attrs (dict) Keyword arguments which will be used to create a
Container, comprised of the properties on the Container class.
Returns The results of container creation
Return type Container
delete_container(container, ignore_missing=True)
Delete a container
Parameters
• container The value can be either the name of a container or a
Container instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the container does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent server.
Returns None
get_container_metadata(container)
Get metadata for a container
Parameters container The value can be the name of a container or a
Container instance.
Returns One Container
Raises ResourceNotFound when no resource can be found.
set_container_metadata(container, refresh=True, **metadata)
Set metadata for a container.
Parameters
Object Operations
objects(container, **query)
Return a generator that yields the Containers objects.
Parameters
• container (Container) A container object or the name of a container
that you want to retrieve objects from.
• query (kwargs) Optional query parameters to be sent to limit the re-
sources being returned.
Return type A generator of Object objects.
get_object(obj, container=None)
Get the data associated with an object
Parameters
• obj The value can be the name of an object or a Object instance.
• container The value can be the name of a container or a Container
instance.
Returns The contents of the object. Use the get_object_metadata()
method if you want an object resource.
Raises ResourceNotFound when no resource can be found.
download_object(obj, container=None, **attrs)
Download the data contained inside an object.
Parameters
• obj The value can be the name of an object or a Object instance.
• container The value can be the name of a container or a Container
instance.
Raises ResourceNotFound when no resource can be found.
upload_object(container, name, filename=None, md5=None, sha256=None,
segment_size=None, use_slo=True, metadata=None, gener-
ate_checksums=None, data=None, **headers)
Create a file object.
Automatically uses large-object segments if needed.
Parameters
• container The name of the container to store the file in. This container
will be created if it does not exist already.
• name Name for the object within the container.
• filename The path to the local file whose contents will be uploaded.
Mutually exclusive with data.
• data The content to upload to the object. Mutually exclusive with file-
name.
• md5 A hexadecimal md5 of the file. (Optional), if it is known and can be
passed here, it will save repeating the expensive md5 process. It is assumed
to be accurate.
• sha256 A hexadecimal sha256 of the file. (Optional) See md5.
• segment_size Break the uploaded object into segments of this many
bytes. (Optional) SDK will attempt to discover the maximum value for this
from the server if it is not specified, or will use a reasonable default.
• headers These will be passed through to the object creation API as HTTP
Headers.
• use_slo If the object is large enough to need to be a Large Object, use a
static rather than dynamic object. Static Objects will delete segment objects
when the manifest object is deleted. (optional, defaults to True)
– content_encoding
– content_disposition
– delete_after
– delete_at
– is_content_type_detected
delete_object_metadata(obj, container=None, keys=None)
Delete metadata for an object.
Parameters
• obj The value can be the name of an object or a Object instance.
• container The value can be the ID of a container or a Container
instance.
• keys The keys of metadata to be deleted.
Orchestration API
Stack Operations
class openstack.orchestration.v1._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_stack(preview=False, **attrs)
Create a new stack from attributes
Parameters
• preview (bool) When True, a preview endpoint will be used to verify
the template Default: “False“
• attrs (dict) Keyword arguments which will be used to create a Stack,
comprised of the properties on the Stack class.
Returns The results of stack creation
Return type Stack
check_stack(stack)
Check a stacks status
Since this is an asynchronous action, the only way to check the result is to track the stacks
status.
Parameters stack The value can be either the ID of a stack or an instance of
Stack.
Returns None
get_stack_template(stack)
Get template used by a stack
Parameters stack The value can be the ID of a stack or an instance of Stack
Returns One object of StackTemplate
Raises ResourceNotFound when no resource can be found.
get_stack_environment(stack)
Get environment used by a stack
Parameters stack The value can be the ID of a stack or an instance of Stack
Returns One object of StackEnvironment
Raises ResourceNotFound when no resource can be found.
get_stack_files(stack)
Get files used by a stack
Parameters stack The value can be the ID of a stack or an instance of Stack
Returns A dictionary containing the names and contents of all files used by the
stack.
Raises ResourceNotFound when the stack cannot be found.
resources(stack, **query)
Return a generator of resources
Parameters
• stack This can be a stack object, or the name of a stack for which the
resources are to be listed.
• query (kwargs) Optional query parameters to be sent to limit the re-
sources being returned.
Returns A generator of resource objects if the stack exists and there are resources
in it. If the stack cannot be found, an exception is thrown.
Return type A generator of Resource
Raises ResourceNotFound when the stack cannot be found.
validate_template(template, environment=None, template_url=None, ig-
nore_errors=None)
Validates a template.
Parameters
• template The stack template on which the validation is performed.
class openstack.orchestration.v1._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_software_config(**attrs)
Create a new software config from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
SoftwareConfig, comprised of the properties on the SoftwareConfig class.
Returns The results of software config creation
Return type SoftwareConfig
software_configs(**query)
Returns a generator of software configs
Parameters query (dict) Optional query parameters to be sent to limit the
software configs returned.
Returns A generator of software config objects.
Return type SoftwareConfig
get_software_config(software_config)
Get details about a specific software config.
Parameters software_config The value can be the ID of a software config
or a instace of SoftwareConfig,
Returns An object of type SoftwareConfig
delete_software_config(software_config, ignore_missing=True)
Delete a software config
Parameters
class openstack.orchestration.v1._proxy.Proxy(session,
statsd_client=None,
statsd_prefix=None,
prometheus_counter=None,
prometheus_histogram=None,
influxdb_config=None, in-
fluxdb_client=None, *args,
**kwargs)
create_software_deployment(**attrs)
Create a new software deployment from attributes
Parameters attrs (dict) Keyword arguments which will be used to create
a SoftwareDeployment, comprised of the properties on the SoftwareDe-
ployment class.
Returns The results of software deployment creation
Return type SoftwareDeployment
software_deployments(**query)
Returns a generator of software deployments
Parameters query (dict) Optional query parameters to be sent to limit the
software deployments returned.
Returns A generator of software deployment objects.
Return type SoftwareDeployment
get_software_deployment(software_deployment)
Get details about a specific software deployment resource
Parameters software_deployment The value can be the ID of a software
deployment or an instace of SoftwareDeployment,
Returns An object of type SoftwareDeployment
delete_software_deployment(software_deployment, ignore_missing=True)
Delete a software deployment
Parameters
• software_deployment The value can be either the ID of a software
deployment or an instance of SoftwareDeployment
Workflow API
The workflow high-level interface is available through the workflow member of a Connection
object. The workflow member will only be added if the service is detected.
Workflow Operations
create_workflow(**attrs)
Create a new workflow from attributes
Parameters attrs (dict) Keyword arguments which will be used to create a
Workflow, comprised of the properties on the Workflow class.
Returns The results of workflow creation
Return type Workflow
get_workflow(*attrs)
Get a workflow
Parameters workflow The value can be the name of a workflow or Workflow
instance.
Returns One Workflow
Execution Operations
create_execution(**attrs)
Create a new execution from attributes
Parameters
• workflow_name The name of target workflow to execute.
• attrs (dict) Keyword arguments which will be used to create a
Execution, comprised of the properties on the Execution class.
Returns The results of execution creation
Return type Execution
get_execution(*attrs)
Get a execution
Parameters
• workflow_name The name of target workflow to execute.
• execution The value can be either the ID of a execution or a
Execution instance.
Returns One Execution
Raises ResourceNotFound when no execution matching the criteria could be
found.
executions(**query)
Retrieve a generator of executions
Parameters query (kwargs) Optional query parameters to be sent to restrict
the executions to be returned. Available parameters include:
• limit: Requests at most the specified number of items be returned from
the query.
• marker: Specifies the ID of the last-seen execution. Use the limit pa-
rameter to make an initial limited request and use the ID of the
last-seen execution from the response as the marker parameter value in a
subsequent limited request.
Returns A generator of execution instances.
delete_execution(value, ignore_missing=True)
Delete an execution
Parameters
• value The value can be either the name of a execution or a Execution
instance.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the execution does not exist. When set to True, no
exception will be set when attempting to delete a nonexistent execution.
Returns None
find_execution(name_or_id, ignore_missing=True)
Find a single execution
Parameters
• name_or_id The name or ID of an execution.
Resource Interface
The Resource layer is a lower-level interface to communicate with OpenStack services. While the classes
exposed by the Connection build a convenience layer on top of this, Resources can be used directly.
However, the most common usage of this layer is in receiving an object from a class in the Connection
layer, modifying it, and sending it back into the Connection layer, such as to update a resource on the
server.
The following services have exposed Resource classes.
Accelerator v2 Resources
openstack.accelerator.v2.device
updated_at
The timestamp when this device was updated.
uuid
The UUID of the device.
vendor
The vendor ID of the device.
vendor_board_info
The vendor board information of the device.
openstack.accelerator.v2.deployable
openstack.accelerator.v2.device_profile
openstack.accelerator.v2.accelerator_request
Allows modifying the resource by providing a list of JSON patches to apply to it. The
patches can use both the original (server-side) and SDK field names.
Parameters
• session (Adapter) The session to use for making this request.
• patch Additional JSON patch as a list or one patch item. If provided, it is
applied on top of any changes to the current resource.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_patch is not set to
True.
create(session, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
• params (dict) Additional params to pass.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
Baremetal Resources
openstack.baremetal.v1.driver
enabled_console_interfaces
Enabled console interface implementations. Introduced in API microversion 1.30.
enabled_deploy_interfaces
Enabled deploy interface implementations. Introduced in API microversion 1.30.
enabled_inspect_interfaces
Enabled inspect interface implementations. Introduced in API microversion 1.30.
enabled_management_interfaces
Enabled management interface implementations. Introduced in API microversion 1.30.
enabled_network_interfaces
Enabled network interface implementations. Introduced in API microversion 1.30.
enabled_power_interfaces
Enabled port interface implementations. Introduced in API microversion 1.30.
enabled_raid_interfaces
Enabled RAID interface implementations. Introduced in API microversion 1.30.
enabled_rescue_interfaces
Enabled rescue interface implementations. Introduced in API microversion 1.38.
enabled_storage_interfaces
Enabled storage interface implementations. Introduced in API microversion 1.33.
enabled_vendor_interfaces
Enabled vendor interface implementations. Introduced in API microversion 1.30.
openstack.baremetal.v1.chassis
id
The UUID for the chassis
links
A list of relative links, including the self and bookmark links.
nodes
Links to the collection of nodes contained in the chassis
updated_at
Timestamp at which the chassis was last updated.
openstack.baremetal.v1.Node
driver_info
All the metadata required by the driver to manage this node. List of fields varies between
drivers, and can be retrieved from the openstack.baremetal.v1.driver.Driver
resource.
driver_internal_info
Internal metadata set and stored by nodes driver. This is read-only.
extra
A set of one or more arbitrary metadata key and value pairs.
fault
Fault type that caused the node to enter maintenance mode. Introduced in API microversion
1.42.
id
The UUID of the node resource.
instance_info
Information used to customize the deployed image, e.g. size of root partition, config drive
in the form of base64 encoded string and other metadata.
instance_id
UUID of the nova instance associated with this node.
is_automated_clean_enabled
Override enabling of automated cleaning. Added in API microversion 1.47.
is_console_enabled
Whether console access is enabled on this node.
is_maintenance
Whether node is currently in maintenance mode. Nodes put into maintenance mode are
removed from the available resource pool.
is_retired
Whether the node is marked for retirement. Added in API microversion 1.61.
last_error
Any error from the most recent transaction that started but failed to finish.
links
A list of relative links, including self and bookmark links.
maintenance_reason
user settable description of the reason why the node was placed into maintenance mode.
name
Human readable identifier for the node. May be undefined. Certain words are reserved.
Added in API microversion 1.5
ports
Links to the collection of ports on this node.
port_groups
Links to the collection of portgroups on this node. Available since API microversion 1.24.
power_state
The current power state. Usually power on or power off, but may be None if service is unable
to determine the power state.
properties
Physical characteristics of the node. Content populated by the service during inspection.
provision_state
The current provisioning state of the node.
retired_reason
The reason why the node is marked for retirement. Added in API microversion 1.61.
raid_config
The current RAID configuration of the node.
reservation
The name of an service conductor host which is holding a lock on this node, if a lock is held.
resource_class
A string to be used by external schedulers to identify this node as a unit of a specific type of
resource. Added in API microversion 1.21.
states
Links to the collection of states.
target_provision_state
The requested state if a provisioning action has been requested. For example, AVAILABLE,
DEPLOYING, DEPLOYWAIT, DEPLOYING, ACTIVE etc.
target_power_state
The requested state during a state transition.
target_raid_config
The requested RAID configuration of the node which will be applied when the node next
transitions through the CLEANING state.
traits
Traits of the node. Introduced in API microversion 1.37.
updated_at
Timestamp at which the node was last updated.
bios_interface
BIOS interface to use when setting BIOS properties of the node. Introduced in API mi-
croversion 1.40.
boot_interface
Boot interface to use when configuring boot of the node. Introduced in API microversion
1.31.
console_interface
Console interface to use when working with serial console. Introduced in API microversion
1.31.
deploy_interface
Deploy interface to use when deploying the node. Introduced in API microversion 1.31.
inspect_interface
Inspect interface to use when inspecting the node. Introduced in API microversion 1.31.
management_interface
Management interface to use for management actions on the node. Introduced in API mi-
croversion 1.31.
network_interface
Network interface provider to use when plumbing the network connections for this node.
Introduced in API microversion 1.20.
power_interface
Power interface to use for power actions on the node. Introduced in API microversion 1.31.
raid_interface
RAID interface to use for configuring RAID on the node. Introduced in API microversion
1.31.
rescue_interface
Rescue interface to use for rescuing of the node. Introduced in API microversion 1.38.
storage_interface
Storage interface to use when attaching remote storage. Introduced in API microversion
1.33.
vendor_interface
Vendor interface to use for vendor-specific actions on the node. Introduced in API microver-
sion 1.31.
create(session, *args, **kwargs)
Create a remote resource based on this instance.
The overridden version is capable of handling the populated provision_state field of
one of three values: enroll, manageable or available. The default is currently
available, since its the only state supported by all API versions.
Note that Bare Metal API 1.4 is required for manageable and 1.11 is required for
enroll.
Parameters session (Adapter) The session to use for making this request.
Returns This Resource instance.
Raises ValueError if the Nodes provision_state is not one of None,
enroll, manageable or available.
Raises NotSupported if the provision_state cannot be reached with any
API version supported by the server.
commit(session, *args, **kwargs)
Commit the state of the instance to the remote resource.
Parameters session (Adapter) The session to use for making this request.
Returns This Node instance.
set_provision_state(session, target, config_drive=None, clean_steps=None, res-
cue_password=None, wait=False, timeout=None)
Run an action modifying this nodes provision state.
This call is asynchronous, it will return success as soon as the Bare Metal service acknowl-
edges the request.
Parameters
• session (Adapter) The session to use for making this request.
• target Provisioning action, e.g. active, provide. See the Bare Metal
service documentation for available actions.
• config_drive Config drive to pass to the node, only valid for active`
and ``rebuild targets. You can use functions from openstack.
baremetal.configdrive to build it.
• clean_steps Clean steps to execute, only valid for clean target.
• rescue_password Password for the rescue operation, only valid for
rescue target.
• wait Whether to wait for the target state to be reached.
• timeout Timeout (in seconds) to wait for the target state to be reached. If
None, wait without timeout.
Returns This Node instance.
Raises ValueError if config_drive, clean_steps or
rescue_password are provided with an invalid target.
Raises ResourceFailure if the node reaches an error state while waiting for
the state.
Raises ResourceTimeout if timeout is reached while waiting for the state.
wait_for_power_state(session, expected_state, timeout=None)
Wait for the node to reach the expected power state.
Parameters
• session (Adapter) The session to use for making this request.
• expected_state The expected power state to reach.
• timeout If wait is set to True, specifies how much (in seconds) to wait
for the expected state to be reached. The value of None (the default) means
no client-side timeout.
Returns This Node instance.
Raises ResourceTimeout on timeout.
wait_for_provision_state(session, expected_state, timeout=None,
abort_on_failed_state=True)
Wait for the node to reach the expected state.
Parameters
• session (Adapter) The session to use for making this request.
• expected_state The expected provisioning state to reach.
• timeout If wait is set to True, specifies how much (in seconds) to wait
for the expected state to be reached. The value of None (the default) means
no client-side timeout.
• abort_on_failed_state If True (the default), abort waiting if the
node reaches a failure state which does not match the expected one. Note
that the failure state for enroll -> manageable transition is enroll
again.
unset_maintenance(session)
Disable maintenance mode on the node.
Parameters session (Adapter) The session to use for making this request.
Returns This Node instance.
set_boot_device(session, boot_device, persistent=False)
Set node boot device
Parameters
• session The session to use for making this request.
• boot_device Boot device to assign to the node.
• persistent If the boot device change is maintained after node reboot
Returns The updated Node
add_trait(session, trait)
Add a trait to a node.
Parameters
• session The session to use for making this request.
• trait The trait to add to the node.
Returns The updated Node
remove_trait(session, trait, ignore_missing=True)
Remove a trait from a node.
Parameters
• session The session to use for making this request.
• trait The trait to remove from the node.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the trait does not exist. Otherwise, False is returned.
Returns The updated Node
set_traits(session, traits)
Set traits for a node.
Removes any existing traits and adds the traits passed in to this method.
Parameters
• session The session to use for making this request.
• traits list of traits to add to the node.
Returns The updated Node
patch(session, patch=None, prepend_key=True, has_body=True,
retry_on_conflict=None, base_path=None, reset_interfaces=None)
Patch the remote resource.
Allows modifying the resource by providing a list of JSON patches to apply to it. The
patches can use both the original (server-side) and SDK field names.
Parameters
• session (Adapter) The session to use for making this request.
• patch Additional JSON patch as a list or one patch item. If provided, it is
applied on top of any changes to the current resource.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_patch is not set to
True.
The WaitResult class represents the result of waiting for several nodes.
class openstack.baremetal.v1.node.WaitResult(success, failure, timeout)
A named tuple representing a result of waiting for several nodes.
Each component is a list of Node objects:
Variables
• success a list of Node objects that reached the state.
• timeout a list of Node objects that reached timeout.
• failure a list of Node objects that hit a failure.
Create new instance of WaitResult(success, failure, timeout)
openstack.baremetal.v1.port
links
A list of relative links, including the self and bookmark links.
local_link_connection
The port bindig profile. If specified, must contain switch_id and port_id fields.
switch_info field is an optional string field to be used to store vendor specific infor-
mation. Added in API microversion 1.19.
node_id
The UUID of node this port belongs to
physical_network
The name of physical network this port is attached to. Added in API microversion 1.34.
port_group_id
The UUID of PortGroup this port belongs to. Added in API microversion 1.24.
updated_at
Timestamp at which the port was last updated.
openstack.baremetal.v1.port_group
internal_info
Internal metadaa set and stored by the portgroup.
is_standalone_ports_supported
Whether ports that are members of this portgroup can be used as standalone ports. Added in
API microversion 1.23.
links
A list of relative links, including the self and bookmark links.
mode
Port bonding mode. Added in API microversion 1.26.
node_id
UUID of the node this portgroup belongs to.
ports
A list of links to the collection of ports belonging to this portgroup. Added in API microver-
sion 1.24.
properties
Port group properties. Added in API microversion 1.26.
updated_at
Timestamp at which the portgroup was last updated.
openstack.baremetal.v1.Allocation
last_error
The last error for the allocation.
links
A list of relative links, including the self and bookmark links.
name
The name of the allocation.
node
The node UUID or name to create the allocation against, bypassing the normal allocation
process.
node_id
UUID of the node this allocation belongs to.
resource_class
The requested resource class.
state
The state of the allocation.
traits
The requested traits.
updated_at
Timestamp at which the allocation was last updated.
wait(session, timeout=None, ignore_error=False)
Wait for the allocation to become active.
Parameters
• session (Adapter) The session to use for making this request.
• timeout How much (in seconds) to wait for the allocation. The value of
None (the default) means no client-side timeout.
• ignore_error If True, this call will raise an exception if the allocation
reaches the error state. Otherwise the error state is considered successful
and the call returns.
Returns This Allocation instance.
Raises ResourceFailure if allocation fails and ignore_error is False.
Raises ResourceTimeout on timeout.
openstack.baremetal.v1.volume_connector
class openstack.baremetal.v1.volume_connector.VolumeConnector(_synchronized=False,
con-
nec-
tion=None,
**at-
trs)
The base resource
Parameters
• _synchronized (bool) This is not intended to be used directly. See
new() and existing().
• connection (openstack.connection.Connection) Reference to
the Connection being used. Defaults to None to allow Resource objects to
be used without an active Connection, such as in unit tests. Use of self.
_connection in Resource code should protect itself with a check for None.
created_at
Timestamp at which the port was created.
extra
A set of one or more arbitrary metadata key and value pairs.
links
A list of relative links, including the self and bookmark links.
node_id
The UUID of node this port belongs to
type
The types of Volume connector
updated_at
Timestamp at which the port was last updated.
id
The UUID of the port
openstack.baremetal.v1.volume_target
openstack.baremetal_introspection.v1.Introspection
finished_at
Timestamp at which the introspection was finished.
error
The last error message (if any).
id
The UUID of the introspection (matches the node UUID).
is_finished
Whether introspection is finished.
links
A list of relative links, including the self and bookmark links.
started_at
Timestamp at which the introspection was started.
state
The current introspection state.
abort(session)
Abort introspection.
Parameters session (Adapter) The session to use for making this request.
get_data(session, processed=True)
Get introspection data.
Note that the introspection data format is not stable and can vary from environment to envi-
ronment.
Parameters
• session (Adapter) The session to use for making this request.
• processed (bool) Whether to fetch the final processed data (the default)
or the raw unprocessed data as received from the ramdisk.
Returns introspection data from the most recent successful run.
Return type dict
wait(session, timeout=None, ignore_error=False)
Wait for the node to reach the expected state.
Parameters
• session (Adapter) The session to use for making this request.
• timeout How much (in seconds) to wait for the introspection. The value
of None (the default) means no client-side timeout.
• ignore_error If True, this call will raise an exception if the intro-
spection reaches the error state. Otherwise the error state is considered
successful and the call returns.
Returns This Introspection instance.
Raises ResourceFailure if introspection fails and ignore_error is
False.
Raises ResourceTimeout on timeout.
openstack.block_storage.v2.backup
name
backup name
object_count
backup object count
size
The size of the volume, in gibibytes (GiB).
snapshot_id
The UUID of the source volume snapshot.
status
backup status values: creating, available, deleting, error, restoring, error_restoring
updated_at
The date and time when the resource was updated.
volume_id
The UUID of the volume.
create(session, prepend_key=True, base_path=None, **params)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
• params (dict) Additional params to pass.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
restore(session, volume_id=None, name=None)
Restore current backup to volume
Parameters
• session openstack session
• volume_id The ID of the volume to restore the backup to.
• name The name for new volume creation to restore.
Returns Updated backup instance
openstack.block_storage.v2.snapshot
openstack.block_storage.v2.type
openstack.block_storage.v2.volume
metadata
One or more metadata key and value pairs to associate with the volume.
volume_image_metadata
One or more metadata key and value pairs about image
status
One of the following values: creating, available, attaching, in-use deleting, error, er-
ror_deleting, backing-up, restoring-backup, error_restoring. For details on these statuses,
see the Block Storage API documentation.
attachments
TODO(briancurtin): This is currently undocumented in the API.
created_at
The timestamp of this volume creation.
host
The volumes current back-end.
project_id
The project ID associated with current back-end.
user_id
The user ID associated with the volume
migration_status
The status of this volumes migration (None means that a migration is not currently in
progress).
migration_id
The volume ID that this volumes name on the back-end is based on.
replication_status
Status of replication on this volume.
extended_replication_status
Extended replication status on this volume.
consistency_group_id
ID of the consistency group.
replication_driver_data
Data set by the replication driver
is_encrypted
True if this volume is encrypted, False if not. Type: bool
extend(session, size)
Extend a volume size.
Cluster Resources
openstack.clustering.v1.build_info
openstack.clustering.v1.profile_type
support_status
The support status of the profile type
openstack.clustering.v1.profile
openstack.clustering.v1.policy_type
openstack.clustering.v1.policy
project_id
The ID of the project this policy belongs to.
user_id
The ID of the user who created this policy.
created_at
The timestamp when the policy is created.
updated_at
The timestamp when the policy was last updated.
spec
The specification of the policy.
data
A dictionary containing runtime data of the policy.
openstack.clustering.v1.Cluster
created_at
Timestamp of when the cluster was created. Type: datetime object parsed from ISO 8601
formatted string
updated_at
Timestamp of when the cluster was last updated. Type: datetime object parsed from ISO
8601 formatted string
min_size
Lower bound (inclusive) for the size of the cluster.
max_size
Upper bound (inclusive) for the size of the cluster. A value of -1 indicates that there is no
upper limit of cluster size.
desired_capacity
Desired capacity for the cluster. A cluster would be created at the scale specified by this
value.
timeout
Default timeout (in seconds) for cluster operations.
status
A string representation of the cluster status.
status_reason
A string describing the reason why the cluster in current status.
config
A dictionary configuration for cluster.
metadata
A collection of key-value pairs that are attached to the cluster.
data
A dictionary with some runtime data associated with the cluster.
node_ids
A list IDs of nodes that are members of the cluster.
profile_name
Name of the profile used by the cluster.
is_profile_only
Specify whether the cluster update should only pertain to the profile.
dependents
A dictionary with dependency information of the cluster
op(session, operation, **params)
Perform an operation on the cluster.
Parameters
• session A session object used for sending request.
• operation A string representing the operation to be performed.
• params (dict) An optional dict providing the parameters for the opera-
tion.
openstack.clustering.v1.Node
init_at
The timestamp of the node objects initialization. Type: datetime object parsed from ISO
8601 formatted string
created_at
The timestamp of the nodes creation, i.e. the physical object represented by this node is also
created. Type: datetime object parsed from ISO 8601 formatted string
updated_at
The timestamp the node was last updated. Type: datetime object parsed from ISO 8601
formatted string
status
A string indicating the nodes status.
status_reason
A string describing why the node entered its current status.
metadata
A map containing key-value pairs attached to the node.
data
A map containing some runtime data for this node.
details
A map containing the details of the physical object this node represents
dependents
A map containing the dependency of nodes
tainted
Whether the node is tainted. Type: bool
check(session, **params)
An action procedure for the node to check its health status.
Parameters session A session object used for sending request.
Returns A dictionary containing the action ID.
recover(session, **params)
An action procedure for the node to recover.
Parameters session A session object used for sending request.
Returns A dictionary containing the action ID.
op(session, operation, **params)
Perform an operation on the specified node.
Parameters
• session A session object used for sending request.
• operation A string representing the operation to be performed.
• params (dict) An optional dict providing the parameters for the opera-
tion.
Returns A dictionary containing the action ID.
openstack.clustering.v1.cluster_policy
openstack.clustering.v1.receiver
openstack.clustering.v1.action
inputs
A dictionary containing the inputs to the action.
outputs
A dictionary containing the outputs to the action.
depends_on
A list of actions that must finish before this action starts execution.
depended_by
A list of actions that can start only after this action has finished.
created_at
Timestamp when the action is created.
updated_at
Timestamp when the action was last updated.
cluster_id
The ID of cluster which this action runs on.
openstack.clustering.v1.event
user_id
The ID of the user.
project_id
The ID of the project (tenant).
action
The string representation of the action associated with the event.
status
The status of the associated object.
status_reason
A string description of the reason that brought the object into its current status.
meta_data
The metadata of an event object.
Compute Resources
openstack.compute.v2.extension
updated_at
Timestamp when this extension was last updated.
openstack.compute.v2.flavor
extra_specs
A dictionary of the flavors extra-specs key-and-value pairs.
classmethod list(session, paginated=True, base_path=’/flavors/detail’, al-
low_unknown_params=False, **params)
This method is a generator which yields resource objects.
This resource object list generator handles pagination and takes query params for response
filtering.
Parameters
• session (Adapter) The session to use for making this request.
• paginated (bool) True if a GET to this resource returns a paginated
series of responses, or False if a GET returns only one page of data. When
paginated is False only one page of data will be returned regardless of
the APIs support of pagination.
• base_path (str) Base part of the URI for listing resources, if different
from base_path.
• allow_unknown_params (bool) True to accept, but discard un-
known query parameters. This allows getting list of filters and passing ev-
erything known to the server. False will result in validation exception
when unknown query parameters are passed.
• params (dict) These keyword arguments are passed through the
_transpose() method to find if any of them match expected query pa-
rameters to be sent in the params argument to get(). They are additionally
checked against the base_path format string to see if any path fragments
need to be filled in by the contents of this argument.
Returns A generator of Resource objects.
Raises MethodNotSupported if Resource.allow_list is not set to
True.
Raises InvalidResourceQuery if query contains invalid params.
add_tenant_access(session, tenant)
Adds flavor access to a tenant and flavor.
remove_tenant_access(session, tenant)
Removes flavor access to a tenant and flavor.
get_access(session)
Lists tenants who have access to a private flavor
By default, only administrators can manage private flavor access. A private flavor has
is_public set to false while a public flavor has is_public set to true.
Returns List of dicts with flavor_id and tenant_id attributes
fetch_extra_specs(session)
Fetch extra_specs of the flavor
Starting with 2.61 extra_specs are returned with the flavor details, before that a separate call
is required.
create_extra_specs(session, specs)
Creates extra specs for a flavor
get_extra_specs_property(session, prop)
Get individual extra_spec property
update_extra_specs_property(session, prop, val)
Update An Extra Spec For A Flavor
delete_extra_specs_property(session, prop)
Delete An Extra Spec For A Flavor
openstack.compute.v2.image
min_ram
The minimum RAM size. Type: int
progress
If this image is still building, its progress is represented here. Once an image is created,
progres will be 100. Type: int
status
The status of this image.
updated_at
Timestamp when the image was updated.
size
Size of the image in bytes. Type: int
openstack.compute.v2.keypair
name
A name identifying the keypair
private_key
The private key for the keypair
public_key
The SSH public key that is paired with the server.
type
The type of the keypair.
user_id
The user_id for a keypair.
classmethod existing(connection=None, **kwargs)
Create an instance of an existing remote resource.
When creating the instance set the _synchronized parameter of Resource to True to
indicate that it represents the state of an existing server-side resource. As such, all attributes
passed in **kwargs are considered clean, such that an immediate update() call would
not generate a body of attributes to be modified on the server.
Parameters kwargs (dict) Each of the named arguments will be set as at-
tributes on the resulting Resource object.
openstack.compute.v2.limits
total_ram
The maximum RAM size in megabytes.
total_ram_used
The RAM size in megabytes currently in use.
server_groups
The maximum amount of server groups.
server_groups_used
The amount of server groups currently in use.
server_group_members
The maximum number of members in a server group.
openstack.compute.v2.server
created with multiple create, that will all have the same reservation_id. By default, it appears
in the response for administrative users only.
root_device_name
The root device name for the instance By default, it appears in the response for administrative
users only.
scheduler_hints
The dictionary of data to send to the scheduler.
security_groups
A list of applicable security groups. Each group contains keys for description, name, id, and
rules.
server_groups
The UUIDs of the server groups to which the server belongs. Currently this can contain at
most one entry.
status
The state this server is in. Valid values include ACTIVE, BUILDING, DELETED, ERROR,
HARD_REBOOT, PASSWORD, PAUSED, REBOOT, REBUILD, RESCUED, RESIZED,
REVERT_RESIZE, SHUTOFF, SOFT_DELETED, STOPPED, SUSPENDED, UNKNOWN, or
VERIFY_RESIZE.
task_state
The task state of this server.
terminated_at
The timestamp when the server was terminated (if it has been).
trusted_image_certificates
A list of trusted certificate IDs, that were used during image signature verification to verify
the signing certificate.
updated_at
Timestamp of when this server was last updated.
user_data
Configuration information or scripts to use upon launch. Must be Base64 encoded.
user_id
The ID of the owners of this server.
vm_state
The VM state of this server.
change_password(session, new_password)
Change the administrator password to the given password.
get_password(session)
Get the encrypted administrator password.
reboot(session, reboot_type)
Reboot server where reboot_type might be SOFT or HARD.
force_delete(session)
Force delete a server.
openstack.compute.v2.server_interface
port_state
The port state.
server_id
The ID for the server.
openstack.compute.v2.server_ip
Database Resources
openstack.database.v1.database
openstack.database.v1.flavor
openstack.database.v1.instance
status
The status of the instance
volume
The size of the volume
datastore
A dictionary of datastore details, often including type and version keys
id
The ID of this instance
region
The region this instance resides in
hostname
The name of the host
created_at
The timestamp when this instance was created
updated_at
The timestamp when this instance was updated
enable_root_user(session)
Enable login for the root user.
This operation enables login from any host for the root user and provides the user with a
generated root password.
Parameters session (Adapter) The session to use for making this request.
Returns A dictionary with keys name and password specifying the login cre-
dentials.
is_root_enabled(session)
Determine if root is enabled on an instance.
Determine if root is enabled on this particular instance.
Parameters session (Adapter) The session to use for making this request.
Returns True if root user is enabled for a specified database instance or False
otherwise.
restart(session)
Restart the database instance
Returns None
resize(session, flavor_reference)
Resize the database instance
Returns None
resize_volume(session, volume_size)
Resize the volume attached to the instance
Returns None
openstack.database.v1.user
DNS Resources
openstack.dns.v2.zone
attributes
Attributes Key:Value pairs of information about this zone, and the pool the user would like
to place the zone in. This information can be used by the scheduler to place zones on the
correct pool.
created_at
Timestamp when the zone was created
description
Zone description Type: str
email
The administrator email of this zone Type: str
links
Links contains a self pertaining to this zone or a next pertaining to next page
masters
The master list for slaver server to fetch DNS
name
Zone name
pool_id
The pool which manages the zone, assigned by system
project_id
The project id which the zone belongs to
serial
Serial number in the SOA record set in the zone, which identifies the change on the primary
DNS server Type: int
status
Zone status Valid values include PENDING_CREATE, ACTIVE, PENDING_DELETE, ER-
ROR
ttl
SOA TTL time, unit is seconds, default 300, TTL range 300-2147483647 Type: int
type
Zone type, Valid values include PRIMARY, SECONDARY Type: str
updated_at
Timestamp when the zone was last updated
openstack.dns.v2.zone_transfer
openstack.dns.v2.zone_export
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
openstack.dns.v2.zone_import
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
openstack.dns.v2.floating_ip
openstack.dns.v2.recordset
zone_name
The name of the Zone which this recordset belongs to
Identity v2 Resources
openstack.identity.v2.extension
openstack.identity.v2.role
openstack.identity.v2.tenant
openstack.identity.v2.user
is_enabled
Setting this value to False prevents the user from authenticating or receiving authoriza-
tion. Additionally, all pre-existing tokens held by the user are immediately invalidated.
Re-enabling a user does not re-enable pre-existing tokens. Type: bool
name
The name of this user. Type: string
Identity v3 Resources
openstack.identity.v3.credential
openstack.identity.v3.domain
openstack.identity.v3.endpoint
openstack.identity.v3.group
openstack.identity.v3.policy
project_id
The ID for the project.
type
The MIME Media Type of the serialized policy blob. Type: string
user_id
The ID of the user who owns the policy
openstack.identity.v3.project
openstack.identity.v3.service
openstack.identity.v3.trust
trustee_user_id
Represents the user ID who is capable of consuming the trust. Type: string
trustor_user_id
Represents the user ID who created the trust, and whos authorization is being delegated.
Type: string
openstack.identity.v3.user
password
The default form of credential used during authentication. Type: string
password_expires_at
The date and time when the password expires. The time zone is UTC. A None value means
the password never expires. This is a response object attribute, not valid for requests. New
in version 3.7
Image v1 Resources
openstack.image.v1.image
location
A location for the image identified by a URI
min_disk
The minimum disk size in GB that is required to boot the image.
min_ram
The minimum amount of RAM in MB that is required to boot the image.
name
Name for the image. Note that the name of an image is not unique to a Glance node. The
API cannot expect users to know the names of images owned by others.
owner
The ID of the owner, or project, of the image.
owner_id
The ID of the owner, or project, of the image. (backwards compat)
properties
Properties, if any, that are associated with the image.
size
The size of the image data, in bytes.
status
The image status.
updated_at
The timestamp when this image was last updated.
classmethod find(session, name_or_id, ignore_missing=True, **params)
Find a resource by its name or id.
Parameters
• session (Adapter) The session to use for making this request.
• name_or_id This resources identifier, if needed by the request. The de-
fault is None.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• params (dict) Any additional parameters to be passed into underlying
methods, such as to existing() in order to pass on URI parameters.
Returns The Resource object matching the given name or id or None if nothing
matches.
Raises openstack.exceptions.DuplicateResource if more than one
resource is found for this request.
Raises openstack.exceptions.ResourceNotFound if nothing is found
and ignore_missing is False.
Image v2 Resources
openstack.image.v2.image
name
The name of the image.
owner
The ID of the owner, or project, of the image.
owner_id
The ID of the owner, or project, of the image. (backwards compat)
properties
Properties, if any, that are associated with the image.
size
The size of the image data, in bytes.
store
When present, Glance will attempt to store the disk image data in the backing store indicated
by the value of the header. When not present, Glance will store the disk image data in the
backing store that is marked default. Valid values are: file, s3, rbd, swift, cinder, gridfs,
sheepdog, or vsphere.
status
The image status.
updated_at
The date and time when the image was updated.
virtual_size
The virtual size of the image.
visibility
The image visibility.
file
The URL for the virtual machine image file.
locations
A list of URLs to access the image file in external store. This list appears if the
show_multiple_locations option is set to true in the Image services configuration file.
direct_url
The URL to access the image file kept in external store. It appears when you set the
show_image_direct_url option to true in the Image services configuration file.
url
The URL to access the image file kept in external store.
metadata
The location metadata.
architecture
The CPU architecture that must be supported by the hypervisor.
hypervisor_type
The hypervisor type. Note that qemu is used for both QEMU and KVM hypervisor types.
instance_type_rxtx_factor
Optional property allows created servers to have a different bandwidth cap than that defined
in the network they are attached to.
instance_uuid
create this image.
needs_config_drive
Specifies whether the image needs a config drive. mandatory or optional (default if property
is not used).
kernel_id
The ID of an image stored in the Image service that should be used as the kernel when
booting an AMI-style image.
os_distro
The common name of the operating system distribution in lowercase
os_version
The operating system version as specified by the distributor.
needs_secure_boot
Secure Boot is a security standard. When the instance starts, Secure Boot first examines
software such as firmware and OS by their signature and only allows them to run if the
signatures are valid.
os_shutdown_timeout
Time for graceful shutdown
ramdisk_id
The ID of image stored in the Image service that should be used as the ramdisk when booting
an AMI-style image.
vm_mode
The virtual machine mode. This represents the host/guest ABI (application binary interface)
used for the virtual machine.
hw_cpu_sockets
The preferred number of sockets to expose to the guest.
hw_cpu_cores
The preferred number of cores to expose to the guest.
hw_cpu_threads
The preferred number of threads to expose to the guest.
hw_disk_bus
Specifies the type of disk controller to attach disk devices to. One of scsi, virtio, uml, xen,
ide, or usb.
hw_cpu_policy
Used to pin the virtual CPUs (vCPUs) of instances to the hosts physical CPU cores (pCPUs).
hw_cpu_thread_policy
Defines how hardware CPU threads in a simultaneous multithreading-based (SMT) archi-
tecture be used.
hw_rng_model
Adds a random-number generator device to the images instances.
hw_machine_type
For libvirt: Enables booting an ARM system using the specified machine type. For Hyper-V:
Specifies whether the Hyper-V instance will be a generation 1 or generation 2 VM.
hw_scsi_model
Enables the use of VirtIO SCSI (virtio-scsi) to provide block device access for compute
instances; by default, instances use VirtIO Block (virtio-blk).
hw_serial_port_count
Specifies the count of serial ports that should be provided.
hw_video_model
The video image driver used.
hw_video_ram
Maximum RAM for the video image.
hw_watchdog_action
Enables a virtual hardware watchdog device that carries out the specified action if the server
hangs.
os_command_line
The kernel command line to be used by the libvirt driver, instead of the default.
hw_vif_model
Specifies the model of virtual network interface device to use.
is_hw_vif_multiqueue_enabled
If true, this enables the virtio-net multiqueue feature. In this case, the driver sets the number
of queues equal to the number of guest vCPUs. This makes the network performance scale
across a number of vCPUs.
is_hw_boot_menu_enabled
If true, enables the BIOS bootmenu.
vmware_adaptertype
The virtual SCSI or IDE controller used by the hypervisor.
vmware_ostype
A VMware GuestID which describes the operating system installed in the image.
has_auto_disk_config
If true, the root partition on the disk is automatically resized before the instance boots.
os_type
The operating system installed on the image.
os_admin_user
The operating system admin username.
hw_qemu_guest_agent
If true, QEMU guest agent will be exposed to the instance.
os_require_quiesce
If true, require quiesce on snapshot via QEMU guest agent.
schema
The URL for the schema describing a virtual machine image.
deactivate(session)
Deactivate an image
Note: Only administrative users can view image locations for deactivated images.
reactivate(session)
Reactivate an image
Note: The image must exist in order to be reactivated.
upload(session)
Upload data into an existing image
stage(session)
Stage binary image data into an existing image
import_image(session, method=’glance-direct’, uri=None, store=None, stores=None,
all_stores=None, all_stores_must_succeed=None)
Import Image via interoperable image import process
classmethod find(session, name_or_id, ignore_missing=True, **params)
Find a resource by its name or id.
Parameters
• session (Adapter) The session to use for making this request.
• name_or_id This resources identifier, if needed by the request. The de-
fault is None.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• params (dict) Any additional parameters to be passed into underlying
methods, such as to existing() in order to pass on URI parameters.
Returns The Resource object matching the given name or id or None if nothing
matches.
Raises openstack.exceptions.DuplicateResource if more than one
resource is found for this request.
Raises openstack.exceptions.ResourceNotFound if nothing is found
and ignore_missing is False.
openstack.image.v2.member
openstack.image.v2.task
result
A JSON object specifying the outcome of the task.
schema
The URL for schema of the task.
status
The status of the task.
type
The type of task represented by this content.
updated_at
The date and time when the task was updated.
openstack.image.v2.service_info
KeyManager Resources
openstack.key_manager.v1.container
openstack.key_manager.v1.order
openstack.key_manager.v1.secret
payload_content_type
The media type for the content of the payload. (required if payload is included)
payload_content_encoding
The encoding used for the payload to be able to include it in the JSON request. Currently
only base64 is supported. (required if payload is encoded)
fetch(session, requires_id=True, base_path=None, error_message=None)
Get a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• requires_id (boolean) A boolean indicating whether resource ID
should be part of the requested URI.
• base_path (str) Base part of the URI for fetching resources, if different
from base_path.
• error_message (str) An Error message to be returned if requested
object does not exist.
• params (dict) Additional parameters that can be consumed.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_fetch is not set to
True.
Raises ResourceNotFound if the resource was not found.
openstack.load_balancer.v2.load_balancer
is_admin_state_up
The administrative state of the load balancer Type: bool
availability_zone
Name of the target Octavia availability zone
created_at
Timestamp when the load balancer was created
description
The load balancer description
flavor_id
The load balancer flavor ID
listeners
List of listeners associated with this load balancer
name
The load balancer name
operating_status
Operating status of the load balancer
pools
List of pools associated with this load balancer
project_id
The ID of the project this load balancer is associated with.
provider
Provider name for the load balancer.
provisioning_status
The provisioning status of this load balancer
updated_at
Timestamp when the load balancer was last updated
vip_address
VIP address of load balancer
vip_network_id
VIP netowrk ID
vip_port_id
VIP port ID
vip_subnet_id
VIP subnet ID
delete(session, error_message=None)
Delete the remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• kwargs (dict) Parameters that will be passed to _prepare_request()
Returns This Resource instance.
Parameters
• _synchronized (bool) This is not intended to be used directly. See
new() and existing().
• connection (openstack.connection.Connection) Reference to
the Connection being used. Defaults to None to allow Resource objects to
be used without an active Connection, such as in unit tests. Use of self.
_connection in Resource code should protect itself with a check for None.
lb_id
The ID of the load balancer.
commit(session, base_path=None)
Commit the state of the instance to the remote resource.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
• kwargs (dict) Parameters that will be passed to _prepare_request()
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_commit is not set to
True.
openstack.load_balancer.v2.listener
alpn_protocols
List of ALPN protocols.
connection_limit
The maximum number of connections permitted for this load balancer. Default is infinite.
created_at
Timestamp when the listener was created.
default_pool
Default pool to which the requests will be routed.
default_pool_id
ID of default pool. Must have compatible protocol with listener.
default_tls_container_ref
A reference to a container of TLS secrets.
description
Description for the listener.
insert_headers
Dictionary of additional headers insertion into HTTP header.
is_admin_state_up
The administrative state of the listener, which is up True or down False. Type: bool
l7_policies
List of l7policies associated with this listener.
load_balancer_id
The ID of the parent load balancer.
load_balancers
List of load balancers associated with this listener. Type: list of dicts which contain the load
balancer IDs
name
Name of the listener
operating_status
Operating status of the listener.
project_id
The ID of the project this listener is associated with.
protocol
The protocol of the listener, which is TCP, HTTP, HTTPS or TERMINATED_HTTPS.
protocol_port
Port the listener will listen to, e.g. 80.
provisioning_status
The provisioning status of this listener.
sni_container_refs
A list of references to TLS secrets. Type: list
updated_at
Timestamp when the listener was last updated.
timeout_client_data
Frontend client inactivity timeout in milliseconds.
timeout_member_connect
Backend member connection timeout in milliseconds.
timeout_member_data
Backend member inactivity timeout in milliseconds.
timeout_tcp_inspect
Time, in milliseconds, to wait for additional TCP packets for content inspection.
tls_ciphers
Stores a cipher string in OpenSSL format.
tls_versions
A lsit of TLS protocols to be used by the listener
openstack.load_balancer.v2.pool
protocol
The protocol of the pool
provisioning_status
Provisioning status of the pool
tls_ciphers
Stores a string of cipher strings in OpenSSL format.
session_persistence
A JSON object specifying the session persistence for the pool.
tls_versions
A list of TLS protocol versions to be used in by the pool
updated_at
Timestamp when the pool was updated
tls_enabled
Use TLS for connections to backend member servers Type: bool
openstack.load_balancer.v2.member
name
Name of the member.
operating_status
Operating status of the member.
pool_id
The ID of the owning pool.
provisioning_status
The provisioning status of this member.
project_id
The ID of the project this member is associated with.
protocol_port
The port on which the application is hosted.
subnet_id
Subnet ID in which to access this member.
updated_at
Timestamp when the member was last updated.
weight
A positive integer value that indicates the relative portion of traffic that this member should
receive from the pool. For example, a member with a weight of 10 receives five times as
much traffic as a member with weight of 2.
backup
A bool value that indicates whether the member is a backup or not. Backup members only
receive traffic when all non-backup members are down.
openstack.load_balancer.v2.health_monitor
created_at
Properties Timestamp when the health monitor was created.
delay
The time, in seconds, between sending probes to members.
expected_codes
The expected http status codes to get from a successful health check
http_method
The HTTP method that the monitor uses for requests
is_admin_state_up
The administrative state of the health monitor Type: bool
max_retries
The number of successful checks before changing the operating status of the member to
ONLINE.
max_retries_down
The number of allowed check failures before changing the operating status of the member
to ERROR.
name
The health monitor name
operating_status
Operating status of the member.
pools
List of associated pools. Type: list of dicts which contain the pool IDs
pool_id
The ID of the associated Pool
project_id
The ID of the project
provisioning_status
The provisioning status of this member.
timeout
The time, in seconds, after which a health check times out
type
The type of health monitor
updated_at
Timestamp when the member was last updated.
url_path
The HTTP path of the request to test the health of a member
openstack.load_balancer.v2.l7_policy
rules
The list of L7Rules associated with the l7policy
updated_at
Timestamp when the member was last updated.
openstack.load_balancer.v2.l7_rule
rule_value
value to be compared with
openstack.load_balancer.v2.provider
name
The provider name.
description
The provider description.
openstack.load_balancer.v2.flavor_profile
openstack.load_balancer.v2.flavor
openstack.load_balancer.v2.quota
project_id
The ID of the project this quota is associated with.
openstack.load_balancer.v2.amphora
status
The status of the amphora. One of: BOOTING, ALLOCATED, READY, PEND-
ING_CREATE, PENDING_DELETE, DELETED, ERROR.
vrrp_interface
The bound interface name of the vrrp port on the amphora.
vrrp_id
The vrrp groups ID for the amphora.
vrrp_priority
The priority of the amphora in the vrrp group.
cached_zone
The availability zone of a compute instance, cached at create time.
created_at
The UTC date and timestamp when the resource was created.
updated_at
The UTC date and timestamp when the resource was last updated.
image_id
The ID of the glance image used for the amphora.
compute_flavor
The ID of the compute flavor used for the amphora.
openstack.load_balancer.v2.availability_zone_profile
openstack.load_balancer.v2.availability_zone
Network Resources
openstack.network.v2.address_group
addresses
The IP addresses of the address group.
add_addresses(session, addresses)
Add addresses into the address group.
Parameters
• session (Adapter) The session to communicate through.
• addresses (list) The list of address strings.
Returns The response as a AddressGroup object with updated addresses
Raises SDKException on error.
remove_addresses(session, addresses)
Remove addresses from the address group.
Parameters
• session (Adapter) The session to communicate through.
• addresses (list) The list of address strings.
Returns The response as a AddressGroup object with updated addresses
Raises SDKException on error.
openstack.network.v2.address_scope
ip_version
The IP address family of the address scope. Type: int
is_shared
Indicates whether this address scope is shared across all projects. Type: bool
openstack.network.v2.agent
resources_synced
Whether or not the agent is succesffully synced towards placement. Agents supporting the
guaranteed minimum bandwidth feature share their resource view with neutron-server and
neutron-server share this view with placement, resources_synced represents the success of
the latter. The value None means no resource view synchronization to Placement was at-
tempted. true / false values signify the success of the last synchronization attempt. Type:
bool
started_at
Timestamp when the network agent was last started.
topic
The messaging queue topic the network agent subscribes to.
ha_state
The HA state of the L3 agent. This is one of active, standby or fault for HA routers, or None
for other types of routers.
openstack.network.v2.auto_allocated_topology
openstack.network.v2.availability_zone
openstack.network.v2.extension
description
Text describing what the extension does.
links
Links pertaining to this extension.
name
The name of this extension.
updated_at
Timestamp when the extension was last updated.
openstack.network.v2.flavor
openstack.network.v2.floating_ip
qos_policy_id
The ID of the QoS policy attached to the floating IP.
project_id
The ID of the project this floating IP is associated with.
router_id
The ID of an associated router.
status
The floating IP status. Value is ACTIVE or DOWN.
updated_at
Timestamp at which the floating IP was last updated.
subnet_id
The Subnet ID associated with the floating IP.
openstack.network.v2.health_monitor
pool_ids
List of pools associated with this health monitor Type: list of dicts which contain the pool
IDs
pool_id
The ID of the pool associated with this health monitor
project_id
The ID of the project this health monitor is associated with.
timeout
The maximum number of seconds for a monitor to wait for a connection to be established
before it times out. This value must be less than the delay value.
type
The type of probe sent by the load balancer to verify the member state, which is PING, TCP,
HTTP, or HTTPS.
url_path
Path portion of URI that will be probed if type is HTTP(S).
openstack.network.v2.listener
load_balancer_ids
List of load balancers associated with this listener. Type: list of dicts which contain the load
balancer IDs
load_balancer_id
The ID of the load balancer associated with this listener.
name
Name of the listener
project_id
The ID of the project this listener is associated with.
protocol
The protocol of the listener, which is TCP, HTTP, HTTPS or TERMINATED_HTTPS.
protocol_port
Port the listener will listen to, e.g. 80.
sni_container_refs
A list of references to TLS secrets. Type: list
openstack.network.v2.load_balancer
operating_status
Status of load_balancer operating, e.g. ONLINE, OFFLINE.
pool_ids
List of pools associated with this load balancer. Type: list of dicts which contain the pool
IDs
project_id
The ID of the project this load balancer is associated with.
provider
The name of the provider.
provisioning_status
Status of load balancer provisioning, e.g. ACTIVE, INACTIVE.
vip_address
The IP address of the VIP.
vip_port_id
The ID of the port for the VIP.
vip_subnet_id
The ID of the subnet on which to allocate the VIP address.
openstack.network.v2.metering_label
openstack.network.v2.metering_label_rule
openstack.network.v2.network
mtu
Read-only. The maximum transmission unit (MTU) of the network resource.
name
The network name.
project_id
The ID of the project this network is associated with.
provider_network_type
The type of physical network that maps to this network resource. For example, flat, vlan,
vxlan, or gre. Available for multiple provider extensions.
provider_physical_network
The physical network where this network object is implemented. Available for multiple
provider extensions.
provider_segmentation_id
An isolated segment ID on the physical network. The provider network type defines the
segmentation model. Available for multiple provider extensions.
qos_policy_id
The ID of the QoS policy attached to the port.
segments
A list of provider segment objects. Available for multiple provider extensions.
status
The network status.
subnet_ids
The associated subnet IDs. Type: list of strs of the subnet IDs
updated_at
Timestamp when the network was last updated.
is_vlan_transparent
Indicates the VLAN transparency mode of the network
openstack.network.v2.network_ip_availability
openstack.network.v2.network_segment_range
project_id
The ID of the project associated with this network segment range.
network_type
The type of network associated with this network segment range, such as geneve, gre,
vlan or vxlan.
physical_network
The name of the physical network associated with this network segment range.
minimum
The minimum segmentation ID for this network segment range. The network type defines
the segmentation model, VLAN ID for vlan network type and tunnel ID for geneve, gre
and vxlan network types. Type: int
maximum
The maximum segmentation ID for this network segment range. The network type defines
the segmentation model, VLAN ID for vlan network type and tunnel ID for geneve, gre
and vxlan network types. Type: int
used
Mapping of which segmentation ID in the range is used by which tenant. Type: dict
available
List of available segmentation IDs in this network segment range. Type: list
openstack.network.v2.pool
is_admin_state_up
The administrative state of the pool, which is up True or down False. Type: bool
lb_algorithm
The load-balancer algorithm, which is round-robin, least-connections, and so on. This value,
which must be supported, is dependent on the load-balancer provider. Round-robin must be
supported.
listener_ids
List of associated listeners. Type: list of dicts which contain the listener IDs
listener_id
ID of listener associated with this pool
load_balancer_ids
List of associated load balancers. Type: list of dicts which contain the load balancer IDs
load_balancer_id
ID of load balancer associated with this pool
member_ids
List of members that belong to the pool. Type: list of dicts which contain the member IDs
name
Pool name. Does not have to be unique.
project_id
The ID of the project this pool is associated with.
protocol
The protocol of the pool, which is TCP, HTTP, or HTTPS.
provider
The provider name of the load balancer service.
status
Human readable description of the status.
status_description
The status of the network.
subnet_id
The subnet on which the members of the pool will be located.
session_persistence
Session persistence algorithm that should be used (if any). Type: dict with keys “type“ and
“cookie_name“
virtual_ip_id
The ID of the virtual IP (VIP) address.
openstack.network.v2.pool_member
openstack.network.v2.port
device_id
Device ID of this port.
device_owner
Device owner of this port (e.g. network:dhcp).
dns_assignment
DNS assignment for the port.
dns_domain
DNS domain assigned to the port.
dns_name
DNS name for the port.
extra_dhcp_opts
Extra DHCP options.
fixed_ips
IP addresses for the port. Includes the IP address and subnet ID.
is_admin_state_up
The administrative state of the port, which is up True or down False. Type: bool
is_port_security_enabled
The port security status, which is enabled True or disabled False. Type: bool Default:
False
mac_address
The MAC address of an allowed address pair.
name
The port name.
network_id
The ID of the attached network.
numa_affinity_policy
The NUMA affinity policy defined for this port.
project_id
The ID of the project who owns the network. Only administrative users can specify a project
ID other than their own.
propagate_uplink_status
Whether to propagate uplink status of the port. Type: bool
qos_policy_id
The ID of the QoS policy attached to the port.
security_group_ids
The IDs of any attached security groups. Type: list of strs of the security group IDs
status
The port status. Value is ACTIVE or DOWN.
trunk_details
Read-only. The trunk referring to this parent port and its subports. Present for trunk
parent ports if trunk-details extension is loaded. Type: dict with keys: trunk_id,
openstack.network.v2.qos_bandwidth_limit_rule
openstack.network.v2.qos_dscp_marking_rule
openstack.network.v2.qos_minimum_bandwidth_rule
openstack.network.v2.qos_policy
openstack.network.v2.qos_rule_type
openstack.network.v2.quota
load_balancers
The maximum amount of load balancers you can create. Type: int
l7_policies
The maximum amount of L7 policies you can create. Type: int
networks
The maximum amount of networks you can create. Type: int
pools
The maximum amount of pools you can create. Type: int
ports
The maximum amount of ports you can create. Type: int
project_id
The ID of the project these quota values are for.
rbac_policies
The maximum amount of RBAC policies you can create. Type: int
routers
The maximum amount of routers you can create. Type: int
subnets
The maximum amount of subnets you can create. Type: int
subnet_pools
The maximum amount of subnet pools you can create. Type: int
security_group_rules
The maximum amount of security group rules you can create. Type: int
security_groups
The maximum amount of security groups you can create. Type: int
openstack.network.v2.rbac_policy
object_id
ID of the object that this RBAC policy affects.
target_project_id
The ID of the project this RBAC will be enforced.
project_id
The owner project ID.
object_type
Type of the object that this RBAC policy affects.
action
Action for the RBAC policy.
openstack.network.v2.router
is_distributed
The distributed state of the router, which is distributed True or not False. Type: bool
is_ha
The highly-available state of the router, which is highly available True or not False. Type:
bool
name
The router name.
project_id
The ID of the project this router is associated with.
revision_number
Revision number of the router. Type: int
routes
The extra routes configuration for the router.
status
The router status.
updated_at
Timestamp when the router was created.
add_interface(session, **body)
Add an internal interface to a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The body requested to be updated on the router
Returns The body of the response as a dictionary.
Raises SDKException on error.
remove_interface(session, **body)
Remove an internal interface from a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The body requested to be updated on the router
Returns The body of the response as a dictionary.
Raises SDKException on error.
add_extra_routes(session, body)
Add extra routes to a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The request body as documented in the api-ref.
Returns The response as a Router object with the added extra routes.
Raises SDKException on error.
remove_extra_routes(session, body)
Remove extra routes from a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The request body as documented in the api-ref.
Returns The response as a Router object with the extra routes left.
Raises SDKException on error.
add_gateway(session, **body)
Add an external gateway to a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The body requested to be updated on the router
Returns The body of the response as a dictionary.
remove_gateway(session, **body)
Remove an external gateway from a logical router.
Parameters
• session (Adapter) The session to communicate through.
• body (dict) The body requested to be updated on the router
Returns The body of the response as a dictionary.
openstack.network.v2.security_group
description
The security group description.
name
The security group name.
stateful
Whether the security group is stateful or not.
project_id
The ID of the project this security group is associated with.
security_group_rules
A list of SecurityGroupRule objects. Type: list
tenant_id
The ID of the project this security group is associated with.
updated_at
Timestamp when the security group was last updated.
openstack.network.v2.security_group_rule
ether_type
Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress
rules.
port_range_max
The maximum port number in the range that is matched by the security group rule. The
port_range_min attribute constrains the port_range_max attribute. If the protocol is ICMP,
this value must be an ICMP type.
port_range_min
The minimum port number in the range that is matched by the security group rule. If the pro-
tocol is TCP or UDP, this value must be less than or equal to the value of the port_range_max
attribute. If the protocol is ICMP, this value must be an ICMP type.
project_id
The ID of the project this security group rule is associated with.
protocol
The protocol that is matched by the security group rule. Valid values are null, tcp, udp,
and icmp.
remote_group_id
The remote security group ID to be associated with this security group rule. You can specify
either remote_group_id or remote_ip_prefix in the request body.
remote_ip_prefix
The remote IP prefix to be associated with this security group rule. You can specify ei-
ther remote_group_id or remote_ip_prefix in the request body. This attribute
matches the specified IP prefix as the source IP address of the IP packet.
security_group_id
The security group ID to associate with this security group rule.
tenant_id
The ID of the project this security group rule is associated with.
updated_at
Timestamp when the security group rule was last updated.
openstack.network.v2.segment
openstack.network.v2.service_profile
project_id
The owner project ID
openstack.network.v2.service_provider
openstack.network.v2.subnet
allocation_pools
List of allocation pools each of which has a start and an end address for this subnet
cidr
The CIDR.
created_at
Timestamp when the subnet was created.
description
The subnet description.
dns_nameservers
A list of DNS nameservers.
dns_publish_fixed_ip
Whether to publish DNS records for fixed IPs
gateway_ip
The gateway IP address.
host_routes
A list of host routes.
ip_version
The IP version, which is 4 or 6. Type: int
ipv6_address_mode
The IPv6 address modes which are dhcpv6-stateful, dhcpv6-stateless or slaac.
ipv6_ra_mode
The IPv6 router advertisements modes which can be slaac, dhcpv6-stateful, dhcpv6-
stateless.
is_dhcp_enabled
Set to True if DHCP is enabled and False if DHCP is disabled. Type: bool
name
The subnet name.
network_id
The ID of the attached network.
prefix_length
The prefix length to use for subnet allocation from a subnet pool
project_id
The ID of the project this subnet is associated with.
segment_id
The ID of the segment this subnet is associated with.
service_types
Service types for this subnet
subnet_pool_id
The subnet pool ID from which to obtain a CIDR.
updated_at
Timestamp when the subnet was last updated.
use_default_subnet_pool
Whether to use the default subnet pool to obtain a CIDR.
openstack.network.v2.subnet_pool
name
The subnet pool name.
project_id
The ID of the project that owns the subnet pool.
prefixes
A list of subnet prefixes that are assigned to the subnet pool. The adjacent prefixes are
merged and treated as a single prefix. Type: list
revision_number
Revision number of the subnet pool. Type: int
updated_at
Timestamp when the subnet pool was last updated.
Orchestration Resources
openstack.orchestration.v1.stack
environment_files
An ordered list of names for environment files found in the files dict.
files
Additional files referenced in the template or the environment
files_container
Name of the container in swift that has child templates and environment files.
is_rollback_disabled
Whether the stack will support a rollback operation on stack create/update failures. Type:
bool
links
A list of dictionaries containing links relevant to the stack.
name
Name of the stack.
notification_topics
Placeholder for future extensions where stack related events can be published.
outputs
A list containing output keys and values from the stack, if any.
owner_id
The ID of the owner stack if any.
parameters
A dictionary containing the parameter names and values for the stack.
parent_id
The ID of the parent stack if any
replaced
A list of resource objects that will be replaced if a stack update is performed.
status
A string representation of the stack status, e.g. CREATE_COMPLETE.
status_reason
A text explaining how the stack transits to its current status.
tags
A list of strings used as tags on the stack
template
A dict containing the template use for stack creation.
template_description
Stack template description text. Currently contains the same text as that of the
description property.
template_url
A string containing the URL where a stack template can be found.
timeout_mins
Stack operation timeout in minutes.
unchanged
A list of resource objects that will remain unchanged if a stack update is performed.
updated
A list of resource objects that will have their properties updated in place if a stack update is
performed.
updated_at
Timestamp of last update on the stack.
user_project_id
The ID of the user project created for this stack.
create(session, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
• params (dict) Additional params to pass.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
commit(session, base_path=None)
Commit the state of the instance to the remote resource.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
• kwargs (dict) Parameters that will be passed to _prepare_request()
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_commit is not set to
True.
update([E ], **F) → None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present
and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed
by: for k in F: D[k] = F[k]
fetch(session, requires_id=True, base_path=None, error_message=None, re-
solve_outputs=True)
Get a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• requires_id (boolean) A boolean indicating whether resource ID
should be part of the requested URI.
• base_path (str) Base part of the URI for fetching resources, if different
from base_path.
• error_message (str) An Error message to be returned if requested
object does not exist.
• params (dict) Additional parameters that can be consumed.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_fetch is not set to
True.
Raises ResourceNotFound if the resource was not found.
classmethod find(session, name_or_id, ignore_missing=True, **params)
Find a resource by its name or id.
Parameters
• session (Adapter) The session to use for making this request.
• name_or_id This resources identifier, if needed by the request. The de-
fault is None.
• ignore_missing (bool) When set to False ResourceNotFound
will be raised when the resource does not exist. When set to True, None
will be returned when attempting to find a nonexistent resource.
• params (dict) Any additional parameters to be passed into underlying
methods, such as to existing() in order to pass on URI parameters.
Returns The Resource object matching the given name or id or None if nothing
matches.
Raises openstack.exceptions.DuplicateResource if more than one
resource is found for this request.
Raises openstack.exceptions.ResourceNotFound if nothing is found
and ignore_missing is False.
openstack.orchestration.v1.resource
openstack.object_store.v1.account
openstack.object_store.v1.container
name
The name of the container.
count
The number of objects in the container.
bytes
The total number of bytes that are stored in Object Storage for the container.
object_count
The number of objects.
bytes_used
The count of bytes used in total.
timestamp
The timestamp of the transaction.
is_newest
If set to True, Object Storage queries all replicas to return the most recent one. If you omit
this header, Object Storage responds faster after it finds one valid replica. Because setting
this header to True is more expensive for the back end, use it only when it is absolutely
needed. Type: bool
read_ACL
The ACL that grants read access. If not set, this header is not returned by this operation.
write_ACL
The ACL that grants write access. If not set, this header is not returned by this operation.
sync_to
The destination for container synchronization. If not set, this header is not returned by this
operation.
sync_key
The secret key for container synchronization. If not set, this header is not returned by this
operation.
versions_location
Enables versioning on this container. The value is the name of another container. You
must UTF-8-encode and then URL-encode the name before you include it in the header. To
disable versioning, set the header to an empty string.
content_type
The MIME type of the list of names.
is_content_type_detected
If set to true, Object Storage guesses the content type based on the file extension and ignores
the value sent in the Content-Type header, if present. Type: bool
if_none_match
In combination with Expect: 100-Continue, specify an If-None-Match: * header to query
whether the server already has a copy of the object before any data is sent.
meta_temp_url_key
The secret key value for temporary URLs. If not set, this header is not returned by this
operation.
meta_temp_url_key_2
A second secret key value for temporary URLs. If not set, this header is not returned by this
operation.
classmethod new(**kwargs)
Create a new instance of this resource.
When creating the instance set the _synchronized parameter of Resource to False
to indicate that the resource does not yet exist on the server side. This marks all attributes
passed in **kwargs as dirty on the resource, and thusly tracked as necessary in subsequent
calls such as update().
Parameters kwargs (dict) Each of the named arguments will be set as at-
tributes on the resulting Resource object.
create(session, prepend_key=True, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
set_temp_url_key(proxy, key, secondary=False)
Set the temporary url key for a container.
Parameters
• proxy (Proxy) The proxy to use for making this request.
• container The value can be the name of a container or a Container
instance.
• key Text of the key to use.
• secondary (bool) Whether this should set the second key. (defaults to
False)
openstack.object_store.v1.obj
value is not quoted. For manifest objects, this value is the MD5 checksum of the concate-
nated string of MD5 checksums and ETags for each of the segments in the manifest, and
not the MD5 checksum of the content that was downloaded. Also the value is enclosed in
double-quote characters. You are strongly recommended to compute the MD5 checksum of
the response body as it is received and compare this value with the one in the ETag header.
If they differ, the content was corrupted, so retry the operation.
is_static_large_object
Set to True if this object is a static large object manifest object. Type: bool
content_encoding
If set, the value of the Content-Encoding metadata. If not set, this header is not returned by
this operation.
content_disposition
If set, specifies the override behavior for the browser. For example, this header might specify
that the browser use a download program to save this file rather than show the file, which is
the default. If not set, this header is not returned by this operation.
delete_after
Specifies the number of seconds after which the object is removed. Internally, the Object
Storage system stores this value in the X-Delete-At metadata item.
delete_at
If set, the time when the object will be deleted by the system in the format of a UNIX Epoch
timestamp. If not set, this header is not returned by this operation.
object_manifest
If set, to this is a dynamic large object manifest object. The value is the container and object
name prefix of the segment objects in the form container/prefix.
timestamp
The timestamp of the transaction.
last_modified_at
The date and time that the object was created or the last time that the metadata was changed.
transfer_encoding
Set to chunked to enable chunked transfer encoding. If used, do not set the Content-Length
header to a non-zero value.
is_content_type_detected
If set to true, Object Storage guesses the content type based on the file extension and ignores
the value sent in the Content-Type header, if present. Type: bool
copy_from
If set, this is the name of an object used to create the new object by copying the X-Copy-
From object. The value is in form {container}/{object}. You must UTF-8-encode and then
URL-encode the names of the container and object before you include them in the header.
Using PUT with X-Copy-From has the same effect as using the COPY operation to copy an
object.
create(session, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
openstack.workflow.v2.execution
output
The output of the workflow
created_at
The time at which the Execution was created
updated_at
The time at which the Execution was updated
create(session, prepend_key=True, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
• params (dict) Additional params to pass.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
openstack.workflow.v2.workflow
scope
Can be either private or public
project_id
The ID of the associated project
created_at
The time at which the workflow was created
updated_at
The time at which the workflow was created
create(session, prepend_key=True, base_path=None)
Create a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource creation request. Default to True.
• base_path (str) Base part of the URI for creating resources, if different
from base_path.
• params (dict) Additional params to pass.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_create is not set to
True.
Low-Level Classes
The following classes are not commonly used by application developers, but are used to construct appli-
cations to talk to OpenStack APIs. Typically these parts are managed through the Connection Interface,
but their use can be customized.
Note: This class is in the process of being applied as the new base class for resources around the
OpenStack SDK. Once that has been completed, this module will be drop the 2 suffix and be the
only resource module.
Resource
The Resource class is a base class that represent a remote resource. The attributes that comprise a
request or response for this resource are specified as class members on the Resource subclass where their
values are of a component type, including Body, Header, and URI.
For update management, Resource employs a series of _ComponentManager instances to look
after the attributes of that particular component type. This is particularly useful for Body and Header
types, so that only the values necessary are sent in requests to the server.
When making requests, each of the managers are looked at to gather the necessary URI, body, and
header data to build a request to be sent via keystoneauths sessions. Responses from keystoneauth are
then converted into this Resource class appropriate components and types and then returned to the caller.
Components
allow_empty_commit = False
Commits happen without header or body being dirty.
commit_method = 'PUT'
Method for committing a resource (PUT, PATCH, POST)
create_method = 'POST'
Method for creating a resource (POST, PUT)
commit_jsonpatch = False
Whether commit uses JSON patch format.
requires_id = True
Do calls for this resource require an id
create_requires_id = None
Whether create requires an ID (determined from method if None).
create_exclude_id_from_body = False
Whether create should exclude ID in the body of the request.
has_body = True
Do responses for this resource have bodies
create_returns_body = None
Does create returns a body (if False requires ID), defaults to has_body
microversion = None
API microversion (string or None) this Resource was loaded with
keys() → a set-like object providing a view on Ds keys
items() → a set-like object providing a view on Ds items
classmethod new(**kwargs)
Create a new instance of this resource.
When creating the instance set the _synchronized parameter of Resource to False
to indicate that the resource does not yet exist on the server side. This marks all attributes
passed in **kwargs as dirty on the resource, and thusly tracked as necessary in subsequent
calls such as update().
Parameters kwargs (dict) Each of the named arguments will be set as at-
tributes on the resulting Resource object.
classmethod existing(connection=None, **kwargs)
Create an instance of an existing remote resource.
When creating the instance set the _synchronized parameter of Resource to True to
indicate that it represents the state of an existing server-side resource. As such, all attributes
passed in **kwargs are considered clean, such that an immediate update() call would
not generate a body of attributes to be modified on the server.
Parameters kwargs (dict) Each of the named arguments will be set as at-
tributes on the resulting Resource object.
to_dict(body=True, headers=True, computed=True, ignore_none=False, origi-
nal_names=False, _to_munch=False)
Return a dictionary of this resources contents
Parameters
• base_path (str) Base part of the URI for fetching resources, if different
from base_path.
• error_message (str) An Error message to be returned if requested
object does not exist.
• params (dict) Additional parameters that can be consumed.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_fetch is not set to
True.
Raises ResourceNotFound if the resource was not found.
head(session, base_path=None)
Get headers from a remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• base_path (str) Base part of the URI for fetching resources, if different
from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_head is not set to
True.
Raises ResourceNotFound if the resource was not found.
property requires_commit
Whether the next commit() call will do anything.
commit(session, prepend_key=True, has_body=True, retry_on_conflict=None,
base_path=None, **kwargs)
Commit the state of the instance to the remote resource.
Parameters
• session (Adapter) The session to use for making this request.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
• kwargs (dict) Parameters that will be passed to _prepare_request()
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_commit is not set to
True.
patch(session, patch=None, prepend_key=True, has_body=True,
retry_on_conflict=None, base_path=None)
Patch the remote resource.
Allows modifying the resource by providing a list of JSON patches to apply to it. The
patches can use both the original (server-side) and SDK field names.
Parameters
• session (Adapter) The session to use for making this request.
• patch Additional JSON patch as a list or one patch item. If provided, it is
applied on top of any changes to the current resource.
• prepend_key A boolean indicating whether the resource_key should be
prepended in a resource update request. Default to True.
• retry_on_conflict (bool) Whether to enable retries on HTTP
CONFLICT (409). Value of None leaves the Adapter defaults.
• base_path (str) Base part of the URI for modifying resources, if dif-
ferent from base_path.
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_patch is not set to
True.
delete(session, error_message=None, **kwargs)
Delete the remote resource based on this instance.
Parameters
• session (Adapter) The session to use for making this request.
• kwargs (dict) Parameters that will be passed to _prepare_request()
Returns This Resource instance.
Raises MethodNotSupported if Resource.allow_commit is not set to
True.
Raises ResourceNotFound if the resource was not found.
classmethod list(session, paginated=True, base_path=None, al-
low_unknown_params=False, **params)
This method is a generator which yields resource objects.
This resource object list generator handles pagination and takes query params for response
filtering.
Parameters
• session (Adapter) The session to use for making this request.
• paginated (bool) True if a GET to this resource returns a paginated
series of responses, or False if a GET returns only one page of data. When
paginated is False only one page of data will be returned regardless of
the APIs support of pagination.
• base_path (str) Base part of the URI for listing resources, if different
from base_path.
• allow_unknown_params (bool) True to accept, but discard un-
known query parameters. This allows getting list of filters and passing ev-
ServiceDescription
ServiceDescription object
class openstack.service_description.ServiceDescription(service_type,
sup-
ported_versions=None,
aliases=None)
Class describing how to interact with a REST service.
Each service in an OpenStack cloud needs to be found by looking for it in the catalog. Once the
endpoint is found, REST calls can be made, but a Proxy class and some Resource objects are
needed to provide an object interface.
Utilities
2.2 Presentations
This document contains a presentation in presentty format. If you want to walk through it like a presen-
tation, install presentty and run:
presentty doc/source/user/multi-cloud-demo.rst
The content is hopefully helpful even if its not being narrated, so its being included in the shade docs.
Who am I?
Monty Taylor
• OpenStack Infra Core
• irc: mordred
• twitter: @e_monty
shade
• a task and end-user oriented Python library
• abstracts deployment differences
• designed for multi-cloud
• simple to use
• massive scale
– optional advanced features to handle 20k servers a day
• Initial logic/design extracted from nodepool
• Librified to re-use in Ansible
• https://opendev.org/openstack/shade
• [email protected]
• #openstack-shade on freenode
Complete Example
Cloud Terminology
Lets define a few terms, so that we can use them with ease:
• cloud - logically related collection of services
• region - completely independent subset of a given cloud
• patron - human who has an account
• user - account on a cloud
• project - logical collection of cloud resources
• domain - collection of users and projects
HTTP Sessions
Cloud Regions
In clouds with multiple domains, project and user names are only unique within a region.
• Names require domain information for uniqueness. IDs do not.
• Providing domain information when not needed is fine.
• project_name requires project_domain_name or project_domain_id
• project_id does not
• username requires user_domain_name or user_domain_id
• user_id does not
Confused Yet?
clouds.yaml
Information about the clouds you want to connect to is stored in a file called clouds.yaml.
clouds.yaml can be in your homedir: ~/.config/openstack/clouds.yaml or system-wide:
/etc/openstack/clouds.yaml.
Information in your homedir, if it exists, takes precedence.
Full docs on clouds.yaml are at https://docs.openstack.org/os-client-config/latest/
Config Terminology
clouds:
my-citycloud:
profile: citycloud
auth:
username: mordred
project_id: 65222a4d09ea4c68934fa1028c77f394
user_domain_id: d0919bd5e8d74e49adf0e145807ffc38
project_domain_id: d0919bd5e8d74e49adf0e145807ffc38
secure.yaml
Example secure.yaml
clouds:
my-citycloud:
auth:
password: XXXXXXXX
more clouds.yaml
my-vexxhost:
identity_api_version: 3
image_endpoint_override: https://image-ca-ymq-1.vexxhost.net/v2
profile: vexxhost
auth:
user_domain_id: default
project_domain_id: default
project_name: d8af8a8f-a573-48e6-898a-af333b970a2d
username: 0b8c435b-cc4d-4e05-8a47-a2ada0539af1
my-internap:
auth:
auth_url: https://identity.api.cloud.iweb.com
username: api-55f9a00fb2619
project_name: inap-17037
identity_api_version: 3
floating_ip_source: None
regions:
- name: ams01
values:
networks:
- name: inap-17037-WAN1654
routes_externally: true
default_interface: true
- name: inap-17037-LAN3631
routes_externally: false
Step By Step
Logging
• doc/source/examples/debug-logging.py
cloud = openstack.connect(
cloud='my-vexxhost', region_name='ca-ymq-1')
cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]')
• doc/source/examples/http-debug-logging.py
cloud = openstack.connect(
cloud='my-vexxhost', region_name='ca-ymq-1')
cloud.get_image('Ubuntu 16.04.1 LTS [2017-03-03]')
Cloud Regions
Upload an Image
Find a flavor
Create a server
• my-vexxhost
– Boot server
– Wait for status==ACTIVE
• my-internap
– Boot server on network inap-17037-WAN1654
– Wait for status==ACTIVE
• my-citycloud
– Boot server
– Wait for status==ACTIVE
– Find the port for the fixed_ip for server
– Create floating-ip on that port
– Wait for floating-ip to attach
Delete Servers
Munch Objects
• list_servers
• search_servers
• get_server
• create_server
• delete_server
• update_server
For other things, its still {verb}_{noun}
• attach_volume
• wait_for_server
• add_auto_ip
Cleanup Script
Normalization
• https://docs.openstack.org/shade/latest/user/model.html#image
• doc/source/examples/normalization.py
cloud = openstack.connect(
cloud='fuga', region_name='cystack', strict=True)
image = cloud.get_image(
'Ubuntu 16.04 LTS - Xenial Xerus - 64-bit - Fuga Cloud Based Image')
cloud.pprint(image)
How Did I Find the Image Name for the Last Example?
print("\n\nFull Server\n\n")
(continues on next page)
print("\n\nBare Server\n\n")
cloud.pprint(cloud.get_server('my-server', bare=True))
finally:
# Delete it - this is a demo
cloud.delete_server(server, wait=True, delete_ips=True)
Exceptions
cloud = openstack.connect(
cloud='datacentred', app_name='AmazingApp', app_version='1.0')
cloud.list_networks()
• Default max_file_size is 5G
• This is a conference demo
• Lets force a segment_size
• One MILLION bytes
• doc/source/examples/upload-object.py
Service Conditionals
• Sometimes clouds are weird and figuring that out wont work
clouds:
rax:
profile: rackspace
auth:
username: mordred
project_id: 245018
# This is already in profile: rackspace
has_network: false
Coming Soon
• Completion of RESTification
• Full version discovery support
• Multi-cloud facade layer
• Microversion support (talk tomorrow)
• Completion of caching tier (talk tomorrow)
• All of you helping hacking on shade!!! (were friendly)
THREE
FOR CONTRIBUTORS
This section of documentation pertains to those who wish to contribute to the development of this SDK.
If youre looking for documentation on how to use the SDK to build applications, please see the user
section.
The OpenStack SDK is a OpenStack project aimed at providing a complete software development kit
for the programs which make up the OpenStack community. It is a Python library with corresponding
documentation, examples, and tools released under the Apache 2 license.
A Brief History
openstacksdk started its life as three different libraries: shade, os-client-config and python-openstacksdk.
shade started its life as some code inside of OpenStack Infras nodepool project, and as some code
inside of the Ansible OpenStack Modules. Ansible had a bunch of different OpenStack related modules,
and there was a ton of duplicated code. Eventually, between refactoring that duplication into an internal
library, and adding the logic and features that the OpenStack Infra team had developed to run client
applications at scale, it turned out that wed written nine-tenths of what wed need to have a standalone
library.
Because of its background from nodepool, shade contained abstractions to work around deployment
differences and is resource oriented rather than service oriented. This allows a user to think about
Security Groups without having to know whether Security Groups are provided by Nova or Neutron
on a given cloud. On the other hand, as an interface that provides an abstraction, it deviates from the
published OpenStack REST API and adds its own opinions, which may not get in the way of more
advanced users with specific needs.
os-client-config was a library for collecting client configuration for using an OpenStack cloud
in a consistent and comprehensive manner, which introduced the clouds.yaml file for expressing
named cloud configurations.
python-openstacksdk was a library that exposed the OpenStack APIs to developers in a consistent
and predictable manner.
After a while it became clear that there was value in both the high-level layer that contains additional
business logic and the lower-level SDK that exposes services and their resources faithfully and consis-
tently as Python objects.
553
OpenStackSDK Documentation, Release 0.52.1.dev3
Even with both of those layers, it is still beneficial at times to be able to make direct REST calls and to
do so with the same properly configured Session from python-requests.
This led to the merge of the three projects.
The original contents of the shade library have been moved into openstack.cloud and os-client-
config has been moved in to openstack.config.
Contributing to openstacksdk
If youre interested in contributing to the openstacksdk project, the following will help get you started.
In order to contribute to the openstacksdk project, you need to have signed OpenStacks contributors
agreement.
Please read DeveloperWorkflow before sending your first patch for review. Pull requests submitted
through GitHub will be ignored.
See also:
• https://wiki.openstack.org/wiki/How_To_Contribute
• https://wiki.openstack.org/wiki/CLA
IRC
The developers of this project are available in the #openstack-sdks channel on Freenode. This channel
includes conversation on SDKs and tools within the general OpenStack community, including Open-
StackClient as well as occasional talk about SDKs created for languages outside of Python.
The openstack-discuss mailing list fields questions of all types on OpenStack. Using the [sdk] filter
to begin your email subject will ensure that the message gets to SDK developers.
We are a bit stricter than usual in the coding standards department. Its a good idea to read through the
coding section.
In the beginning, there were no guidelines. And it was good. But that didnt last long. As more and more
people added more and more code, we realized that we needed a set of coding standards to make sure
that the openstacksdk API at least attempted to display some form of consistency.
Thus, these coding standards/guidelines were developed. Note that not all of openstacksdk adheres to
these standards just yet. Some older code has not been updated because we need to maintain backward
compatibility. Some of it just hasnt been changed yet. But be clear, all new code must adhere to these
guidelines.
Below are the patterns that we expect openstacksdk developers to follow.
Release Notes
openstacksdk uses reno for managing its release notes. A new release note should be added to your
contribution anytime you add new API calls, fix significant bugs, add new functionality or parameters to
existing API calls, or make any other significant changes to the code base that we should draw attention
to for the user base.
It is not necessary to add release notes for minor fixes, such as correction of documentation typos, minor
code cleanup or reorganization, or any other change that a user would not notice through normal usage.
Exceptions
Exceptions should NEVER be wrapped and re-raised inside of a new exception. This removes important
debug information from the user. All of the exceptions should be raised correctly the first time.
• For those methods that should behave differently for omitted or None-valued parameters, use the
_utils.valid_kwargs decorator. Notably: all Neutron update_* functions.
• Deleting a resource should return True if the delete succeeded, or False if the resource was not
found.
Returned Resources
Complex objects returned to the caller must be a munch.Munch type. The open-
stack.proxy._ShadeAdapter class makes resources into munch.Munch.
All objects should be normalized. It is shades purpose in life to make OpenStack consistent for end
users, and this means not trusting the clouds to return consistent objects. There should be a normalize
function in openstack/cloud/_normalize.py that is applied to objects before returning them to the user.
See Data Model for further details on object model requirements.
Fields should not be in the normalization contract if we cannot commit to providing them to all users.
Fields should be renamed in normalization to be consistent with the rest of openstack.cloud. For in-
stance, nothing in openstack.cloud exposes the legacy OpenStack concept of tenant to a user, but instead
uses project even if the cloud in question uses tenant.
• Recognize that not all cloud providers support Neutron, so never assume it will be present. If a
task can be handled by either Neutron or Nova, code it to be handled by either.
• For methods that accept either a Nova pool or Neutron network, the parameter should just refer to
the network, but documentation of it should explain about the pool. See: create_floating_ip() and
available_floating_ip() methods.
Tests
The first step towards contributing code and documentation is to setup your development environment.
We use a pretty standard setup, but it is fully documented in our setup section.
Required Tools
Python
As the OpenStack SDK is developed in Python, you will need at least one version of Python installed.
It is strongly preferred that you have at least one of version 2 and one of version 3 so that your tests
are run against both. Our continuous integration system runs against several versions, so ultimately we
will have the proper test coverage, but having multiple versions locally results in less time spent in code
review when changes unexpectedly break other versions.
Python can be downloaded from https://www.python.org/downloads.
virtualenv
In order to isolate our development environment from the system-based Python installation, we use
virtualenv. This allows us to install all of our necessary dependencies without interfering with anything
else, and preventing others from interfering with us. Virtualenv must be installed on your system in
order to use it, and it can be had from PyPI, via pip, as follows. Note that you may need to run this as an
administrator in some situations.:
You can create a virtualenv in any location. A common usage is to store all of your virtualenvs in the
same place, such as under your home directory. To create a virtualenv for the default Python, run the
following:
$ virtualenv $HOME/envs/sdk
When you want to enable your environment so that you can develop inside of it, you activate it. To
activate an environment, run the /bin/activate script inside of it, like the following:
$ source $HOME/envs/sdk3/bin/activate
(sdk3)$
Once you are activated, you will see the environment name in front of your command prompt. In order
to exit that environment, run the deactivate command.
tox
We use tox as our test runner, which allows us to run the same test commands against multiple versions
of Python. Inside any of the virtualenvs you use for working on the SDK, run the following to install
tox into it.:
Git
The source of the OpenStack SDK is stored in Git. In order to work with our source repository, you
must have Git installed on your system. If your system has a package manager, it can likely be had from
there. If not, you can find downloads or the source at http://git-scm.com.
Note: Before checking out the code, please read the OpenStack Developers Guide for details on how
to use the continuous integration and code review systems that we use.
Installing Dependencies
In order to work with the SDK locally, such as in the interactive interpreter or to run example scripts,
you need to install the projects dependencies.:
After the downloads and installs are complete, youll have a fully functional environment to use the SDK
in.
Our documentation is written in reStructured Text and is built using Sphinx. A docs command is
available in our tox.ini, allowing you to build the documentation like youd run tests. The docs
command is not evaluated by default.:
That command will cause the documentation, which lives in the docs folder, to be built. HTML output
is the most commonly referenced, which is located in docs/build/html.
3.1.6 Testing
The project contains three test packages, one for unit tests, one for functional tests and one for ex-
amples tests. The openstack.tests.unit package tests the SDKs features in isolation. The
openstack.tests.functional and openstack.tests.examples packages test the SDKs
features and examples against an OpenStack cloud.
Testing
The tests are run with tox and configured in tox.ini. The test results are tracked by testr and config-
ured in .testr.conf.
Unit Tests
Run
In order to run the entire unit test suite, simply run the tox command inside of your source checkout.
This will attempt to run every test command listed inside of tox.ini, which includes Python 3.8, and
a PEP 8 check. You should run the full test suite on all versions before submitting changes for review in
order to avoid unexpected failures in the continuous integration system.:
(sdk3)$ tox
...
py38: commands succeeded
pep8: commands succeeded
congratulations :)
During development, it may be more convenient to run a subset of the tests to keep test time to a
minimum. You can choose to run the tests only on one version. A step further is to run only the tests
you are working on.:
Functional Tests
The functional tests assume that you have a public or private OpenStack cloud that you can run the tests
against. The tests must be able to be run against public clouds but first and foremost they must be run
against OpenStack. In practice, this means that the tests should initially be run against a stable branch
of DevStack.
os-client-config
To connect the functional tests to an OpenStack cloud we use os-client-config. To setup os-client-config
create a clouds.yaml file in the root of your source checkout.
This is an example of a minimal configuration for a clouds.yaml that connects the functional tests
to a DevStack instance. Note that one cloud under clouds must be named test_cloud.
clouds:
test_cloud:
region_name: RegionOne
auth:
auth_url: http://xxx.xxx.xxx.xxx:5000/v2.0/
username: demo
password: secrete
project_name: demo
rackspace:
cloud: rackspace
auth:
username: joe
password: joes-password
project_name: 123123
region_name: IAD
example:
image_name: fedora-20.x86_64
flavor_name: m1.small
network_name: private
Run
Functional tests are run against both Python 2 and 3. In order to run the entire functional test suite, run
the tox -e functional and tox -e functional3 command inside of your source checkout.
This will attempt to run every test command under /openstack/tests/functional/ in the
source tree. You should run the full functional test suite before submitting changes for review in order
to avoid unexpected failures in the continuous integration system.:
Examples Tests
Similar to the functional tests, the examples tests assume that you have a public or private OpenStack
cloud that you can run the tests against. In practice, this means that the tests should initially be run
against a stable branch of DevStack. And like the functional tests, the examples tests connect to an
OpenStack cloud using os-client-config. See the functional tests instructions for information on setting
up DevStack and os-client-config.
Run
In order to run the entire examples test suite, simply run the tox -e examples command inside
of your source checkout. This will attempt to run every test command under /openstack/tests/
examples/ in the source tree.:
The project contains a top-level openstack package, which houses several modules that form the
foundation upon which each services API is built on. Under the openstack package are packages for
each of those services, such as openstack.compute.
openstack/
connection.py
resource.py
compute/
compute_service.py
v2/
server.py
_proxy.py
tests/
compute/
v2/
test_server.py
Resource
The openstack.resource.Resource base class is the building block of any service implemen-
tation. Resource objects correspond to the resources each services REST API works with, so the
openstack.compute.v2.server.Server subclass maps to the compute services https://
openstack:1234/v2/servers resource.
The base Resource contains methods to support the typical CRUD operations supported by REST
APIs, and handles the construction of URLs and calling the appropriate HTTP verb on the given
Adapter.
Values sent to or returned from the service are implemented as attributes on the Resource subclass
with type openstack.resource.prop. The prop is created with the exact name of what the API
expects, and can optionally include a type to be validated against on requests. You should choose an
attribute name that follows PEP-8, regardless of what the server-side expects, as this prop becomes a
mapping between the two.:
There are six additional attributes which the Resource class checks before making requests
to the REST API. allow_create, allow_retreive, allow_commit, allow_delete,
allow_head, and allow_list are set to True or False, and are checked before making the
corresponding method call.
The base_path attribute should be set to the URL which corresponds to this resource. Many
base_paths are simple, such as "/servers". For base_paths which are composed of
non-static information, Pythons string replacement is used, e.g., base_path = "/servers/
%(server_id)s/ips".
resource_key and resources_key are attributes to set when a Resource returns more than one
item in a response, or otherwise requires a key to obtain the response value. For example, the Server
class sets resource_key = "server" as an individual Server is stored in a dictionary keyed
with the singular noun, and resource_keys = "servers" as multiple Servers are stored in a
dictionary keyed with the plural noun in the response.
Proxy
Each service implements a Proxy class based on Proxy, within the openstack/
<program_name>/vX/_proxy.py module. For example, the v2 compute services Proxy
exists in openstack/compute/v2/_proxy.py.
The Proxy class is based on Adapter.
class openstack.proxy.Proxy(session, statsd_client=None,
statsd_prefix=None, prometheus_counter=None,
prometheus_histogram=None, influxdb_config=None,
influxdb_client=None, *args, **kwargs)
Bases: keystoneauth1.adapter.Adapter
Represents a service.
retriable_status_codes = None
HTTP status codes that should be retried by default.
Connection
Does this SDK not do what you need it to do? Is it missing a service? Are you a developer on another
project who wants to add their service? Youre in the right place. Below are examples of how to add new
features to the OpenStack SDK.
This guide will walk you through how to add resources for a service.
Naming Conventions
Above all, names across this project conform to Pythons naming standards, as laid out in PEP 8.
The relevant details we need to know are as follows:
• Module names are lower case, and separated by underscores if more than one word. For example,
openstack.object_store
• Class names are capitalized, with no spacing, and each subsequent word is capitalized in a name.
For example, ServerMetadata.
• Attributes on classes, including methods, are lower case and separated by underscores. For exam-
ple, allow_list or get_data.
Services
Services in the OpenStack SDK are named after their program name, not their code name. For example,
the project often known as Nova is always called compute within this SDK.
This guide walks through creating service for an OpenStack program called Fake. Following our guide-
lines, the code for its service would live under the openstack.fake namespace. What follows is the
creation of a Resource class for the Fake service.
Resources
Resources are named after the server-side resource, which is set in the base_path attribute of the
resource class. This guide creates a resource class for the /fake server resource, so the resource
module is called fake.py and the class is called Fake.
An Example
openstack/fake/fake_service.py
10 supported_versions = {
11 '2': _proxy_v2.Proxy,
12 }
openstack/fake/v2/fake.py
fake.Fake Attributes
Each services resources inherit from Resource, so they can override any of the base attributes to fit
the way their particular resource operates.
These attributes are set based on how your resource responds with data. The default values for each of
these are None, which works fine when your resource returns a JSON body that can be used directly
without a top-level key, such as {"name": "Ernie Banks", ...}".
However, our Fake resource returns JSON bodies that have the details of the resource one level deeper,
such as {"resources": {"name": "Ernie Banks", ...}, {...}}. It does a similar
thing with single resources, putting them inside a dictionary keyed on "resource".
By setting Fake.resource_key on line 8, we tell the Resource.create, Resource.get, and
Resource.update methods that were either sending or receiving a resource that is in a dictionary
with that key.
By setting Fake.resources_key on line 9, we tell the Resource.list method that were ex-
pecting to receive multiple resources inside a dictionary with that key.
base_path
The base_path is the URL were going to use to make requests for this resource. In this case, line 10
sets base_path = "/fake", which also corresponds to the name of our class, Fake.
Most resources follow this basic formula. Some cases are more complex, where the URL to make
requests to has to contain some extra data. The volume service has several resources which make ei-
ther basic requests or detailed requests, so they use base_path = "/volumes/%s(detailed)".
Before a request is made, if detailed = True, they convert it to a string so the URL becomes /
volumes/detailed. If its False, they only send /volumes/.
service
Line 11 is an instance of the service were implementing. Each resource ties itself to the service through
this setting, so that the proper URL can be constructed.
In fake_service.py, we specify the valid versions as well as what this service is called in the
service catalog. When a request is made for this resource, the Session now knows how to construct the
appropriate URL using this FakeService instance.
Supported Operations
The base Resource disallows all types of requests by default, requiring each resource to specify which
requests they support. On lines 14-19, our Fake resource specifies that itll work with all of the opera-
tions.
In order to have the following methods work, you must allow the corresponding value by setting it to
True:
create allow_create
delete allow_delete
head allow_head
list allow_list
fetch allow_fetch
commit allow_commit
An additional attribute to set is commit_method. It defaults to PUT, but some services use POST or
PATCH to commit changes back to the remote resource.
Properties
The way resource classes communicate values between the user and the server are prop objects. These
act similarly to Pythons built-in property objects, but they share only the name - theyre not the same.
Properties are set based on the contents of a response body or headers. Based on what your resource
returns, you should set props to map those values to ones on your Resource object.
Line 22 sets a prop for timestamp , which will cause the Fake.timestamp attribute to contain the
value returned in an X-Timestamp header, such as from a Fake.head request.
Line 24 sets a prop for name, which is a value returned in a body, such as from a Fake.get request.
Note from line 12 that name is specified its id attribute, so when this resource is populated from a
response, Fake.name and Fake.id are the same value.
Line 26 sets a prop which contains an alias. Fake.value will be set when a response body contains a
value, or when a header contains X-Resource-Value.
Line 28 specifies a type to be checked before sending the value in a request. In this case, we can only
set Fake.cool to either True or False, otherwise a TypeError will be raised if the value cant be
converted to the expected type.
Documentation
We use Sphinxs autodoc feature in order to build API documentation for each resource we expose.
The attributes we override from Resource dont need to be documented, but any prop attributes must
be. All you need to do is add a comment above the line to document, with a colon following the pound-
sign.
Lines 21, 23, 25, and 27-28 are comments which will then appear in the API documentation. As shown
in lines 27 & 28, these comments can span multiple lines.
FOUR
OPENSTACKSDK
openstacksdk is a client library for building applications to work with OpenStack clouds. The project
aims to provide a consistent and complete set of interactions with OpenStacks many services, along with
complete documentation, examples, and tools.
It also contains an abstraction interface layer. Clouds can do many things, but there are probably only
about 10 of them that most people care about with any regularity. If you want to do complicated things,
the per-service oriented portions of the SDK are for you. However, if what you want is to be able to write
an application that talks to clouds no matter what crazy choices the deployer has made in an attempt to
be more hipster than their self-entitled narcissist peers, then the Cloud Abstraction layer is for you.
More information about its history can be found at https://docs.openstack.org/openstacksdk/latest/
contributor/history.html
569
OpenStackSDK Documentation, Release 0.52.1.dev3
FIVE
OPENSTACK
import openstack
# Initialize cloud
conn = openstack.connect(cloud='mordred')
571
OpenStackSDK Documentation, Release 0.52.1.dev3
SIX
CLOUD LAYER
import openstack
The benefit is mostly seen in more complicated operations that take multiple steps and where the steps
vary across providers:
import openstack
# Initialize connection
# Cloud configs are read with openstack.config
conn = openstack.connect(cloud='mordred')
573
OpenStackSDK Documentation, Release 0.52.1.dev3
SEVEN
OPENSTACK.CONFIG
openstack.config will find cloud configuration for as few as 1 clouds and as many as you want to
put in a config file. It will read environment variables and config files, and it also contains some vendor
specific default values so that you dont have to know extra info to use OpenStack
• If you have a config file, you will get the clouds listed in it
• If you have environment variables, you will get a cloud named envvars
• If you have neither, you will get a cloud named defaults with base defaults
Sometimes an example is nice.
Create a clouds.yaml file:
clouds:
mordred:
region_name: Dallas
auth:
username: 'mordred'
password: XXXXXXX
project_name: 'shade'
auth_url: 'https://identity.example.com'
Please note: openstack.config will look for a file called clouds.yaml in the following loca-
tions:
• Current Directory
• ~/.config/openstack
• /etc/openstack
More information at https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html
575
OpenStackSDK Documentation, Release 0.52.1.dev3
EIGHT
LINKS
• Issue Tracker
• Code Review
• Documentation
• PyPI
• Mailing list
• Release Notes
General information about the SDK including a glossary and release history.
8.1.1 Glossary
577
OpenStackSDK Documentation, Release 0.52.1.dev3
o 403
openstack.accelerator.v2._proxy, openstack.clustering.v1.cluster,
168 406
openstack.clustering.v1.cluster_policy,
openstack.accelerator.v2.accelerator_request,
377 410
openstack.accelerator.v2.deployable,openstack.clustering.v1.event, 413
375 openstack.clustering.v1.node, 408
openstack.accelerator.v2.device, openstack.clustering.v1.policy, 405
374 openstack.clustering.v1.policy_type,
openstack.accelerator.v2.device_profile, 405
376 openstack.clustering.v1.profile,
openstack.baremetal.v1._proxy, 171 404
openstack.baremetal.v1.allocation, openstack.clustering.v1.profile_type,
392 403
openstack.baremetal.v1.chassis, 380 openstack.clustering.v1.receiver,
openstack.baremetal.v1.driver, 378 411
openstack.baremetal.v1.node, 381 openstack.compute.v2._proxy, 217
openstack.baremetal.v1.port, 390 openstack.compute.v2.extension, 414
openstack.baremetal.v1.port_group, openstack.compute.v2.flavor, 415
391 openstack.compute.v2.image, 417
openstack.compute.v2.keypair, 418
openstack.baremetal.v1.volume_connector,
393 openstack.compute.v2.limits, 419
openstack.compute.v2.server, 421
openstack.baremetal.v1.volume_target,
394 openstack.compute.v2.server_interface,
425
openstack.baremetal_introspection.v1._proxy,
192 openstack.compute.v2.server_ip, 426
openstack.config, 19
openstack.baremetal_introspection.v1.introspection,
395 openstack.connection, 77
openstack.block_storage.v2._proxy, openstack.database.v1._proxy, 239
194 openstack.database.v1.database, 427
openstack.block_storage.v2.backup, openstack.database.v1.flavor, 428
397 openstack.database.v1.instance, 428
openstack.block_storage.v2.snapshot,openstack.database.v1.user, 430
399 openstack.dns.v2._proxy, 244
openstack.block_storage.v2.type, openstack.dns.v2.floating_ip, 435
400 openstack.dns.v2.recordset, 436
openstack.block_storage.v2.volume, openstack.dns.v2.zone, 430
401 openstack.dns.v2.zone_export, 433
openstack.clustering.v1._proxy, 199 openstack.dns.v2.zone_import, 434
openstack.clustering.v1.action, 412 openstack.dns.v2.zone_transfer, 431
openstack.clustering.v1.build_info, openstack.identity.v2._proxy, 252
579
OpenStackSDK Documentation, Release 0.52.1.dev3
openstack.identity.v2.extension, openstack.load_balancer.v2.load_balancer,
437 460
openstack.identity.v2.role, 438 openstack.load_balancer.v2.member,
openstack.identity.v2.tenant, 439 467
openstack.identity.v2.user, 439 openstack.load_balancer.v2.pool,
openstack.identity.v3._proxy, 256 466
openstack.identity.v3.credential, openstack.load_balancer.v2.provider,
440 472
openstack.identity.v3.domain, 441 openstack.load_balancer.v2.quota,
openstack.identity.v3.endpoint, 442 474
openstack.identity.v3.group, 443 openstack.message.v2._proxy, 305
openstack.identity.v3.policy, 443 openstack.network.v2._proxy, 310
openstack.identity.v3.project, 444 openstack.network.v2.address_group,
openstack.identity.v3.service, 445 479
openstack.identity.v3.trust, 446 openstack.network.v2.address_scope,
openstack.identity.v3.user, 447 480
openstack.image.v1._proxy, 272 openstack.network.v2.agent, 481
openstack.image.v1.image, 448 openstack.network.v2.auto_allocated_topology,
openstack.image.v2._proxy, 274 482
openstack.image.v2.image, 450 openstack.network.v2.availability_zone,
openstack.image.v2.member, 454 483
openstack.image.v2.service_info, openstack.network.v2.extension, 483
456 openstack.network.v2.flavor, 484
openstack.image.v2.task, 455 openstack.network.v2.floating_ip,
openstack.key_manager.v1._proxy, 485
283 openstack.network.v2.health_monitor,
openstack.key_manager.v1.container, 486
457 openstack.network.v2.listener, 487
openstack.key_manager.v1.order, 458 openstack.network.v2.load_balancer,
openstack.key_manager.v1.secret, 488
459 openstack.network.v2.metering_label,
openstack.load_balancer.v2._proxy, 489
287 openstack.network.v2.metering_label_rule,
openstack.load_balancer.v2.amphora, 490
475 openstack.network.v2.network, 491
openstack.load_balancer.v2.availability_zone,
openstack.network.v2.network_ip_availability,
478 492
openstack.load_balancer.v2.availability_zone_profile,
openstack.network.v2.network_segment_range,
478 493
openstack.load_balancer.v2.flavor, openstack.network.v2.pool, 494
473 openstack.network.v2.pool_member,
openstack.load_balancer.v2.flavor_profile,496
473 openstack.network.v2.port, 497
openstack.load_balancer.v2.health_monitor,
openstack.network.v2.qos_bandwidth_limit_rule
468 499
openstack.load_balancer.v2.l7_policy,
openstack.network.v2.qos_dscp_marking_rule,
470 499
openstack.load_balancer.v2.l7_rule, openstack.network.v2.qos_minimum_bandwidth_ru
471 500
openstack.load_balancer.v2.listener,openstack.network.v2.qos_policy,
463 501
openstack.network.v2.qos_rule_type,
502
openstack.network.v2.quota, 502
openstack.network.v2.rbac_policy,
503
openstack.network.v2.router, 504
openstack.network.v2.security_group,
506
openstack.network.v2.security_group_rule,
507
openstack.network.v2.segment, 508
openstack.network.v2.service_profile,
509
openstack.network.v2.service_provider,
510
openstack.network.v2.subnet, 510
openstack.network.v2.subnet_pool,
512
openstack.object_store.v1._proxy,
361
openstack.object_store.v1.account,
517
openstack.object_store.v1.container,
518
openstack.object_store.v1.obj, 520
openstack.orchestration.v1._proxy,
366
openstack.orchestration.v1.resource,
516
openstack.orchestration.v1.stack,
513
openstack.resource, 525
openstack.service_description, 534
openstack.utils, 535
openstack.workflow.v2._proxy, 371
openstack.workflow.v2.execution,
523
openstack.workflow.v2.workflow, 524
A active_connections (open-
abort() (open- stack.load_balancer.v2.listener.ListenerStats
attribute), 465
stack.baremetal_introspection.v1.introspection.Introspection
method), 396 active_connections (open-
AbsoluteLimits (class in open- stack.load_balancer.v2.load_balancer.LoadBalancerStats
stack.compute.v2.limits), 420 attribute), 462
AcceleratorRequest (class in open- actor (openstack.clustering.v1.receiver.Receiver
stack.accelerator.v2.accelerator_request), attribute), 411
377 add_addresses() (open-
accept_ranges (open- stack.network.v2.address_group.AddressGroup
stack.object_store.v1.obj.Object at- method), 480
tribute), 521 add_auto_ip() (open-
Account (class in open- stack.connection.Connection method),
stack.object_store.v1.account), 517 82
account_bytes_used (open- add_extra_routes() (open-
stack.object_store.v1.account.Account stack.network.v2.router.Router method),
attribute), 518 505
account_container_count (open- add_flavor_access() (open-
stack.object_store.v1.account.Account stack.connection.Connection method),
attribute), 518 83
account_object_count (open- add_gateway() (open-
stack.object_store.v1.account.Account stack.network.v2.router.Router method),
attribute), 518 506
Action (class in openstack.clustering.v1.action), add_host_to_aggregate() (open-
412 stack.connection.Connection method),
action (openstack.clustering.v1.action.Action 83
attribute), 412 add_interface() (open-
action (openstack.clustering.v1.event.Event at- stack.network.v2.router.Router method),
tribute), 414 505
action (openstack.clustering.v1.receiver.Receiver add_ip_list() (open-
attribute), 411 stack.connection.Connection method),
action (openstack.dns.v2.floating_ip.FloatingIP 83
attribute), 435 add_router_interface() (open-
action (openstack.dns.v2.recordset.Recordset stack.connection.Connection method),
attribute), 436 83
action (openstack.dns.v2.zone.Zone attribute), add_server_security_groups() (open-
430 stack.connection.Connection method), 84
add_service()
action (openstack.load_balancer.v2.l7_policy.L7Policy (open-
attribute), 470 stack.connection.Connection method),
action (openstack.network.v2.rbac_policy.RBACPolicy 82
attribute), 504 add_tenant_access() (open-
583
OpenStackSDK Documentation, Release 0.52.1.dev3
584 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 585
OpenStackSDK Documentation, Release 0.52.1.dev3
586 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 587
OpenStackSDK Documentation, Release 0.52.1.dev3
588 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
86 stack.compute.v2.server.Server method),
create_baymodel() (open- 425
stack.connection.Connection method), create_image() (open-
86 stack.connection.Connection method),
create_cluster_template() (open- 91
stack.connection.Connection method), create_image_snapshot() (open-
86 stack.connection.Connection method),
create_coe_cluster() (open- 92
stack.connection.Connection method), create_keypair() (open-
87 stack.connection.Connection method),
create_coe_cluster_template() (open- 93
stack.connection.Connection method), 87 create_method (openstack.resource.Resource
create_container() (open- attribute), 529
stack.connection.Connection method), create_network() (open-
87 stack.connection.Connection method),
create_device_profile() (open- 93
stack.connection.Connection method), create_object() (open-
87 stack.connection.Connection method),
create_directory_marker_object() 93
(openstack.connection.Connection create_port() (open-
method), 87 stack.connection.Connection method),
create_domain() (open- 94
stack.connection.Connection method), create_project() (open-
88 stack.connection.Connection method),
create_endpoint() (open- 95
stack.connection.Connection method), create_qos_bandwidth_limit_rule()
88 (openstack.connection.Connection
create_exclude_id_from_body (open- method), 95
stack.resource.Resource attribute), 529 create_qos_dscp_marking_rule()
create_extra_specs() (open- (openstack.connection.Connection
stack.compute.v2.flavor.Flavor method), method), 96
416 create_qos_minimum_bandwidth_rule()
create_firewall_group() (open- (openstack.connection.Connection
stack.connection.Connection method), method), 96
89 create_qos_policy() (open-
create_firewall_policy() (open- stack.connection.Connection method),
stack.connection.Connection method), 96
89 create_recordset() (open-
create_firewall_rule() (open- stack.connection.Connection method),
stack.connection.Connection method), 97
89 create_requires_id (open-
create_flavor() (open- stack.resource.Resource attribute),
stack.connection.Connection method), 529
90 create_returns_body (open-
create_floating_ip() (open- stack.resource.Resource attribute),
stack.connection.Connection method), 529
91 create_role() (open-
create_group() (open- stack.connection.Connection method),
stack.connection.Connection method), 97
91 create_router() (open-
create_image() (open- stack.connection.Connection method),
Index 589
OpenStackSDK Documentation, Release 0.52.1.dev3
97 created_at (open-
create_security_group() (open- stack.baremetal.v1.node.Node attribute),
stack.connection.Connection method), 381
98 created_at (openstack.baremetal.v1.port.Port
create_security_group_rule() (open- attribute), 390
stack.connection.Connection method), 98 created_at (open-
create_server() (open- stack.baremetal.v1.port_group.PortGroup
stack.connection.Connection method), attribute), 391
99 created_at (open-
create_server_group() (open- stack.baremetal.v1.volume_connector.VolumeConnector
stack.connection.Connection method), attribute), 394
101 created_at (open-
create_service() (open- stack.baremetal.v1.volume_target.VolumeTarget
stack.connection.Connection method), attribute), 395
101 created_at (open-
create_stack() (open- stack.block_storage.v2.backup.Backup
stack.connection.Connection method), attribute), 397
101 created_at (open-
create_subnet() (open- stack.block_storage.v2.snapshot.Snapshot
stack.connection.Connection method), attribute), 399
102 created_at (open-
create_user() (open- stack.block_storage.v2.volume.Volume
stack.connection.Connection method), attribute), 402
103 created_at (open-
create_volume() (open- stack.clustering.v1.action.Action at-
stack.connection.Connection method), tribute), 413
103 created_at (open-
create_volume_backup() (open- stack.clustering.v1.cluster.Cluster at-
stack.connection.Connection method), tribute), 406
104 created_at (open-
create_volume_snapshot() (open- stack.clustering.v1.node.Node attribute),
stack.connection.Connection method), 409
104 created_at (open-
create_zone() (open- stack.clustering.v1.policy.Policy at-
stack.connection.Connection method), tribute), 406
104 created_at (open-
created_at (open- stack.clustering.v1.profile.Profile at-
stack.accelerator.v2.deployable.Deployable tribute), 404
attribute), 375 created_at (open-
created_at (open- stack.clustering.v1.receiver.Receiver
stack.accelerator.v2.device.Device attribute), 411
attribute), 374 created_at (open-
created_at (open- stack.compute.v2.image.Image attribute),
stack.accelerator.v2.device_profile.DeviceProfile 417
attribute), 376 created_at (open-
created_at (open- stack.compute.v2.keypair.Keypair at-
stack.baremetal.v1.allocation.Allocation tribute), 418
attribute), 392 created_at (open-
created_at (open- stack.compute.v2.server.Server attribute),
stack.baremetal.v1.chassis.Chassis 422
attribute), 380 created_at (open-
590 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 591
OpenStackSDK Documentation, Release 0.52.1.dev3
592 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 593
OpenStackSDK Documentation, Release 0.52.1.dev3
594 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 595
OpenStackSDK Documentation, Release 0.52.1.dev3
596 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 597
OpenStackSDK Documentation, Release 0.52.1.dev3
598 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 599
OpenStackSDK Documentation, Release 0.52.1.dev3
600 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 601
OpenStackSDK Documentation, Release 0.52.1.dev3
602 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 603
OpenStackSDK Documentation, Release 0.52.1.dev3
604 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
417 383
Image (class in openstack.image.v1.image), 448 inspect_machine() (open-
Image (class in openstack.image.v2.image), 450 stack.connection.Connection method),
image (openstack.compute.v2.server.Server at- 133
tribute), 423 Instance (class in open-
image_id (open- stack.database.v1.instance), 428
stack.block_storage.v2.volume.Volume instance_id (open-
attribute), 401 stack.baremetal.v1.node.Node attribute),
image_id (openstack.compute.v2.server.Server 382
attribute), 423 instance_id (open-
image_id (openstack.image.v2.member.Member stack.database.v1.database.Database
attribute), 455 attribute), 427
image_id (open- instance_info (open-
stack.load_balancer.v2.amphora.Amphora stack.baremetal.v1.node.Node attribute),
attribute), 476 382
image_meta (open- instance_name (open-
stack.compute.v2.limits.AbsoluteLimits stack.compute.v2.server.Server attribute),
attribute), 420 423
ImageDetail (in module open- instance_type_rxtx_factor (open-
stack.compute.v2.image), 418 stack.image.v2.image.Image attribute),
Import (class in open- 451
stack.image.v2.service_info), 456 instance_uuid (open-
import_image() (open- stack.accelerator.v2.accelerator_request.AcceleratorRequ
stack.image.v2.image.Image method), attribute), 377
454 instance_uuid (open-
import_methods (open- stack.image.v2.image.Image attribute),
stack.image.v2.service_info.Import 451
attribute), 457 instances (open-
index (openstack.clustering.v1.node.Node stack.compute.v2.limits.AbsoluteLimits
attribute), 408 attribute), 420
init_at (openstack.clustering.v1.cluster.Cluster instances_used (open-
attribute), 406 stack.compute.v2.limits.AbsoluteLimits
init_at (openstack.clustering.v1.node.Node at- attribute), 420
tribute), 408 interface (open-
input (openstack.image.v2.task.Task attribute), stack.identity.v3.endpoint.Endpoint
455 attribute), 442
input (openstack.workflow.v2.workflow.Workflow internal_info (open-
attribute), 524 stack.baremetal.v1.port.Port attribute),
inputs (openstack.clustering.v1.action.Action 390
attribute), 412 internal_info (open-
insert_headers (open- stack.baremetal.v1.port_group.PortGroup
stack.load_balancer.v2.listener.Listener attribute), 391
attribute), 464 interval (open-
insert_rule_into_policy() (open- stack.clustering.v1.action.Action at-
stack.connection.Connection method), tribute), 412
133 Introspection (class in open-
insert_user_agent() (open- stack.baremetal_introspection.v1.introspection),
stack.config.cloud_region.CloudRegion 395
method), 22 ip_version (open-
inspect_interface (open- stack.network.v2.address_scope.AddressScope
stack.baremetal.v1.node.Node attribute), attribute), 480
Index 605
OpenStackSDK Documentation, Release 0.52.1.dev3
606 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 607
OpenStackSDK Documentation, Release 0.52.1.dev3
is_public (open- K
stack.block_storage.v2.type.Type at- kernel_id (openstack.compute.v2.server.Server
tribute), 400 attribute), 423
is_public (openstack.compute.v2.flavor.Flavor kernel_id (openstack.image.v2.image.Image
attribute), 415 attribute), 452
is_public (openstack.image.v1.image.Image key (openstack.load_balancer.v2.l7_rule.L7Rule
attribute), 448 attribute), 471
is_pxe_enabled (open- key_name (openstack.compute.v2.server.Server
stack.baremetal.v1.port.Port attribute), attribute), 423
390 keypair, 577
is_retired (open- Keypair (class in open-
stack.baremetal.v1.node.Node attribute), stack.compute.v2.keypair), 418
382 keypairs (open-
is_rollback_disabled (open- stack.compute.v2.limits.AbsoluteLimits
stack.orchestration.v1.stack.Stack at- attribute), 420
tribute), 514 keys() (openstack.resource.Resource method),
is_root_enabled() (open- 529
stack.database.v1.instance.Instance
method), 429 L
is_router_external (open- l7_policies (open-
stack.network.v2.network.Network stack.load_balancer.v2.listener.Listener
attribute), 491 attribute), 464
is_shared (open- l7_policies (open-
stack.network.v2.address_scope.AddressScope stack.network.v2.quota.Quota attribute),
attribute), 481 503
is_shared (open- l7_policy_id (open-
stack.network.v2.metering_label.MeteringLabel stack.load_balancer.v2.l7_rule.L7Rule
attribute), 489 attribute), 471
is_shared (open- L7Policy (class in open-
stack.network.v2.network.Network stack.load_balancer.v2.l7_policy),
attribute), 491 470
is_shared (open- L7Rule (class in open-
stack.network.v2.qos_policy.QoSPolicy stack.load_balancer.v2.l7_rule), 471
attribute), 501 last_error (open-
is_shared (open- stack.baremetal.v1.allocation.Allocation
stack.network.v2.subnet_pool.SubnetPool attribute), 392
attribute), 512 last_error (open-
is_standalone_ports_supported (open- stack.baremetal.v1.node.Node attribute),
stack.baremetal.v1.port_group.PortGroup 382
attribute), 392 last_heartbeat_at (open-
is_static_large_object (open- stack.network.v2.agent.Agent attribute),
stack.object_store.v1.obj.Object at- 481
tribute), 522 last_modified_at (open-
is_user_in_group() (open- stack.object_store.v1.obj.Object at-
stack.connection.Connection method), tribute), 522
134 launch_index (open-
is_vlan_transparent (open- stack.compute.v2.server.Server attribute),
stack.network.v2.network.Network 423
attribute), 492 launched_at (open-
items() (openstack.resource.Resource method), stack.compute.v2.server.Server attribute),
529 423
608 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 609
OpenStackSDK Documentation, Release 0.52.1.dev3
135 136
list_device_profiles() (open- list_objects() (open-
stack.connection.Connection method), stack.connection.Connection method),
135 136
list_devices() (open- list_ports() (open-
stack.connection.Connection method), stack.connection.Connection method),
135 137
list_domains() (open- list_ports_attached_to_machine()
stack.connection.Connection method), (openstack.connection.Connection
135 method), 137
list_endpoints() (open- list_qos_bandwidth_limit_rules()
stack.connection.Connection method), (openstack.connection.Connection
135 method), 137
list_firewall_groups() (open- list_qos_dscp_marking_rules() (open-
stack.connection.Connection method), stack.connection.Connection method),
135 137
list_firewall_policies() (open- list_qos_minimum_bandwidth_rules()
stack.connection.Connection method), (openstack.connection.Connection
135 method), 137
list_firewall_rules() (open- list_qos_policies() (open-
stack.connection.Connection method), stack.connection.Connection method),
135 138
list_flavor_access() (open- list_qos_rule_types() (open-
stack.connection.Connection method), stack.connection.Connection method),
135 138
list_floating_ip_pools() (open- list_recordsets() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 138
list_floating_ips() (open- list_role_assignments() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 138
list_hypervisors() (open- list_roles() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 138
list_keypairs() (open- list_router_interfaces() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 139
list_machines() (open- list_routers() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 139
list_magnum_services() (open- list_security_groups() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 139
list_networks() (open- list_server_groups() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 139
list_nics() (open- list_server_security_groups() (open-
stack.connection.Connection method), stack.connection.Connection method),
136 139
list_nics_for_machine() (open- list_servers() (open-
stack.connection.Connection method), stack.connection.Connection method),
610 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 611
OpenStackSDK Documentation, Release 0.52.1.dev3
612 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 613
OpenStackSDK Documentation, Release 0.52.1.dev3
614 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
475 openstack.network.v2.metering_label_rule,
490
openstack.load_balancer.v2.availability_zone,
478 openstack.network.v2.network,
491
openstack.load_balancer.v2.availability_zone_profile,
478 openstack.network.v2.network_ip_availabili
openstack.load_balancer.v2.flavor, 492
473 openstack.network.v2.network_segment_range
493
openstack.load_balancer.v2.flavor_profile,
473 openstack.network.v2.pool, 494
openstack.load_balancer.v2.health_monitor,
openstack.network.v2.pool_member,
468 496
openstack.network.v2.port, 497
openstack.load_balancer.v2.l7_policy,
470 openstack.network.v2.qos_bandwidth_limit_r
openstack.load_balancer.v2.l7_rule, 499
471 openstack.network.v2.qos_dscp_marking_rule
openstack.load_balancer.v2.listener, 499
463 openstack.network.v2.qos_minimum_bandwidth
500
openstack.load_balancer.v2.load_balancer,
460 openstack.network.v2.qos_policy,
openstack.load_balancer.v2.member, 501
467 openstack.network.v2.qos_rule_type,
openstack.load_balancer.v2.pool, 502
466 openstack.network.v2.quota, 502
openstack.load_balancer.v2.provider,openstack.network.v2.rbac_policy,
472 503
openstack.load_balancer.v2.quota, openstack.network.v2.router, 504
474 openstack.network.v2.security_group,
openstack.message.v2._proxy, 305 506
openstack.network.v2._proxy, 310 openstack.network.v2.security_group_rule,
openstack.network.v2.address_group, 507
479 openstack.network.v2.segment,
openstack.network.v2.address_scope, 508
480 openstack.network.v2.service_profile,
openstack.network.v2.agent, 481 509
openstack.network.v2.auto_allocated_topology,
openstack.network.v2.service_provider,
482 510
openstack.network.v2.subnet, 510
openstack.network.v2.availability_zone,
483 openstack.network.v2.subnet_pool,
openstack.network.v2.extension, 512
483 openstack.object_store.v1._proxy,
openstack.network.v2.flavor, 484 361
openstack.network.v2.floating_ip, openstack.object_store.v1.account,
485 517
openstack.network.v2.health_monitor,openstack.object_store.v1.container,
486 518
openstack.network.v2.listener, openstack.object_store.v1.obj,
487 520
openstack.network.v2.load_balancer, openstack.orchestration.v1._proxy,
488 366
openstack.network.v2.metering_label,openstack.orchestration.v1.resource,
489 516
Index 615
OpenStackSDK Documentation, Release 0.52.1.dev3
616 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 617
OpenStackSDK Documentation, Release 0.52.1.dev3
618 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 619
OpenStackSDK Documentation, Release 0.52.1.dev3
620 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 621
OpenStackSDK Documentation, Release 0.52.1.dev3
622 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 623
OpenStackSDK Documentation, Release 0.52.1.dev3
624 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 625
OpenStackSDK Documentation, Release 0.52.1.dev3
626 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 627
OpenStackSDK Documentation, Release 0.52.1.dev3
628 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 629
OpenStackSDK Documentation, Release 0.52.1.dev3
630 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
150 stack.network.v2.security_group_rule),
search_users() (open- 507
stack.connection.Connection method), Segment (class in open-
151 stack.network.v2.segment), 508
Secret (class in open- segment_id (open-
stack.key_manager.v1.secret), 459 stack.network.v2.subnet.Subnet at-
secret_id (open- tribute), 511
stack.key_manager.v1.order.Order segmentation_id (open-
attribute), 458 stack.network.v2.segment.Segment
secret_ref (open- attribute), 509
stack.key_manager.v1.order.Order segments (open-
attribute), 458 stack.network.v2.network.Network
secret_ref (open- attribute), 492
stack.key_manager.v1.secret.Secret serial (openstack.dns.v2.zone.Zone attribute),
attribute), 459 431
secret_refs (open- server, 578
stack.key_manager.v1.container.Container Server (class in openstack.compute.v2.server),
attribute), 457 421
secret_type (open- server_group_members (open-
stack.key_manager.v1.secret.Secret stack.compute.v2.limits.AbsoluteLimits
attribute), 459 attribute), 421
security_group_id (open- server_groups (open-
stack.network.v2.security_group_rule.SecurityGroupRule
stack.compute.v2.limits.AbsoluteLimits
attribute), 508 attribute), 421
security_group_ids (open- server_groups (open-
stack.network.v2.port.Port attribute), stack.compute.v2.server.Server attribute),
498 424
security_group_rules (open- server_groups_used (open-
stack.compute.v2.limits.AbsoluteLimits stack.compute.v2.limits.AbsoluteLimits
attribute), 420 attribute), 421
security_group_rules (open- server_id (open-
stack.network.v2.quota.Quota attribute), stack.compute.v2.server_interface.ServerInterface
503 attribute), 426
security_group_rules (open- server_id (open-
stack.network.v2.security_group.SecurityGroup stack.compute.v2.server_ip.ServerIP
attribute), 507 attribute), 426
security_groups (open- server_meta (open-
stack.compute.v2.limits.AbsoluteLimits stack.compute.v2.limits.AbsoluteLimits
attribute), 420 attribute), 420
security_groups (open- ServerInterface (class in open-
stack.compute.v2.server.Server attribute), stack.compute.v2.server_interface),
424 425
security_groups (open- ServerIP (class in open-
stack.network.v2.quota.Quota attribute), stack.compute.v2.server_ip), 426
503 service, 578
security_groups_used (open- Service (class in openstack.identity.v3.service),
stack.compute.v2.limits.AbsoluteLimits 445
attribute), 420 service (openstack.resource.Resource at-
SecurityGroup (class in open- tribute), 528
stack.network.v2.security_group), 506 service catalog, 578
SecurityGroupRule (class in open- service_id (open-
Index 631
OpenStackSDK Documentation, Release 0.52.1.dev3
632 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 633
OpenStackSDK Documentation, Release 0.52.1.dev3
634 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 635
OpenStackSDK Documentation, Release 0.52.1.dev3
636 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
U 417
unassign_role_from_group() (open- update_firewall_group() (open-
stack.identity.v3.domain.Domain stack.connection.Connection method),
method), 441 156
unassign_role_from_group() (open- update_firewall_policy() (open-
stack.identity.v3.project.Project method), stack.connection.Connection method),
445 156
unassign_role_from_user() (open- update_firewall_rule() (open-
stack.identity.v3.domain.Domain stack.connection.Connection method),
method), 441 156
unassign_role_from_user() (open- update_group() (open-
stack.identity.v3.project.Project method), stack.connection.Connection method),
444 157
unbind_accelerator_request() (open- update_machine() (open-
stack.connection.Connection method), stack.connection.Connection method),
154 157
unchanged (open- update_network() (open-
stack.orchestration.v1.stack.Stack at- stack.connection.Connection method),
tribute), 514 157
unregister_machine() (open- update_object() (open-
stack.connection.Connection method), stack.connection.Connection method),
154 158
unset_flavor_specs() (open- update_port() (open-
stack.connection.Connection method), stack.connection.Connection method),
154 158
unset_maintenance() (open- update_qos_bandwidth_limit_rule()
stack.baremetal.v1.node.Node method), (openstack.connection.Connection
387 method), 159
update() (open- update_qos_dscp_marking_rule()
stack.orchestration.v1.stack.Stack (openstack.connection.Connection
method), 515 method), 159
update_aggregate() (open- update_qos_minimum_bandwidth_rule()
stack.connection.Connection method), (openstack.connection.Connection
154 method), 160
update_baymodel() (open- update_qos_policy() (open-
stack.connection.Connection method), stack.connection.Connection method),
155 160
update_cluster_template() (open- update_recordset() (open-
stack.connection.Connection method), stack.connection.Connection method),
155 160
update_coe_cluster() (open- update_role() (open-
stack.connection.Connection method), stack.connection.Connection method),
155 161
update_coe_cluster_template() (open- update_router() (open-
stack.connection.Connection method), stack.connection.Connection method),
155 161
update_container() (open- update_security_group() (open-
stack.connection.Connection method), stack.connection.Connection method),
156 162
update_extra_specs_property() (open- update_server() (open-
stack.compute.v2.flavor.Flavor method), stack.connection.Connection method),
Index 637
OpenStackSDK Documentation, Release 0.52.1.dev3
638 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
Index 639
OpenStackSDK Documentation, Release 0.52.1.dev3
640 Index
OpenStackSDK Documentation, Release 0.52.1.dev3
vmware_adaptertype (open- W
stack.image.v2.image.Image attribute), wait() (openstack.baremetal.v1.allocation.Allocation
453 method), 393
vmware_ostype (open- wait() (openstack.baremetal_introspection.v1.introspection.Intro
stack.image.v2.image.Image attribute), method), 396
453 wait_for_baremetal_node_lock()
volume, 578 (openstack.connection.Connection
Volume (class in open- method), 164
stack.block_storage.v2.volume), 401 wait_for_power_state() (open-
volume (openstack.database.v1.instance.Instance stack.baremetal.v1.node.Node method),
attribute), 429 385
volume_id (open- wait_for_provision_state() (open-
stack.baremetal.v1.volume_target.VolumeTarget stack.baremetal.v1.node.Node method),
attribute), 395 385
volume_id (open- wait_for_reservation() (open-
stack.block_storage.v2.backup.Backup stack.baremetal.v1.node.Node method),
attribute), 398 386
volume_id (open- wait_for_server() (open-
stack.block_storage.v2.snapshot.Snapshot stack.connection.Connection method),
attribute), 399 164
volume_image_metadata (open- WaitResult (class in open-
stack.block_storage.v2.volume.Volume stack.baremetal.v1.node), 390
attribute), 402 weight (openstack.load_balancer.v2.member.Member
volume_type (open- attribute), 468
stack.baremetal.v1.volume_target.VolumeTarget
weight (openstack.network.v2.pool_member.PoolMember
attribute), 395 attribute), 496
volume_type (open- Workflow (class in open-
stack.block_storage.v2.volume.Volume stack.workflow.v2.workflow), 524
attribute), 401 workflow_id (open-
VolumeConnector (class in open- stack.workflow.v2.execution.Execution
stack.baremetal.v1.volume_connector), attribute), 523
393 workflow_name (open-
VolumeTarget (class in open- stack.workflow.v2.execution.Execution
stack.baremetal.v1.volume_target), attribute), 523
394 write_ACL (open-
vrrp_id (open- stack.object_store.v1.container.Container
stack.load_balancer.v2.amphora.Amphora attribute), 519
attribute), 476
vrrp_interface (open- Z
stack.load_balancer.v2.amphora.Amphora Zone (class in openstack.dns.v2.zone), 430
attribute), 476 zone_id (openstack.dns.v2.recordset.Recordset
vrrp_ip (open- attribute), 436
stack.load_balancer.v2.amphora.Amphora zone_id (open-
attribute), 475 stack.dns.v2.zone_export.ZoneExport
vrrp_port_id (open- attribute), 433
stack.load_balancer.v2.amphora.Amphora zone_id (open-
attribute), 475 stack.dns.v2.zone_import.ZoneImport
vrrp_priority (open- attribute), 434
stack.load_balancer.v2.amphora.Amphora zone_name (open-
attribute), 476 stack.dns.v2.recordset.Recordset at-
tribute), 436
Index 641
OpenStackSDK Documentation, Release 0.52.1.dev3
zone_name (open-
stack.dns.v2.zone_transfer.ZoneTransferRequest
attribute), 432
zone_transfer_request_id (open-
stack.dns.v2.zone_transfer.ZoneTransferAccept
attribute), 432
ZoneExport (class in open-
stack.dns.v2.zone_export), 433
ZoneImport (class in open-
stack.dns.v2.zone_import), 434
ZoneTransferAccept (class in open-
stack.dns.v2.zone_transfer), 432
ZoneTransferRequest (class in open-
stack.dns.v2.zone_transfer), 431
642 Index