The Connection
class is the primary interface
to the Python SDK. It maintains a context for a connection 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 Applications
Using only keyword arguments passed to the constructor ignoring config files and environment variables.
Using an existing authenticated keystoneauth1.session.Session, such as might exist inside of an OpenStack service operational context.
Using an existing CloudRegion
.
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
conn = openstack.connect(cloud='example', region_name='earth1')
If the application in question is a command line application that should also
accept command line arguments, 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
options = argparse.ArgumentParser(description='Awesome OpenStack App')
conn = openstack.connect(options=options)
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.
from openstack import connection
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')
Per-service settings as needed by keystoneauth1.adapter.Adapter such as
api_version
, service_name
, and interface
can be set, as seen
above, by prefixing them with the official service-type
name of the
service. region_name
is a setting for the entire
CloudRegion
and cannot be set per
service.
For applications that already have an authenticated Session, simply passing
it to the Connection
constructor is all that
is needed:
from openstack import connection
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 service’s 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.
from openstack import connection
conn = connection.Connection(
session=session,
oslo_conf=CONF)
If you already have an CloudRegion
you can pass it in instead:
from openstack import connection
import openstack.config
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 service’s official service-type.
An iterator containing a list of all the projects is retrieved in this manner:
projects = conn.identity.projects()
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.
Create a Connection using openstack.config
cloud (str) – Use the cloud configuration details when creating the Connection.
config (openstack.config.cloud_region.CloudRegion) – An existing CloudRegion configuration. If no config is provided, openstack.config.OpenStackConfig will be called, and the provided name will be used in determining which cloud’s configuration details will be used in creation of the Connection instance.
options (argparse.Namespace) – Allows direct passing in of options to be added to the cloud config. This does not have to be an actual instance of argparse.Namespace, despite the naming of the openstack.config.loader.OpenStackConfig.get_one argument to which it is passed.
Create a connection to a cloud.
A connection needs information about how to connect, how to authenticate and how to select the appropriate services to use.
The recommended way to provide this information is by referencing
a named cloud config from an existing clouds.yaml file. The cloud
name envvars
may be used to consume a cloud configured via OS_
environment variables.
A pre-existing CloudRegion
object can be passed in lieu of a cloud name, for cases where the user
already has a fully formed CloudRegion and just wants to use it.
Similarly, if for some reason the user already has a
Session
and wants to use it, it may be
passed in.
cloud (str) – Name of the cloud from config to use.
config (CloudRegion
) – CloudRegion object representing the config for the
region of the cloud in question.
session (Session
) – A session object compatible with
Session
.
app_name (str) – Name of the application to be added to User Agent.
app_version (str) – Version of the application to be added to User Agent.
extra_services – List of
ServiceDescription
objects describing services that openstacksdk otherwise does not
know about.
use_direct_get (bool) – For get methods, make specific REST calls for server-side filtering instead of making list calls and filtering client-side. Default false.
task_manager – Ignored. Exists for backwards compat during transition. Rate limit parameters should be passed directly to the rate_limit parameter.
rate_limit – Client-side rate limit, expressed in calls per second. The parameter can either be a single float, or it can be a dict with keys as service-type and values as floats expressing the calls per second for that service. Defaults to None, which means no rate-limiting is performed.
oslo_conf (ConfigOpts
An oslo.config CONF
object that has been populated with
keystoneauth1.loading.register_adapter_conf_options
in
groups named by the OpenStack service’s project name.) – An oslo.config CONF object.
service_types – A list/set of service types this Connection should support. All other service types will be disabled (will error if used). Currently only supported in conjunction with the ``oslo_conf`` kwarg.
global_request_id – A Request-id to send with all interactions.
strict_proxies (bool
Throw an openstack.exceptions.ServiceDiscoveryException
if the
endpoint for a given service doesn’t work. This is useful for
OpenStack services using sdk to talk to other OpenStack services
where it can be expected that the deployer config is correct and
errors should be reported immediately.
Default false.) – If True, check proxies on creation and raise
ServiceDiscoveryException if the service is unavailable.
pool_executor (Executor
A futurist Executor
object to be used for concurrent background
activities. Defaults to None in which case a ThreadPoolExecutor
will be created if needed.) –
kwargs – If a config is not provided, the rest of the parameters provided are assumed to be arguments to be passed to the CloudRegion constructor.
Add a service to the Connection.
Attaches an instance of the Proxy
class contained in
ServiceDescription
.
The Proxy
will be attached to the
Connection by its service_type
and by any aliases
that
may be specified.
service (openstack.service_description.ServiceDescription) – Object describing the service to be attached. As a convenience,
if service
is a string it will be treated as a service_type
and a basic
ServiceDescription
will be created.
Authorize this Connection
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.
A string token.
HttpException
if the
authorization fails due to reasons like the credentials
provided are unable to be authorized or the auth_type
argument is missing, etc.
Release any resources held open.
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.
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
parameter.
reuse – Try to reuse existing ips. Defaults to True.
Floating IP address attached to server.
Grant access to a private flavor for a project/tenant.
flavor_id (string) – ID of the private flavor.
project_id (string) – ID of the project/tenant.
OpenStackCloudException on operation error.
Add a host to an aggregate.
name_or_id – Name or ID of the host aggregate.
host_name – Host to add.
OpenStackCloudException on operation error.
Attach a list of IPs to a server.
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
parameter.
fixed_address – (optional) Fixed address of the server to attach the IP to
The updated server munch.Munch
OpenStackCloudException
, on operation error.
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.
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
The raw response body from the request.
OpenStackCloudException on operation error.
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.
False if server or security groups are undefined, True otherwise.
OpenStackCloudException
, on operation error.
Add a user to a group.
name_or_id – Name or unique ID of the user.
group_name_or_id – Group name or ID
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Grant access on a volume_type to a project.
NOTE: the call works even if the project does not exist.
name_or_id – ID or name of a volume_type
project_id – A project id
None
OpenStackCloudException on operation error.
Attach a virtual port to the bare metal machine.
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.
Nothing.
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.
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.
a volume attachment object.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Get a floating IP from a network or a pool.
Return the first available floating IP or allocate a new one.
network – Name or ID of the network.
server – Server the IP is for if known
a (normalized) structure with a floating IP address description.
Bind an accelerator to VM.
uuid – The uuid of the accelerator_request to be binded.
properties – The info of VM that will bind the accelerator.
True if bind succeeded, False otherwise.
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()
kwargs – keyword arguments can contain anything that would normally 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 ommitted.
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()
project – Either a project name or a project dict as returned by list_projects.
Create an accelerator_request.
attrs – The info of accelerator_request to be created.
An accelerator AcceleratorRequest
object.
Create a new host aggregate.
name – Name of the host aggregate being created
availability_zone – Availability zone to assign hosts
The created compute Aggregate
object.
OpenStackCloudException on operation error.
Create a cluster template.
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.
a dict containing the cluster template description
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Create a cluster template.
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.
a dict containing the cluster template description
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Create a COE cluster based on given cluster template.
name (string) – Name of the cluster.
image_id (string) – ID of the cluster template to use. Other arguments will be passed in kwargs.
a dict containing the cluster description
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Create a cluster template.
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.
a dict containing the cluster template description
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Create an object-store container.
name (str) – Name of the container to create.
public (bool) – Whether to set this container to be public.
Defaults to False
.
The created object store Container
object.
Create a device_profile.
attrs – The info of device_profile to be created.
An accelerator DeviceProfile
objects.
Create a zero-byte directory marker object
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.
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.
The created object store Object
object.
Create a domain.
name – The name of the domain.
description – A description of the domain.
enabled – Is the domain enabled or not (default True).
The created identity Endpoint
object.
OpenStackCloudException – if the domain cannot be created.
Create a Keystone endpoint.
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
A list of identity Endpoint
objects
OpenStackCloudException if the service cannot be found or if something goes wrong during the OpenStack API call.
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 respectively. Port name or ids list is transformed to port ids list before the POST request.
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.
BadRequestException if parameters are malformed
DuplicateResource on multiple matches
ResourceNotFound if (ingress-, egress-) firewall policy or a port is not found.
The created network FirewallGroup
object.
Create firewall policy.
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.
BadRequestException if parameters are malformed
ResourceNotFound if a resource from firewall_list not found
The created network FirewallPolicy
object.
Creates firewall rule.
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)
BadRequestException if parameters are malformed
The created network FirewallRule
object.
Create a new flavor.
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
The created compute Flavor
object.
OpenStackCloudException on operation error.
Allocate a new floating IP from a network or a pool.
network – Name or ID of the network that the floating IP should come from.
server – (optional) Server dict for the server to create the IP for and to which it should be attached.
fixed_address – (optional) Fixed IP to attach the floating ip to.
nat_destination – (optional) Name or ID of the network that the fixed IP to attach the floating IP to should be on.
port – (optional) The port ID that the floating IP should be attached to. Specifying a port conflicts with specifying a server, fixed_address or nat_destination.
wait – (optional) Whether to wait for the IP to be active. Defaults to False. Only applies if a server is provided.
timeout – (optional) How long to wait for the IP to be active. Defaults to 60. Only applies if a server is provided.
a floating IP address
OpenStackCloudException
, on operation error.
Create a group.
name (string) – Group name.
description (string) – Group description.
domain (string) – Domain name or ID for the group.
An identity Group
object
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Upload an image.
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)
container (str) – Name of the container in swift where images should be uploaded for import if the cloud requires such a thing. (optiona, defaults to ‘images’)
md5 (str) – md5 sum of the image file. If not given, an md5 will be calculated.
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. (optional, defaults to the os-client-config config value for this cloud)
tags (list) – List of tags for this image. Each tag is a string of at most 255 chars.
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)
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.
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.
volume – Name or ID or volume object of a volume to create an image from. Mutually exclusive with (optional, defaults to None)
Additional kwargs will be passed to the image creation as additional metadata for the image 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.
An image openstack.image.v2.image.Image
object.
OpenStackCloudException if there are problems uploading
Create an image by snapshotting an existing server.
On most clouds this is a cold snapshot - meaning that the server in question will be shutdown before taking the snapshot. It is possible that it’s a live snapshot - but there is no way to know as a user, so caveat emptor.
name – Name of the image to be created
server – Server name or ID or dict representing the server to be snapshotted
wait – If true, waits for image to be created.
timeout – Seconds to wait for image creation. None is forever.
metadata – Metadata to give newly-created image entity
The created image Image
object.
OpenStackCloudException if there are problems uploading
Create a new keypair.
name – Name of the keypair being created.
public_key – Public key for the new keypair.
The created compute Keypair
object.
OpenStackCloudException on operation error.
Create a network.
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:
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
project_id (string) – Specify the project ID this network will be created on (admin-only).
availability_zone_hints (types.ListType) – A list of availability zone hints.
port_security_enabled (bool) – Enable / Disable port security
mtu_size (int) – maximum transmission unit value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
dns_domain (string) – Specify the DNS domain associated with this network.
The created network Network
object.
OpenStackCloudException on operation error.
Create a file object.
Automatically uses large-object segments if needed.
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 filename.
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) Shade 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)
generate_checksums – Whether to generate checksums on the client side that get added to headers for later prevention of double uploads of identical data. (optional, defaults to True)
metadata – This dict will get changed into headers that set metadata of the object
The created object store Object
object.
OpenStackCloudException
on operation error.
Create a port
network_id – The ID of the network. (Required)
name – A symbolic name for the port. (Optional)
admin_state_up – The administrative status of the port, which is up (true, default) or down (false). (Optional)
mac_address – The MAC address. (Optional)
fixed_ips –
List of ip_addresses and subnet_ids. See subnet_id and ip_address. (Optional) For example:
[
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
]
subnet_id – If you specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port. (Optional) If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the specified address to the port.
ip_address – If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the specified address to the port.
security_groups – List of security group UUIDs. (Optional)
allowed_address_pairs –
Allowed address pairs list (Optional) For example:
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
extra_dhcp_opts –
Extra DHCP options. (Optional). For example:
[
{
"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 network. (Optional)
qos_policy_id – The ID of the QoS policy to apply for port.
The created network Port
object.
OpenStackCloudException
on operation error.
Create a project.
name –
domain_id –
description –
enabled –
An identity Project
object.
Create a QoS bandwidth limit rule.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
max_kbps (int) – Maximum bandwidth limit value (in kilobits per second).
max_burst_kbps (int) – Maximum burst value (in kilobits).
direction (string) – Ingress or egress. The direction in which the traffic will be limited.
The created network QoSBandwidthLimitRule
object.
OpenStackCloudException on operation error.
Create a QoS DSCP marking rule.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
dscp_mark (int) – DSCP mark value
The created network QoSDSCPMarkingRule
object.
OpenStackCloudException on operation error.
Create a QoS minimum bandwidth limit rule.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
min_kbps (int) – Minimum bandwidth value (in kilobits per second).
direction (string) – Ingress or egress. The direction in which the traffic will be available.
The created network QoSMinimumBandwidthRule
object.
OpenStackCloudException on operation error.
Create a QoS policy.
name (string) – Name of the QoS policy being created.
description (string) – Description of created QoS policy.
shared (bool) – Set the QoS policy as shared.
default (bool) – Set the QoS policy as default for project.
project_id (string) – Specify the project ID this QoS policy will be created on (admin-only).
The created network QosPolicy
object.
OpenStackCloudException on operation error.
Create a recordset.
zone – Name, ID or openstack.dns.v2.zone.Zone
instance
of the zone managing the recordset.
name – Name of the recordset
recordset_type – Type of the recordset
records – List of the recordset definitions
description – Description of the recordset
ttl – TTL value of the recordset
a dict representing the created recordset.
OpenStackCloudException on operation error.
Create a Keystone role.
name (string) – The name of the role.
domain_id – domain id (v3)
an identity Role
object
OpenStackCloudException – if the role cannot be created
Create a logical router.
name (string) – The router name.
admin_state_up (bool) – The administrative state of the router.
ext_gateway_net_id (string) – Network ID for the external gateway.
enable_snat (bool) – Enable Source NAT (SNAT) attribute.
ext_fixed_ips –
List of dictionaries of desired IP and/or subnet on the external network. Example:
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
]
project_id (string) – Project ID for the router.
availability_zone_hints (types.ListType) – A list of availability zone hints.
The created network Router
object.
OpenStackCloudException on operation error.
Create a new security group
name (string) – A name for the security group.
description (string) – Describes the security group.
project_id (string) – Specify the project ID this security group will be created on (admin-only).
stateful (string) – Whether the security group is stateful or not.
A munch.Munch
representing the new security group.
OpenStackCloudException on operation error.
OpenStackCloudUnavailableFeature if security groups are not supported on this cloud.
Create a new security group rule
secgroup_name_or_id (string) – The security group name or ID to associate with this security group rule. If a non-unique group name is given, an exception is raised.
port_range_min (int) – The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the port_range_max attribute value. If nova is used by the cloud provider for security groups, then a value of None will be transformed to -1.
port_range_max (int) – 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 nova is used by the cloud provider for security groups, then a value of None will be transformed to -1.
protocol (string) – The protocol that is matched by the security group rule. Valid values are None, tcp, udp, and icmp.
remote_ip_prefix (string) – The remote IP prefix to be associated with this security group rule. This attribute matches the specified IP prefix as the source IP address of the IP packet.
remote_group_id (string) – The remote group ID to be associated with this security group rule.
remote_address_group_id (string) – The remote address group ID to be associated with this security group rule.
direction (string) – Ingress or egress: The direction in which the security group rule is applied. For a compute instance, an ingress security group rule is applied to incoming (ingress) traffic for that instance. An egress rule is applied to traffic leaving the instance.
ethertype (string) – Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules.
project_id (string) – Specify the project ID this security group will be created on (admin-only).
description (string) – Description of the rule, max 255 characters.
A munch.Munch
representing the new security group rule.
OpenStackCloudException on operation error.
Create a virtual server instance.
name – Something to name the server.
image – Image dict, name or ID to boot with. image is required unless boot_volume is given.
flavor – Flavor dict, name or ID to boot onto.
auto_ip – Whether to take actions to find a routable IP for the server. (defaults to True)
ips – List of IPs to attach to the server (defaults to None)
ip_pool – Name of the network or floating IP pool to get an address from. (defaults to None)
root_volume – Name or ID of a volume to boot from (defaults to None - deprecated, use boot_volume)
boot_volume – Name or ID of a volume to boot from (defaults to None)
terminate_volume – If booting from a volume, whether it should be deleted when the server is destroyed. (defaults to False)
volumes – (optional) A list of volumes to attach to the server
meta – (optional) A dict of arbitrary key/value metadata to store for this server. Both keys and values must be <=255 characters.
files – (optional, deprecated) A dict of files to overwrite
on the server upon boot. Keys are file names (i.e.
/etc/passwd
) and values are the file contents (either as a
string or as a file-like object). A maximum of five entries is
allowed, and each file must be 10k or less.
reservation_id – a UUID for the set of servers being requested.
min_count – (optional extension) The minimum number of servers to launch.
max_count – (optional extension) The maximum number of servers to launch.
security_groups – A list of security group names
userdata – user data to pass to be exposed by the metadata server this can be a file type object as well or a string.
key_name – (optional extension) name of previously created keypair to inject into the instance.
availability_zone – Name of the availability zone for instance placement.
block_device_mapping – (optional) A dict of block device mappings for this server.
block_device_mapping_v2 – (optional) A dict of block device mappings for this server.
nics – (optional extension) an ordered list of nics to be added to this server, with information about connected networks, fixed IPs, port etc.
scheduler_hints – (optional extension) arbitrary key-value pairs specified by the client to help boot an instance
config_drive – (optional extension) value for config drive either boolean, or volume-id
disk_config – (optional extension) control how the disk is partitioned when the server is created. possible values are ‘AUTO’ or ‘MANUAL’.
admin_pass – (optional extension) add a user supplied admin password.
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
parameter.
reuse_ips – (optional) Whether to attempt to reuse pre-existing floating ips should a floating IP be needed (defaults to True)
network – (optional) Network dict or name or ID to attach the server to. Mutually exclusive with the nics parameter. Can also be a list of network names or IDs or network dicts.
boot_from_volume – Whether to boot from volume. ‘boot_volume’ implies True, but boot_from_volume=True with no boot_volume is valid and will create a volume from the image and use that.
volume_size – When booting an image from volume, how big should the created volume be? Defaults to 50.
nat_destination – Which network should a created floating IP be attached to, if it’s not possible to infer from the cloud’s configuration. (Optional, defaults to None)
group – ServerGroup dict, name or id to boot the server in. If a group is provided in both scheduler_hints and in the group param, the group param will win. (Optional, defaults to None)
The created compute Server
object.
OpenStackCloudException on operation error.
Create a new server group.
name – Name of the server group being created
policies – List of policies for the server group.
The created compute ServerGroup
object.
OpenStackCloudException on operation error.
Create a service.
name – Service name.
type – Service type. (type or service_type required.)
service_type – Service type. (type or service_type required.)
description – Service description (optional).
enabled – Whether the service is enabled (v3 only)
an identity Service
object
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Create a stack.
name (string) – Name of the stack.
tags – List of tag(s) of the stack. (optional)
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 create failure.
wait (boolean) – Whether to wait for the delete to finish.
timeout (int) – Stack create 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.
Only one of template_file, template_url, template_object should be specified.
a dict containing the stack description
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Create a subnet on a specified network.
network_name_or_id (string) – The unique name or ID of the attached network. If a non-unique name is supplied, an exception is raised.
cidr (string) – The CIDR.
ip_version (int) – The IP version, which is 4 or 6.
enable_dhcp (bool) – Set to True
if DHCP is enabled and
False
if disabled. Default is False
.
subnet_name (string) – The name of the subnet.
tenant_id (string) – The ID of the tenant who owns the network. Only administrative users can specify a tenant ID other than their own.
allocation_pools –
A list of dictionaries of the start and end addresses for the allocation pools. For example:
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
gateway_ip (string) – The gateway IP address. When you specify both allocation_pools and gateway_ip, you must ensure that the gateway IP does not overlap with the specified allocation pools.
disable_gateway_ip (bool) – Set to True
if gateway IP address
is disabled and False
if enabled. It is not allowed with
gateway_ip. Default is False
.
dns_nameservers –
A list of DNS name servers for the subnet. For example:
[ "8.8.8.7", "8.8.8.8" ]
host_routes –
A list of host route dictionaries for the subnet. For example:
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
ipv6_ra_mode (string) – IPv6 Router Advertisement mode. Valid values are: ‘dhcpv6-stateful’, ‘dhcpv6-stateless’, or ‘slaac’.
ipv6_address_mode (string) – IPv6 address mode. Valid values are: ‘dhcpv6-stateful’, ‘dhcpv6-stateless’, or ‘slaac’.
prefixlen (string) – The prefix length to use for subnet allocation from a subnet pool.
use_default_subnetpool (bool) – Use the default subnetpool for
ip_version
to obtain a CIDR. It is required to pass None
to
the cidr
argument when enabling this option.
kwargs – Key value pairs to be passed to the Neutron API.
The created network Subnet
object.
OpenStackCloudException on operation error.
Create a user.
Create a volume.
size – Size, in GB of the volume to create.
wait – If true, waits for volume to be created.
timeout – Seconds to wait for volume creation. None is forever.
image – (optional) Image name, ID or object from which to create the volume
bootable – (optional) Make this volume bootable. If set, wait will also be set to true.
kwargs – Keyword arguments as expected for cinder client.
The created volume Volume
object.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Create a volume backup.
volume_id – the ID of the volume to backup.
name – name of the backup, one will be generated if one is not provided
description – description of the backup, one will be generated if one is not provided
force – If set to True the backup will be created even if the volume is attached to an instance, if False it will not
wait – If true, waits for volume backup to be created.
timeout – Seconds to wait for volume backup creation. None is forever.
incremental – If set to true, the backup will be incremental.
snapshot_id – The UUID of the source snapshot to back up.
The created volume Backup
object.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Create a volume.
volume_id – the ID of the volume to snapshot.
force – If set to True the snapshot will be created even if the volume is attached to an instance, if False it will not
name – name of the snapshot, one will be generated if one is not provided
description – description of the snapshot, one will be generated if one is not provided
wait – If true, waits for volume snapshot to be created.
timeout – Seconds to wait for volume snapshot creation. None is forever.
The created volume Snapshot
object.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Create a new zone.
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)
a dict representing the created zone.
OpenStackCloudException on operation error.
Return a munch.Munch
explaining the current cloud location.
Return a munch.Munch
describing the current project
Get the current project ID.
Returns the project_id of the current token scope. None means that the token is domain scoped or unscoped.
keystoneauth1.exceptions.auth.AuthorizationFailure – if a new token fetch fails.
keystoneauth1.exceptions.auth_plugins.MissingAuthPlugin – if a plugin is not available.
Get the id of the currently logged-in user from the token.
Delete a accelerator_request.
name_or_id – The name or UUID of the accelerator request to be deleted.
filters – dict of filter conditions to push down
True if delete succeeded, False otherwise.
Delete a host aggregate.
name_or_id – Name or ID of the host aggregate to delete.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
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 user’s behalf in service of image uploads.
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.
True if deletion was successful, else False.
Delete a cluster template.
name_or_id – Name or unique ID of the cluster template.
True if the delete succeeded, False if the cluster template was not found.
OpenStackCloudException on operation error.
Delete a cluster template.
name_or_id – Name or unique ID of the cluster template.
True if the delete succeeded, False if the cluster template was not found.
OpenStackCloudException on operation error.
Delete a COE cluster.
name_or_id – Name or unique ID of the cluster.
True if the delete succeeded, False if the cluster was not found.
OpenStackCloudException on operation error.
Delete a cluster template.
name_or_id – Name or unique ID of the cluster template.
True if the delete succeeded, False if the cluster template was not found.
OpenStackCloudException on operation error.
Delete quota for a project
name_or_id – project name or id
OpenStackCloudException if it’s not a valid project or the nova client call failed
None
Delete an object-store container.
name (str) – Name of the container to delete.
Delete a device_profile.
name_or_id – The name or uuid of the device profile to be deleted.
filters – dict of filter conditions to push down
True if delete succeeded, False otherwise.
Delete a Keystone domain.
domain_id – ID of the domain to delete.
name_or_id – Name or unique ID of the domain.
True if delete succeeded, False otherwise.
OpenStackCloudException
if something goes wrong during
the OpenStack API call.
Delete a Keystone endpoint.
id – ID of the endpoint to delete.
True if delete succeeded, False otherwise.
OpenStackCloudException
if something goes wrong during
the OpenStack API call.
Deletes firewall group. Prints debug message in case to-be-deleted resource was not found.
name_or_id – firewall group name or id
filters (dict) – optional filters
DuplicateResource on multiple matches
True if resource is successfully deleted, False otherwise.
bool
Deletes firewall policy. Prints debug message in case to-be-deleted resource was not found.
name_or_id – firewall policy name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
DuplicateResource on multiple matches
True if resource is successfully deleted, False otherwise.
bool
Deletes firewall rule.
Prints debug message in case to-be-deleted resource was not found.
name_or_id – firewall rule name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
DuplicateResource on multiple matches
True if resource is successfully deleted, False otherwise.
bool
Delete a flavor
name_or_id – ID or name of the flavor to delete.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Deallocate a floating IP from a project.
floating_ip_id – a floating IP address ID.
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.
True if the IP address has been deleted, False if the IP address was not found.
OpenStackCloudException
, on operation error.
Delete a group
name_or_id – Name or unique ID of the group.
True if delete succeeded, False otherwise.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Delete an existing image.
name_or_id – Name of the image to be deleted.
wait – If True, waits for image to be deleted.
timeout – Seconds to wait for image deletion. None is forever.
delete_objects – If True, also deletes uploaded swift objects.
True if delete succeeded, False otherwise.
OpenStackCloudException if there are problems deleting.
Delete a keypair.
name – Name of the keypair to delete.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete a network.
name_or_id – Name or ID of the network being deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete network quotas for a project
name_or_id – project name or id
OpenStackCloudException if it’s not a valid project or the network client call failed
dict with the quotas
Delete an object from a container.
container (string) – Name of the container holding the object.
name (string) – Name of the object to delete.
meta (dict) – Metadata for the object in question. (optional, will be fetched if not provided)
True if delete succeeded, False if the object was not found.
OpenStackCloudException on operation error.
Delete a port
name_or_id – ID or name of the port to delete.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete a project.
name_or_id – Name or unique ID of the project.
domain_id – Domain ID to scope the retrieved project.
True if delete succeeded, False if the project was not found.
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Delete a QoS bandwidth limit rule.
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.
OpenStackCloudException on operation error.
Delete a QoS DSCP marking rule.
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.
OpenStackCloudException on operation error.
Delete a QoS minimum bandwidth rule.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule is associated.
rule_id (string) – ID of rule to delete.
OpenStackCloudException on operation error.
Delete a QoS policy.
name_or_id – Name or ID of the policy being deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete a recordset.
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 deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete a Keystone role.
name_or_id – Name or unique ID of the role.
domain_id – domain id (v3)
True if delete succeeded, False otherwise.
OpenStackCloudException
if something goes wrong during
the OpenStack API call.
Delete a logical router.
If a name, instead of a unique UUID, is supplied, it is possible that we could find more than one matching router since names are not required to be unique. An error will be raised in this case.
name_or_id – Name or ID of the router being deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Delete a security group
name_or_id (string) – The name or unique ID of the security group.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
OpenStackCloudUnavailableFeature if security groups are not supported on this cloud.
Delete a security group rule
rule_id (string) – The unique ID of the security group rule.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
OpenStackCloudUnavailableFeature if security groups are not supported on this cloud.
Delete a server instance.
name_or_id – name or ID of the server to delete
wait (bool) – If true, waits for server to be deleted.
timeout (int) – Seconds to wait for server deletion.
delete_ips (bool) – If true, deletes any floating IPs associated with the instance.
delete_ip_retry (int) – Number of times to retry deleting any floating ips, should the first try be unsuccessful.
True if delete succeeded, False otherwise if the server does not exist.
OpenStackCloudException on operation error.
Delete a server group.
name_or_id – Name or ID of the server group to delete
True if delete succeeded, False otherwise
OpenStackCloudException on operation error.
Delete metadata from a server instance.
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 instance.
None
OpenStackCloudException on operation error.
Delete a Keystone service.
name_or_id – Name or unique ID of the service.
True if delete succeeded, False otherwise.
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Delete a stack
name_or_id (string) – Stack name or ID.
wait (boolean) – Whether to wait for the delete to finish
True if delete succeeded, False if the stack was not found.
OpenStackCloudException
if something goes wrong during
the OpenStack API call
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.
name_or_id – Name or ID of the subnet being deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
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.
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.
Number of Floating IPs deleted, False if none
OpenStackCloudException
, on operation error.
Delete a volume.
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 error_deleting state.
True if deletion was successful, else False.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Delete a volume backup.
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.
True if deletion was successful, else False.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Delete volume quotas for a project
name_or_id – project name or id
The deleted volume QuotaSet
object.
OpenStackCloudException if it’s not a valid project or the call failed
Delete a volume snapshot.
name_or_id – Name or unique ID of the volume snapshot.
wait – If true, waits for volume snapshot to be deleted.
timeout – Seconds to wait for volume snapshot deletion. None is forever.
True if deletion was successful, else False.
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Delete a zone.
name_or_id – Name or ID of the zone being deleted.
True if delete succeeded, False otherwise.
OpenStackCloudException on operation error.
Detach a floating IP from a server.
server_id – ID of a server.
floating_ip_id – Id of the floating IP to detach.
True if the IP has been detached, or False if the IP wasn’t attached to any server.
OpenStackCloudException
, on operation error.
Detach a virtual port from the bare metal machine.
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.
Nothing.
Detach a volume from a server.
server – The server dict to detach from.
volume – The volume dict to detach.
wait – If true, waits for volume to be detached.
timeout – Seconds to wait for volume detachment. None is forever.
None
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
Download an image by name or ID
name_or_id (str) – Name or ID of the image.
output_path – the output path to write the image to. Either this or output_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
When output_path and output_file are not given - the bytes
comprising the given Image when stream is False, otherwise a
requests.Response
instance. When output_path or
output_file are given - an image
Image
instance.
OpenStackCloudException in the event download_image is called without exactly one of either output_path or output_file
OpenStackCloudResourceNotFound if no images are found matching the name or ID provided
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()
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, defaults to the configured value for region_name for this Connection.
The endpoint of the service, or None if not found.
Get an aggregate by name or ID.
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'
}
}
An aggregate dict or None if no matching aggregate is found.
Get a cluster template by name or ID.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A cluster template dict or None if no matching cluster template is found.
Get a cluster template by name or ID.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A cluster template dict or None if no matching cluster template is found.
Get a COE cluster by name or ID.
name_or_id – Name or ID of the cluster.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A cluster dict or None if no matching cluster is found.
Get details about the CA certificate for a cluster by name or ID.
cluster_id – ID of the cluster.
Details about the CA certificate for the given cluster.
Get a cluster template by name or ID.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A cluster template dict or None if no matching cluster template is found.
Get absolute compute limits for a project
name_or_id – (optional) project name or ID to get limits for if different from the current project
OpenStackCloudException if it’s not a valid project
A compute
AbsoluteLimits
object.
Get quota for a project
name_or_id – project name or id
A compute QuotaSet
object if found, else None.
OpenStackCloudException if it’s not a valid project
Get usage for a specific project
name_or_id – project name or id
start – datetime.datetime
or string. Start date in UTC
Defaults to 2010-07-06T12:00:00Z (the date the OpenStack project
was started)
end – datetime.datetime
or string. End date in UTC.
Defaults to now
OpenStackCloudException if it’s not a valid project
Munch object with the usage
Get metadata about a container.
name (str) – Name of the container to get metadata for.
skip_cache (bool) – Ignore the cache of container metadata for this container.
Defaults to False
.
An object store Container
object if found, else None.
Get the control list from a container.
name (str) – Name of the container.
The contol list for the container.
OpenStackCloudException
if the
container was not found or container access could not be
determined.
Return the network that is configured to be the default interface.
A network Network
object if one is found
Get exactly one Keystone domain.
domain_id – ID of the domain.
name_or_id – Name or unique ID of the domain.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
an identity Domain
object
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Get exactly one Keystone endpoint.
id – ID of endpoint.
An identity Endpoint
object
Return the networks that are configured to route northbound.
A list of network Network
objects if any are found
Return the networks that are configured to route northbound.
A list of network Network
objects if any are found
Return the networks that are configured to route northbound.
A list of network Network
objects if any are found
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.
A list of network Network
objects if any are found
Retrieves firewall group.
name_or_id – firewall group name or id
filters (dict) – optional filters
DuplicateResource on multiple matches
A network FirewallGroup
object if found, else None.
Retrieves a single firewall policy.
name_or_id – firewall policy name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
DuplicateResource on multiple matches
A network FirewallPolicy
object if found, else None.
Retrieves a single firewall rule.
name_or_id – firewall rule name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
DuplicateResource on multiple matches
A network FirewallRule
object if found, else None.
Get a flavor by name or ID.
name_or_id – Name or ID of the flavor.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
get_extra – Whether or not the list_flavors call should get the extra flavor specs.
A compute Flavor
object if found, else None.
Get a flavor by ID
id – ID of the flavor.
get_extra – Whether or not the list_flavors call should get the extra flavor specs.
A compute Flavor
object if found, else None.
Get a flavor based on amount of RAM available.
Finds the flavor with the least amount of RAM that is at least as much as the specified amount. If include is given, further filter based on matching flavor name.
ram (int) – Minimum amount of RAM.
include (string) – If given, will return a flavor whose name contains this string as a substring.
get_extra –
A compute Flavor
object.
OpenStackCloudException
if no
matching flavour could be found.
Get the name of a flavor.
flavor_id – ID of the flavor.
The name of the flavor if a match if found, else None.
Get a floating IP by ID
id – ID of the floating IP.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A floating IP munch.Munch
or None if no matching floating
IP is found.
Get a floating ip by ID
id – ID of the floating ip.
A floating ip munch.Munch
.
Get exactly one Keystone group.
name_or_id – Name or unique ID of the group(s).
An identity Group
object
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Get an image by name or ID.
name_or_id – Name or ID of the image.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
An image openstack.image.v2.image.Image
object.
Get a image by ID
id – ID of the image.
An image openstack.image.v2.image.Image
object.
Return the networks that are configured to not route northbound.
A list of network Network
objects if any are found
Return the networks that are configured to not route northbound.
A list of network Network
objects if any are found
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.
A list of network Network
objects if any are found
Get a keypair by name or ID.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A compute Keypair
object if found, else None.
Get Machine by name or uuid
Search the baremetal host out by utilizing the supplied id value which can consist of a name or UUID.
name_or_id – A node name or UUID that will be looked up.
Node
.
The node found or None if no nodes are found.
Get machine by port MAC address
mac – Port MAC address to query in order to return a node.
Node
.
The node found or None if no nodes are found.
Return the network that is configured to be the NAT destination.
A network Network
object if one is found
Return the network that is configured to be the NAT destination.
A network Network
object if one is found
Get a network by name or ID.
name_or_id – Name or ID of the network.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A network Network
object if found, else None.
Get a network by ID
id – ID of the network.
A network Network
object if found, else None.
Get Cloud provided network extensions
A set of Neutron extension aliases.
Get network quotas for a project
name_or_id – project name or id
details – if set to True it will return details about usage of quotas by given project
OpenStackCloudException if it’s not a valid project
A network Quota
object if found, else None.
Get bare metal NIC by its hardware address (usually MAC).
Get the headers and body of an object
container (string) – Name of the container.
obj (string) – Name of the object.
query_string (string) – Query args for uri. (delimiter, prefix, etc.)
resp_chunk_size (int) – Chunk size of data to read. Only used if the results are being written to a file or stream is True. (optional, defaults to 1k)
outfile – Write the object to a file instead of returning the contents. If this option is given, body in the return tuple will be None. outfile can either be a file path given as a string, or a File like object.
Tuple (headers, body) of the object, or None if the object is not found (404).
OpenStackCloudException on operation error.
Get object metadata.
container –
name –
The object metadata.
Get a raw response object for an object.
container (string) – Name of the container.
obj (string) – Name of the object.
query_string (string) – Query args for uri. (delimiter, prefix, etc.)
stream (bool) – Whether to stream the response or not.
A requests.Response
OpenStackCloudException on operation error.
Get a segment size that will work given capabilities.
segment_size –
A segment size.
Get a port by name or ID.
name_or_id – Name or ID of the port.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A network Port
object if found, else None.
Get a port by ID
id – ID of the port.
A network Port
object if found, else None.
Get exactly one project.
name_or_id – Name or unique ID of the project.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
domain_id – Domain ID to scope the retrieved project.
An identity Project
object.
OpenStackCloudException
if something goes wrong during
the OpenStack API call.
Get a QoS bandwidth limit rule by name or ID.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
rule_id – ID of the rule.
A network QoSBandwidthLimitRule
object if found, else
None.
Get a QoS DSCP marking rule by name or ID.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
rule_id – ID of the rule.
A network QoSDSCPMarkingRule
object if found, else None.
Get a QoS minimum bandwidth rule by name or ID.
policy_name_or_id (string) – Name or ID of the QoS policy to which rule should be associated.
rule_id – ID of the rule.
A network QoSMinimumBandwidthRule
object if found, else
None.
Get a QoS policy by name or ID.
name_or_id – Name or ID of the policy.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A network QoSPolicy
object if found, else None.
Get a QoS rule type details by rule type name.
rule_type – Name of the QoS rule type.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A network QoSRuleType
object if found, else None.
Get a recordset by name or ID.
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
A recordset dict or None if no matching recordset is found.
Get a Keystone role.
name_or_id – Name or unique ID of the role.
An identity Role
object if found, else None.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Get a router by name or ID.
name_or_id – Name or ID of the router.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A network Router
object if found, else None.
Get a security group by name or ID.
name_or_id – Name or ID of the security group.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A security group munch.Munch
or None if no matching
security group is found.
Get a security group by ID
id – ID of the security group.
A security group munch.Munch
.
Get a server by name or ID.
name_or_id – Name or ID of the server.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
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.
all_projects – Whether to get server from all projects or just the current auth scoped project.
A compute Server
object if found, else None.
Get a server by ID.
id – ID of the server.
A compute Server
object if found, else None.
Get the console log for a server.
server – The server to fetch the console log for. Can be either a server dict or the Name or ID of the server.
length (int) – The number of lines you would like to retrieve from the end of the log. (optional, defaults to all)
A string containing the text of the console log or an empty string if the cloud does not support console logs.
OpenStackCloudException if an invalid server argument is given or if something else unforseen happens
Get a server group by name or ID.
name_or_id – Name or ID of the server group.
filters –
A dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'policy': 'affinity',
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A compute ServerGroup
object if found, else None.
Get the ID of a server.
name_or_id –
The name of the server if found, else None.
Get the metadata for a server.
server –
The metadata for the server if found, else None.
Get the private IP of a server.
server –
The private IP of the server if set, else None.
Get the public IP of a server.
server –
The public IP of the server if set, else None.
Get exactly one Keystone service.
name_or_id – Name or unique ID of the service.
an identity Service
object
OpenStackCloudException
if something goes wrong during the
OpenStack API call or if multiple matches are found.
Get exactly one stack.
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
a openstack.orchestration.v1.stack.Stack
containing the stack description
OpenStackCloudException
if something goes wrong during the
OpenStack API call or if multiple matches are found.
Get a subnet by name or ID.
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'
}
}
A network Subnet
object if found, else None.
Get a subnet by ID
id – ID of the subnet.
A network Subnet
object if found, else None.
Get exactly one user.
name_or_id – Name or unique ID of the user.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
an identity User
object
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Get a user by ID.
user_id (string) – user ID
an identity User
object
Get a volume by name or ID.
name_or_id – Name or unique ID of the volume.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A volume Volume
object if found, else None.
Return the device name a volume is attached to for a server.
This can also be used to verify if a volume is attached to a particular server.
volume – The volume to fetch the device name from.
server_id – ID of server to check.
Device name if attached, None if volume is not attached.
Get a volume backup by name or ID.
name_or_id – Name or unique ID of the volume backup.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A volume Backup
object if found, else None.
Get a volume by ID
id – ID of the volume.
A volume Volume
object if found, else None.
Get ID of a volume.
name_or_id – Name or unique ID of the volume.
The ID of the volume if found, else None.
Get volume limits for the current project
name_or_id – (optional) Project name or ID to get limits for if different from the current project
The volume Limit
object if found, else None.
Get volume quotas for a project
name_or_id – project name or id
A volume QuotaSet
object with the quotas
OpenStackCloudException if it’s not a valid project
Get a volume by name or ID.
name_or_id – Name or unique ID of the volume snapshot.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A volume Snapshot
object if found, else None.
Takes a snapshot_id and gets a dict of the snapshot that maches that ID.
Note: This is more efficient than get_volume_snapshot.
param: snapshot_id: ID of the volume snapshot.
:returns: A volume Snapshot
object if found, else None.
Get a volume type by name or ID.
name_or_id – Name or unique ID of the volume type.
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A volume Type
object if found, else None.
Return a list of volume_type_access.
name_or_id – Name or unique ID of the volume type.
A volume Type
object if found, else None.
OpenStackCloudException on operation error.
Get volumes for a server.
server – The server to fetch volumes for.
cache – DEPRECATED This parameter no longer does anything.
A list of volume Volume
objects.
Get a zone by name or ID.
name_or_id – Name or ID of the zone
filters – A dictionary of meta data to use for further filtering
A zone dict or None if no matching zone is found.
Make a new Connection object with a global request id set.
Take the existing settings from the current Connection and construct a new Connection object with the global_request_id overridden.
from oslo_context import context
cloud = openstack.connect(cloud='example')
# Work normally
servers = cloud.list_servers()
cloud2 = cloud.global_request(context.generate_request_id())
# cloud2 sends all requests with global_request_id set
servers = cloud2.list_servers()
Additionally, this can be used as a context manager:
from oslo_context import context
c = openstack.connect(cloud='example')
# Work normally
servers = c.list_servers()
with c.global_request(context.generate_request_id()) as c2:
# c2 sends all requests with global_request_id set
servers = c2.list_servers()
global_request_id – The global_request_id to send.
Grant a role to a user.
name_or_id (string) – Name or unique 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)
system (bool) – The name of the system. (v3)
wait (bool) – Wait for role to be granted
timeout (int) –
Timeout to wait for role to be granted
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.
NOTE: precedence is given first to project, then domain, then system
True if the role is assigned, otherwise False
OpenStackCloudException – if the role cannot be granted
Add firewall rule to a policy.
Adds firewall rule to the firewall_rules list of a firewall policy. Short-circuits and returns the firewall policy early if the firewall rule id is already present in the firewall_rules list. This method doesn’t do re-ordering. If you want to move a firewall rule or down the list, you have to remove and re-add it.
name_or_id – firewall policy name or id
rule_name_or_id – firewall rule name or id
insert_after – rule name or id that should precede added rule
insert_before – rule name or id that should succeed added rule
filters (dict) – optional filters
DuplicateResource on multiple matches
ResourceNotFound if firewall policy or any of the firewall rules (inserted, after, before) is not found.
updated firewall policy
FirewallPolicy
Inspect a Barmetal machine
Engages the Ironic node inspection behavior in order to collect metadata about the baremetal machine.
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.
Node
.
Current state of the node.
Check to see if an object matches the hashes of a file.
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.
Check to see if a user is in a group.
name_or_id – Name or unique ID of the user.
group_name_or_id – Group name or ID
True if user is in the group, False otherwise
OpenStackCloudException
if something goes wrong during
the OpenStack API call
List all accelerator_requests.
filters – (optional) dict of filter conditions to push down
A list of accelerator AcceleratorRequest
objects.
List all available host aggregates.
A list of compute Aggregate
objects.
List containers.
full_listing – Ignored. Present for backwards compat
prefix – Only objects with this prefix will be returned. (optional)
A list of object store Container
objects.
OpenStackCloudException on operation error.
List all available deployables.
filters – (optional) dict of filter conditions to push down
A list of accelerator Deployable
objects.
List all device_profiles.
filters – (optional) dict of filter conditions to push down
A list of accelerator DeviceProfile
objects.
List all devices.
filters – (optional) dict of filter conditions to push down
A list of accelerator Device
objects.
List Keystone domains.
A list of identity Domain
objects.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
List Keystone endpoints.
A list of identity Endpoint
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Lists firewall groups.
A list of network FirewallGroup
objects.
Lists firewall policies.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A list of network FirewallPolicy
objects.
list[FirewallPolicy]
Lists firewall rules.
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
A list of network FirewallRule
objects.
list[FirewallRule]
List access from a private flavor for a project/tenant.
flavor_id (string) – ID of the private flavor.
List of dicts with flavor_id and tenant_id attributes.
OpenStackCloudException on operation error.
List all available floating IP pools.
NOTE: This function supports the nova-net view of the world. nova-net has been deprecated, so it’s highly recommended to switch to using neutron. get_external_ipv4_floating_networks is what you should almost certainly be using.
A list of floating IP pool munch.Munch
.
List all available floating IPs.
filters – (optional) dict of filter conditions to push down
A list of floating IP munch.Munch
.
List all hypervisors
filters –
A list of compute Hypervisor
objects.
List all available keypairs.
filters –
A list of compute Keypair
objects.
List all Magnum services. :returns: a list of dicts containing the service details.
OpenStackCloudException on operation error.
List all available networks.
filters – (optional) A dict of filter conditions to push down.
A list of network Network
objects.
Return a list of all bare metal ports.
Returns a list of ports present on the machine node.
uuid – String representing machine UUID value in order to identify the machine.
A list of ports.
List objects.
container – Name of the container to list objects in.
full_listing – Ignored. Present for backwards compat
prefix – Only objects with this prefix will be returned. (optional)
A list of object store Object
objects.
OpenStackCloudException on operation error.
List all available ports.
filters – (optional) A dict of filter conditions to push down
A list of network Port
objects.
List virtual ports attached to the bare metal machine.
name_or_id (string) – A machine name or UUID.
List of munch.Munch
representing the ports.
List all available QoS bandwidth limit rules.
policy_name_or_id (string) – Name or ID of the QoS policy from from rules should be listed.
filters – (optional) A dict of filter conditions to push down
A list of network QoSBandwidthLimitRule
objects.
OpenStackCloudResourceNotFound
if QoS policy will not be
found.
List all available QoS DSCP marking rules.
policy_name_or_id (string) – Name or ID of the QoS policy from from rules should be listed.
filters – (optional) A dict of filter conditions to push down
A list of network QoSDSCPMarkingRule
objects.
OpenStackCloudResourceNotFound
if QoS policy will not be
found.
List all available QoS minimum bandwidth rules.
policy_name_or_id (string) – Name or ID of the QoS policy from from rules should be listed.
filters – (optional) A dict of filter conditions to push down
A list of network QoSMinimumBandwidthRule
objects.
OpenStackCloudResourceNotFound
if QoS policy will not be
found.
List all available QoS policies.
filters – (optional) A dict of filter conditions to push down
A list of network QosPolicy
objects.
List all available QoS rule types.
filters – (optional) A dict of filter conditions to push down
A list of network QosRuleType
objects.
List all available recordsets.
zone – Name, ID or openstack.dns.v2.zone.Zone
instance
of the zone managing the recordset.
A list of recordsets.
List Keystone role assignments
filters (dict) –
Dict of filter conditions. Acceptable keys are:
’user’ (string) - User ID to be used as query filter.
’group’ (string) - Group ID to be used as query filter.
’project’ (string) - Project ID to be used as query filter.
’domain’ (string) - Domain ID to be used as query filter.
’system’ (string) - System name to be used as query filter.
’role’ (string) - Role ID to be used as query filter.
’os_inherit_extension_inherited_to’ (string) - Return inherited role assignments for either ‘projects’ or ‘domains’
’effective’ (boolean) - Return effective role assignments.
’include_subtree’ (boolean) - Include subtree
’user’ and ‘group’ are mutually exclusive, as are ‘domain’ and ‘project’.
A list of indentity
openstack.identity.v3.role_assignment.RoleAssignment
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
List Keystone roles.
A list of identity Role
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
List all interfaces for a router.
router (dict) – A router dict object.
interface_type (string) – One of None, “internal”, or “external”. Controls whether all, internal interfaces or external interfaces are returned.
A list of network Port
objects.
List all available routers.
filters – (optional) A dict of filter conditions to push down
A list of network Router
objects.
List all available security groups.
filters – (optional) dict of filter conditions to push down
A list of security group munch.Munch
.
List all available server groups.
A list of compute ServerGroup
objects.
List all security groups associated with the given server.
A list of security group dictionary objects.
List all available servers.
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.
A list of compute Server
objects.
List all Keystone services.
A list of identity Service
object
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
List all availability zones for the Shared File Systems service.
A list of Shared File Systems Availability Zones.
List all available subnets.
filters – (optional) A dict of filter conditions to push down
A list of network Subnet
objects.
List all volume backups.
detailed – Whether or not to add detailed additional information.
filters –
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
}
A list of volume Backup
objects.
List all volume snapshots.
detailed – Whether or not to add detailed additional information.
filters –
A dictionary of meta data to use for further filtering. Example:
{
'name': 'my-volume-snapshot',
'volume_id': 'e126044c-7b4c-43be-a32a-c9cbbc9ddb56',
'all_tenants': 1
}
A list of volume Snapshot
objects.
List all available zones.
A list of zones dicts.
Set Node Provision State
Enables a user to provision a Machine and optionally define a config drive to be utilized.
name_or_id (string) – The Name or UUID value representing the baremetal node.
state (string) – The desired provision state for the baremetal node.
configdrive (string) – An optional URL or file or path representing the configdrive. In the case of a directory, the client API will create a properly formatted configuration drive file and post the file contents to the API for deployment.
wait (boolean) – A boolean value, defaulted to false, to control if the method will wait for the desire end state to be reached before returning.
timeout (integer) – Integer value, defaulting to 3600 seconds, representing the amount of time to wait for the desire end state to be reached.
OpenStackCloudException on operation error.
Current state of the machine upon exit of the method.
Node
.
Patch Machine Information
This method allows for an interface to manipulate node entries within Ironic.
name_or_id (string) – A machine name or UUID to be updated.
patch –
The JSON Patch document is a list of dictonary objects that comply with RFC 6902 which can be found at https://tools.ietf.org/html/rfc6902.
Example patch construction:
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'
})
OpenStackCloudException on operation error.
Current state of the node.
Node
.
Wrapper around pformat that groks munch objects
Wrapper around pprint that groks munch objects
Cleanup the project resources.
Cleanup all resources in all services, which provide cleanup methods.
dry_run (bool) – Cleanup or only list identified resources.
wait_timeout (int) – Maximum amount of time given to each service to comlete the cleanup.
status_queue (queue) – a threading queue object used to get current process status. The queue contain processed resources.
filters (dict) – Additional filters for the cleanup (only resources matching all filters will be deleted, if there are no other dependencies).
resource_evaluation_fn – A callback function, which will be invoked for each resurce and must return True/False depending on whether resource need to be deleted or not.
Perform integer range searches across a list of dictionaries.
Given a list of dictionaries, search across the list using the given dictionary keys and a range of integer values for each key. Only dictionaries that match ALL search filters across the entire original data set will be returned.
It is not a requirement that each dictionary contain the key used for searching. Those without the key will be considered non-matching.
The range values must be string values and is either a set of digits representing an integer for matching, or a range operator followed by a set of digits representing an integer for matching. If a range operator is not given, exact value matching will be used. Valid operators are one of: <,>,<=,>=
data – List of dictionaries to be searched.
filters –
Dict describing the one or more range searches to perform. If more than one search is given, the result will be the members of the original data set that match ALL searches. An example of filtering by multiple ranges:
{"vcpus": "<=5", "ram": "<=2048", "disk": "1"}
A list subset of the original data set.
OpenStackCloudException on invalid range expressions.
Rebuild a server.
server_id –
image_id –
admin_pass –
detailed –
bare –
wait –
timeout –
A compute Server
object.
Register Baremetal with Ironic
Allows for the registration of Baremetal nodes with Ironic and population of pertinant node information or configuration to be passed to the Ironic API for the node.
This method also creates ports for a list of MAC addresses passed in to be utilized for boot and potentially network configuration.
If a failure is detected creating the network ports, any ports created are deleted, and the node is removed from Ironic.
nics –
An array of MAC addresses that represent the network interfaces for the node to be created.
Example:
[
{'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.
OpenStackCloudException on operation error.
Node
.
Current state of the node.
Revoke access from a private flavor for a project/tenant.
flavor_id (string) – ID of the private flavor.
project_id (string) – ID of the project/tenant.
OpenStackCloudException on operation error.
Remove a host from an aggregate.
name_or_id – Name or ID of the host aggregate.
host_name – Host to remove.
OpenStackCloudException on operation error.
Remove Baremetal Machine from Maintenance State
Similarly to set_machine_maintenance_state, this method removes a machine from maintenance 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.
name_or_id (string) – The Name or UUID value representing the baremetal node.
OpenStackCloudException on operation error.
None
Detach a subnet from an internal router interface.
At least one of subnet_id or port_id must be supplied.
If you specify both subnet and port ID, the subnet ID must correspond to the subnet ID of the first IP address on the port specified by the port ID. Otherwise an error occurs.
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
None on success
OpenStackCloudException on operation error.
Remove firewall rule from firewall policy’s firewall_rules list. Short-circuits and returns firewall policy early if firewall rule is already absent from the firewall_rules list.
name_or_id – firewall policy name or id
rule_name_or_id – firewall rule name or id
filters (dict) – optional filters
DuplicateResource on multiple matches
ResourceNotFound if firewall policy is not found
updated firewall policy
FirewallPolicy
Remove security groups from a server
Remove existing security groups from an existing server. If the security groups are not present on the server this will continue unaffected.
False if server or security groups are undefined, True otherwise.
OpenStackCloudException
, on operation error.
Remove a user from a group.
name_or_id – Name or unique ID of the user.
group_name_or_id – Group name or ID
OpenStackCloudException
if something goes wrong during
the OpenStack API call
Revoke access on a volume_type to a project.
name_or_id – ID or name of a volume_type
project_id – A project id
None
OpenStackCloudException on operation error.
Revoke a role from a user.
name_or_id (string) – Name or unique 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)
system (bool) – The name of the system. (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.
NOTE: project is required for keystone v2
NOTE: precedence is given first to project, then domain, then system
True if the role is revoke, otherwise False
OpenStackCloudException – if the role cannot be removed
Seach host aggregates.
name – aggregate name or id.
filters – a dict containing additional filters to use.
A list of compute Aggregate
objects matching the search
criteria.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search cluster templates.
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.
a list of dict containing the cluster templates
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search cluster templates.
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.
a list of dict containing the cluster templates
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search cluster templates.
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.
a list of dict containing the cluster templates
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search COE cluster.
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.
a list of dict containing the cluster
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search containers.
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`]”
A list of object store Container
objects matching the
search criteria.
OpenStackCloudException
: If something goes wrong during
the OpenStack API call.
Search Keystone domains.
name_or_id – Name or ID of the domain(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
a list of identity Domain
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
List Keystone endpoints.
id – ID of endpoint(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of identity Endpoint
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search flavors.
name_or_id –
flavors –
get_extra –
A list of compute Flavor
objects matching the search
criteria.
Search Keystone groups.
name_or_id – Name or ID of the group(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
domain_id – domain id.
A list of identity Group
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search keypairs.
name_or_id –
filters –
A list of compute Keypair
objects matching the search
criteria.
Search networks
name_or_id – Name or ID of the desired network.
filters – A dict containing additional filters to use. e.g. {‘router:external’: True}
A list of network Network
objects matching the search
criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search objects.
name (string) – Object 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`]”
A list of object store Object
objects matching the
search criteria.
OpenStackCloudException
: If something goes wrong during
the OpenStack API call.
Search ports
name_or_id – Name or ID of the desired port.
filters – A dict containing additional filters to use. e.g. {‘device_id’: ‘2711c67a-b4a7-43dd-ace7-6187b791c3f0’}
A list of network Port
objects matching the search
criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Backwards compatibility method for search_projects
search_projects originally had a parameter list that was name_or_id, filters and list had domain_id first. This method exists in this form to allow code written with positional parameter to still work. But really, use keyword arguments.
name_or_id – Name or ID of the project(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
domain_id – Domain ID to scope the searched projects.
A list of identity Project
objects.
Search QoS bandwidth limit rules
policy_name_or_id (string) – Name or ID of the QoS policy to which rules should be associated.
rule_id (string) – ID of searched rule.
filters – a dict containing additional filters to use. e.g. {‘max_kbps’: 1000}
A list of network QoSBandwidthLimitRule
objects matching
the search criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search QoS DSCP marking rules
policy_name_or_id (string) – Name or ID of the QoS policy to which rules should be associated.
rule_id (string) – ID of searched rule.
filters – a dict containing additional filters to use. e.g. {‘dscp_mark’: 32}
A list of network QoSDSCPMarkingRule
objects matching the
search criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search QoS minimum bandwidth rules
policy_name_or_id (string) – Name or ID of the QoS policy to which rules should be associated.
rule_id (string) – ID of searched rule.
filters – a dict containing additional filters to use. e.g. {‘min_kbps’: 1000}
A list of network QoSMinimumBandwidthRule
objects
matching the search criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search QoS policies
name_or_id – Name or ID of the desired policy.
filters – a dict containing additional filters to use. e.g. {‘shared’: True}
A list of network QosPolicy
objects matching the search
criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Seach Keystone roles.
name – Name or ID of the role(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
a list of identity Role
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search routers
name_or_id – Name or ID of the desired router.
filters – A dict containing additional filters to use. e.g. {‘admin_state_up’: True}
A list of network Router
objects matching the search
criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search server groups.
name_or_id – Name or unique ID of the server group(s).
filters – A dict containing additional filters to use.
A list of compute ServerGroup
objects matching the search
criteria.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search servers.
name_or_id –
filters –
detailed –
all_projects –
bare –
A list of compute Server
objects matching the search
criteria.
Search Keystone services.
name_or_id – Name or ID of the service(s).
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
a list of identity Service
objects
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search stacks.
name_or_id – Name or ID of the desired stack.
filters – a dict containing additional filters to use. e.g. {‘stack_status’: ‘CREATE_COMPLETE’}
a list of munch.Munch
containing the stack description.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search subnets
name_or_id – Name or ID of the desired subnet.
filters – A dict containing additional filters to use. e.g. {‘enable_dhcp’: True}
A list of network Subnet
objects matching the search
criteria.
OpenStackCloudException
if something goes wrong during the
OpenStack API call.
Search users.
name_or_id – Name or ID of the user(s).
domain_id – Domain ID to scope the retrieved users.
filters –
dictionary of meta data to use for further filtering. Elements of this dictionary may, themselves, be dictionaries. Example:
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of identity User
objects
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Search for one or more volume backups.
name_or_id – Name or unique ID of volume backup(s).
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of volume Backup
objects, if any are found.
Search for one or more volume snapshots.
name_or_id – Name or unique ID of volume snapshot(s).
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of volume Snapshot
objects, if any are found.
Search for one or more volume types.
name_or_id – Name or unique ID of volume type(s).
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of volume Type
objects, if any are found.
Search for one or more volumes.
name_or_id – Name or unique ID of volume(s).
filters –
DEPRECATED 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'
}
}
OR
A string containing a jmespath expression for further filtering. Example:
"[?last_name==`Smith`] | [?other.gender]==`Female`]"
A list of volume Volume
objects, if any are found.
Set aggregate metadata, replacing the existing metadata.
name_or_id – Name of the host aggregate to update
metadata – Dict containing metadata to replace (Use {‘key’: None} to remove a key)
a dict representing the new host aggregate.
OpenStackCloudException on operation error.
Set a quota in a project
name_or_id – project name or id
kwargs – key/value pairs of quota name and quota value
OpenStackCloudException if the resource to set the quota does not exist.
Set the access control list on a container.
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.
refresh – Flag to trigger refresh of the container properties
Add extra specs to a flavor
flavor_id (string) – ID of the flavor to update.
extra_specs (dict) – Dictionary of key-value pairs.
OpenStackCloudException on operation error.
OpenStackCloudResourceNotFound if flavor ID is not found.
Set Baremetal Machine Maintenance State
Sets Baremetal maintenance state and maintenance reason.
name_or_id (string) – The Name or UUID value representing the baremetal node.
state (boolean) – The desired state of the node. True being in maintenance 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.
OpenStackCloudException on operation error.
None
De-activate baremetal machine power
This is a method that sets the node power state to “off”.
A string representing the baremetal node to have power turned to an “off” state.
OpenStackCloudException on operation error.
Activate baremetal machine power
This is a method that sets the node power state to “on”.
A string representing the baremetal node to have power turned to an “on” state.
OpenStackCloudException on operation error.
None
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”.
A string representing the baremetal node to have power turned to an “off” state.
OpenStackCloudException on operation error.
None
Set a network quota in a project
name_or_id – project name or id
kwargs – key/value pairs of quota name and quota value
OpenStackCloudException if the resource to set the quota does not exist.
Set metadata in a server instance.
name_or_id (str) – The name or ID of the server instance to update.
metadata (dict) – A dictionary with the key=value pairs to set in the server instance. It only updates the key=value pairs provided. Existing ones will remain untouched.
None
OpenStackCloudException on operation error.
Set a volume’s bootable flag.
name_or_id – Name or unique ID of the volume.
bootable (bool) – Whether the volume should be bootable. (Defaults to True)
OpenStackCloudTimeout if wait time exceeded.
OpenStackCloudException on operation error.
None
Set a volume quota in a project
name_or_id – project name or id
kwargs – key/value pairs of quota name and quota value
None
OpenStackCloudException if the resource to set the quota does not exist.
Sign client key and generate the CA certificate for a cluster
cluster_id – UUID of the cluster.
csr – Certificate Signing Request (CSR) for authenticating client key.The CSR will be used by Magnum to generate a signed certificate that client will use to communicate with the cluster.
a dict representing the signed certs.
OpenStackCloudException on operation error.
Download the content via a streaming iterator.
container (string) – Name of the container.
obj (string) – Name of the object.
query_string (string) – Query args for uri. (delimiter, prefix, etc.)
resp_chunk_size (int) – Chunk size of data to read. Only used if the results are
An iterator over the content or None if the object is not found.
OpenStackCloudException on operation error.
Unbind an accelerator from VM.
uuid – The uuid of the accelerator_request to be unbinded.
properties – The info of VM that will unbind the accelerator.
True if unbind succeeded, False otherwise.
Unregister Baremetal from Ironic
Removes entries for Network Interfaces and baremetal nodes from an Ironic API
nics – An array of strings that consist of MAC addresses to be removed.
uuid (string) – The UUID of the node to be deleted.
wait – DEPRECATED, do not use.
timeout – Integer value, representing seconds with a default value of 600, which controls the maximum amount of time to block until a lock is released on machine.
OpenStackCloudException on operation failure.
Delete extra specs from a flavor
flavor_id (string) – ID of the flavor to update.
keys – List of spec keys to delete.
OpenStackCloudException on operation error.
OpenStackCloudResourceNotFound if flavor ID is not found.
Update a host aggregate.
name_or_id – Name or ID of the aggregate being updated.
name – New aggregate name
availability_zone – Availability zone to assign to hosts
The updated compute Aggregate
object.
OpenStackCloudException on operation error.
Update a cluster template.
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.
a dict representing the updated cluster template.
OpenStackCloudException on operation error.
Update a cluster template.
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.
a dict representing the updated cluster template.
OpenStackCloudException on operation error.
Update a COE cluster.
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.
a dict representing the updated cluster.
OpenStackCloudException on operation error.
Update a cluster template.
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.
a dict representing the updated cluster template.
OpenStackCloudException on operation error.
Update the metadata in a container.
name (str) – Name of the container to update.
headers (dict) – Key/Value headers to set on the container.
Update a Keystone domain
domain_id –
name –
description –
enabled –
name_or_id – Name or unique ID of the domain.
The updated identity Domain
object.
OpenStackCloudException – if the domain cannot be updated
Updates firewall group. To unset egress- or ingress firewall policy, set egress_firewall_policy or ingress_firewall_policy to None. You can also set egress_firewall_policy_id and ingress_firewall_policy_id directly, which will skip the policy lookups.
name_or_id – firewall group name or id
filters (dict) – optional filters
kwargs – firewall group update parameters See create_firewall_group docstring for valid parameters.
The updated network FirewallGroup
object.
BadRequestException if parameters are malformed
DuplicateResource on multiple matches
ResourceNotFound if firewall group, a firewall policy (egress, ingress) or port is not found
Updates firewall policy.
name_or_id – firewall policy name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
kwargs – firewall policy update parameters See create_firewall_policy docstring for valid parameters.
The updated network FirewallPolicy
object.
BadRequestException if parameters are malformed
DuplicateResource on multiple matches
ResourceNotFound if resource is not found
Updates firewall rule.
name_or_id – firewall rule name or id
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'
}
}
OR A string containing a jmespath expression for further filtering. Example:: “[?last_name==`Smith`] | [?other.gender]==`Female`]”
kwargs – firewall rule update parameters. See create_firewall_rule docstring for valid parameters.
The updated network FirewallRule
object.
BadRequestException if parameters are malformed
NotFoundException if resource is not found
Update an existing group
name_or_id – Name or unique ID of the group.
name – New group name.
description – New group description.
The updated identity Group
object.
OpenStackCloudException
: if something goes wrong during
the OpenStack API call.
Update a machine with new configuration information
A user-friendly method to perform updates of a machine, in whole or part.
name_or_id (string) – A machine name or UUID to be updated.
attrs – Attributes to updated on the machine.
OpenStackCloudException on operation error.
Dictionary containing a machine sub-dictonary consisting of the updated data returned from the API update operation, and a list named changes which contains all of the API paths that received updates.
Update a network.
name_or_id (string) – Name or ID of the network being updated.
name (string) – New name of the network.
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:
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
mtu_size (int) – New maximum transmission unit value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
port_security_enabled (bool) – Enable or disable port security.
dns_domain (string) – Specify the DNS domain associated with this network.
The updated network Network
object.
OpenStackCloudException on operation error.
Update the metadata of an object
container – The name of the container the object is in
name – Name for the object within the container.
metadata – This dict will get changed into headers that set metadata of the object
headers – These will be passed through to the object update API as HTTP Headers.
None
OpenStackCloudException
on operation error.
Update a port
Note: to unset an attribute use None value. To leave an attribute untouched just omit it.
name_or_id – name or ID of the port to update. (Required)
name – A symbolic name for the port. (Optional)
admin_state_up – The administrative status of the port, which is up (true) or down (false). (Optional)
fixed_ips –
List of ip_addresses and subnet_ids. (Optional) If you specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port. If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the specified address to the port. For example:
[
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
]
security_groups – List of security group UUIDs. (Optional)
allowed_address_pairs –
Allowed address pairs list (Optional) For example:
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
extra_dhcp_opts –
Extra DHCP options. (Optional). For example:
[
{
"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 network. (Optional)
qos_policy_id – The ID of the QoS policy to apply for port.
The updated network Port
object.
OpenStackCloudException on operation error.
Update a project
name_or_id – Name or unique ID of the project.
enabled – Whether the project is enabled or not.
domain_id – Domain ID to scope the retrieved project.
An identity Project
object.
Update a QoS bandwidth limit rule.
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 second).
max_burst_kbps (int) – Maximum burst value (in kilobits).
direction (string) – Ingress or egress. The direction in which the traffic will be limited.
The updated network QoSBandwidthLimitRule
object.
OpenStackCloudException on operation error.
Update a QoS DSCP marking rule.
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
The updated network QoSDSCPMarkingRule
object.
OpenStackCloudException on operation error.
Update a QoS minimum bandwidth rule.
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 traffic will be available.
The updated network QoSMinimumBandwidthRule
object.
OpenStackCloudException on operation error.
Update an existing QoS policy.
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.
The updated network QosPolicyRule
object.
OpenStackCloudException on operation error.
Update a recordset.
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
a dict representing the updated recordset.
OpenStackCloudException on operation error.
Update a Keystone role.
name_or_id – Name or unique ID of the role.
name (string) – The new role name
domain_id – domain id
an identity Role
object
OpenStackCloudException – if the role cannot be created
Update an existing logical router.
name_or_id (string) – The name or UUID of the router to update.
name (string) – The new router name.
admin_state_up (bool) – The administrative state of the router.
ext_gateway_net_id (string) – The network ID for the external gateway.
enable_snat (bool) – Enable Source NAT (SNAT) attribute.
ext_fixed_ips –
List of dictionaries of desired IP and/or subnet on the external network. Example:
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
]
routes (list) –
A list of dictionaries with destination and nexthop parameters. To clear all routes pass an empty list ([]).
Example:
[
{
"destination": "179.24.1.0/24",
"nexthop": "172.24.3.99"
}
]
The updated network Router
object.
OpenStackCloudException on operation error.
Update a security group
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.
A munch.Munch
describing the updated security group.
OpenStackCloudException on operation error.
Update a server.
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
The updated compute Server
object.
OpenStackCloudException on operation error.
Update a stack.
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.
Only one of template_file, template_url, template_object should be specified.
a dict containing the stack description
OpenStackCloudException
if something goes wrong during
the OpenStack API calls
Update an existing subnet.
name_or_id (string) – Name or ID of the subnet to update.
subnet_name (string) – The new name of the subnet.
enable_dhcp (bool) – Set to True
if DHCP is enabled and
False
if disabled.
gateway_ip (string) – The gateway IP address. When you specify both allocation_pools and gateway_ip, you must ensure that the gateway IP does not overlap with the specified allocation pools.
disable_gateway_ip (bool) – Set to True
if gateway IP address
is disabled and False
if enabled. It is not allowed with
gateway_ip. Default is False
.
allocation_pools –
A list of dictionaries of the start and end addresses for the allocation pools. For example:
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
dns_nameservers –
A list of DNS name servers for the subnet. For example:
[ "8.8.8.7", "8.8.8.8" ]
host_routes –
A list of host route dictionaries for the subnet. For example:
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
The updated network Subnet
object.
OpenStackCloudException on operation error.
Update a volume.
name_or_id – Name or unique ID of the volume.
kwargs – Volume attributes to be updated.
The updated volume Volume
object.
Update a zone.
name_or_id – Name or ID of the zone being updated.
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)
a dict representing the updated zone.
OpenStackCloudException on operation error.
Validate parameters of the machine.
name_or_id (string) – The Name or UUID value representing the baremetal node.
for_deploy (bool) – If True
, validate readiness for deployment,
otherwise validate only the power management properties.
ValidationException
Check if a volume exists.
name_or_id – Name or unique ID of the volume.
True if the volume exists, else False.
Wait for a baremetal node to have no lock.
DEPRECATED, use wait_for_node_reservation
on the baremetal proxy.
OpenStackCloudException upon client failure.
None
Wait for a server to reach ACTIVE status.
Support exists for users coming from older releases of OpenStack SDK who have
been using the Profile
interface.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.