Merge "Merge 'origin/feature/r1' into master"

This commit is contained in:
Zuul 2022-03-16 15:17:29 +00:00 committed by Gerrit Code Review
commit fcd5be224c
10 changed files with 472 additions and 521 deletions

View File

@ -46,8 +46,8 @@ class BaremetalCloudMixin:
def list_nics_for_machine(self, uuid):
"""Returns a list of ports present on the machine node.
:param uuid: String representing machine UUID value in
order to identify the machine.
:param uuid: String representing machine UUID value in order to
identify the machine.
:returns: A list of ports.
"""
# TODO(dtantsur): support node names here.
@ -80,7 +80,7 @@ class BaremetalCloudMixin:
:param name_or_id: A node name or UUID that will be looked up.
:returns: ``munch.Munch`` representing the node found or None if no
nodes are found.
nodes are found.
"""
try:
return self._normalize_machine(self.baremetal.get_node(name_or_id))
@ -92,8 +92,8 @@ class BaremetalCloudMixin:
:param mac: Port MAC address to query in order to return a node.
:returns: ``munch.Munch`` representing the node found or None
if the node is not found.
:returns: ``munch.Munch`` representing the node found or None if the
node is not found.
"""
nic = self.get_nic_by_mac(mac)
if nic is None:
@ -108,16 +108,16 @@ class BaremetalCloudMixin:
metadata about the baremetal machine.
:param name_or_id: String representing machine name or UUID value in
order to identify the machine.
order to identify the machine.
:param wait: Boolean value controlling if the method is to wait for
the desired state to be reached or a failure to occur.
the desired state to be reached or a failure to occur.
:param timeout: Integer value, defautling to 3600 seconds, for the$
wait state to reach completion.
:param timeout: Integer value, defautling to 3600 seconds, for the
wait state to reach completion.
:returns: ``munch.Munch`` representing the current state of the machine
upon exit of the method.
upon exit of the method.
"""
return_to_available = False
@ -175,36 +175,34 @@ class BaremetalCloudMixin:
created are deleted, and the node is removed from Ironic.
:param nics:
An array of MAC addresses that represent the
network interfaces for the node to be created.
An array of MAC addresses that represent the
network interfaces for the node to be created.
Example::
Example::
[
{'mac': 'aa:bb:cc:dd:ee:01'},
{'mac': 'aa:bb:cc:dd:ee:02'}
]
[
{'mac': 'aa:bb:cc:dd:ee:01'},
{'mac': 'aa:bb:cc:dd:ee:02'}
]
:param 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.
:param 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.
:param timeout: Integer value, defautling to 3600 seconds, for the
wait state to reach completion.
:param timeout: Integer value, defautling to 3600 seconds, for the wait
state to reach completion.
:param lock_timeout: Integer value, defaulting to 600 seconds, for
locks to clear.
locks to clear.
:param kwargs: Key value pairs to be passed to the Ironic API,
including uuid, name, chassis_uuid, driver_info,
parameters.
including uuid, name, chassis_uuid, driver_info, parameters.
:raises: OpenStackCloudException on operation error.
:returns: Returns a ``munch.Munch`` representing the new
baremetal node.
baremetal node.
"""
msg = ("Baremetal machine node failed to be created.")
@ -332,14 +330,14 @@ class BaremetalCloudMixin:
from an Ironic API
:param nics: An array of strings that consist of MAC addresses
to be removed.
to be removed.
:param string uuid: The UUID of the node to be deleted.
:param wait: DEPRECATED, do not use.
:param 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.
value of 600, which controls the maximum amount of time to block
until a lock is released on machine.
:raises: OpenStackCloudException on operation failure.
"""
@ -382,27 +380,27 @@ class BaremetalCloudMixin:
:param string name_or_id: A machine name or UUID to be updated.
:param 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.
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::
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'
})
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'
})
:raises: OpenStackCloudException on operation error.
@ -423,9 +421,9 @@ class BaremetalCloudMixin:
:raises: OpenStackCloudException on operation error.
:returns: ``munch.Munch`` 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.
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.
"""
machine = self.get_machine(name_or_id)
if not machine:
@ -493,10 +491,9 @@ class BaremetalCloudMixin:
"""Validate parameters of the machine.
:param string name_or_id: The Name or UUID value representing the
baremetal node.
baremetal node.
:param bool for_deploy: If ``True``, validate readiness for deployment,
otherwise validate only the power management
properties.
otherwise validate only the power management properties.
:raises: :exc:`~openstack.exceptions.ValidationException`
"""
if for_deploy:
@ -522,27 +519,24 @@ class BaremetalCloudMixin:
config drive to be utilized.
:param string name_or_id: The Name or UUID value representing the
baremetal node.
:param string state: The desired provision state for the
baremetal node.
baremetal node.
:param string state: The desired provision state for the baremetal
node.
:param string configdrive: 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.
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.
:param boolean wait: A boolean value, defaulted to false, to control
if the method will wait for the desire end state
to be reached before returning.
if the method will wait for the desire end state to be reached
before returning.
:param integer timeout: Integer value, defaulting to 3600 seconds,
representing the amount of time to wait for
the desire end state to be reached.
representing the amount of time to wait for the desire end state to
be reached.
:raises: OpenStackCloudException on operation error.
:returns: ``munch.Munch`` representing the current state of the machine
upon exit of the method.
upon exit of the method.
"""
node = self.baremetal.set_node_provision_state(
name_or_id, target=state, config_drive=configdrive,
@ -559,14 +553,13 @@ class BaremetalCloudMixin:
Sets Baremetal maintenance state and maintenance reason.
:param string name_or_id: The Name or UUID value representing the
baremetal node.
:param boolean state: 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.
baremetal node.
:param boolean state: 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.
:param string reason: An optional freeform string that is supplied to
the baremetal API to allow for notation as to why
the node is in maintenance state.
the baremetal API to allow for notation as to why the node is in
maintenance state.
:raises: OpenStackCloudException on operation error.
@ -580,13 +573,13 @@ class BaremetalCloudMixin:
def remove_machine_from_maintenance(self, name_or_id):
"""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.
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.
:param string name_or_id: The Name or UUID value representing the
baremetal node.
baremetal node.
:raises: OpenStackCloudException on operation error.
@ -600,8 +593,7 @@ class BaremetalCloudMixin:
This is a method that sets the node power state to "on".
:params string name_or_id: A string representing the baremetal
node to have power turned to an "on"
state.
node to have power turned to an "on" state.
:raises: OpenStackCloudException on operation error.
@ -615,8 +607,7 @@ class BaremetalCloudMixin:
This is a method that sets the node power state to "off".
:params string name_or_id: A string representing the baremetal
node to have power turned to an "off"
state.
node to have power turned to an "off" state.
:raises: OpenStackCloudException on operation error.
@ -632,8 +623,7 @@ class BaremetalCloudMixin:
to "on".
:params string name_or_id: A string representing the baremetal
node to have power turned to an "off"
state.
node to have power turned to an "off" state.
:raises: OpenStackCloudException on operation error.

View File

@ -70,10 +70,10 @@ class CoeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -91,8 +91,7 @@ class CoeCloudMixin(_normalize.Normalizer):
:param string name: Name of the cluster.
:param string image_id: ID of the cluster template to use.
Other arguments will be passed in kwargs.
Other arguments will be passed in kwargs.
:returns: a dict containing the cluster description
@ -144,8 +143,7 @@ class CoeCloudMixin(_normalize.Normalizer):
:param name_or_id: Name or ID of the COE cluster being updated.
:param operation: Operation to perform - add, remove, replace.
Other arguments will be passed with kwargs.
Other arguments will be passed with kwargs.
:returns: a dict representing the updated cluster.
@ -195,9 +193,8 @@ class CoeCloudMixin(_normalize.Normalizer):
:param cluster_id: UUID of the cluster.
:param 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.
client key.The CSR will be used by Magnum to generate a signed
certificate that client will use to communicate with the cluster.
:returns: a dict representing the signed certs.
@ -273,10 +270,10 @@ class CoeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -299,8 +296,7 @@ class CoeCloudMixin(_normalize.Normalizer):
:param string image_id: Name or ID of the image to use.
:param string keypair_id: Name or ID of the keypair to use.
:param string coe: Name of the coe for the cluster template.
Other arguments will be passed in kwargs.
Other arguments will be passed in kwargs.
:returns: a dict containing the cluster template description
@ -374,8 +370,7 @@ class CoeCloudMixin(_normalize.Normalizer):
:param name_or_id: Name or ID of the cluster template being updated.
:param operation: Operation to perform - add, remove, replace.
Other arguments will be passed with kwargs.
Other arguments will be passed with kwargs.
:returns: a dict representing the updated cluster template.

View File

@ -127,10 +127,10 @@ class ComputeCloudMixin(_normalize.Normalizer):
"""List names of availability zones.
:param bool unavailable: Whether or not to include unavailable zones
in the output. Defaults to False.
in the output. Defaults to False.
:returns: A list of availability zone names, or an empty list if the
list could not be fetched.
list could not be fetched.
"""
try:
zones = self.compute.availability_zones()
@ -150,9 +150,8 @@ class ComputeCloudMixin(_normalize.Normalizer):
"""List all available flavors.
:param get_extra: Whether or not to fetch extra specs for each flavor.
Defaults to True. Default behavior value can be
overridden in clouds.yaml by setting
openstack.cloud.get_extra_specs to False.
Defaults to True. Default behavior value can be overridden in
clouds.yaml by setting openstack.cloud.get_extra_specs to False.
:returns: A list of flavor ``munch.Munch``.
"""
@ -270,13 +269,13 @@ class ComputeCloudMixin(_normalize.Normalizer):
"""List all available servers.
:param detailed: Whether or not to add detailed additional information.
Defaults to False.
Defaults to False.
:param all_projects: Whether to list servers from all projects or just
the current auth scoped project.
the current auth scoped project.
:param 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.
server record. Defaults to False, meaning the addresses dict will
be populated as needed from neutron. Setting to True implies
detailed = False.
:param filters: Additional query parameters passed to the API server.
:returns: A list of server ``munch.Munch``.
@ -338,7 +337,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
""" Get absolute compute limits for a project
:param name_or_id: (optional) project name or ID to get limits for
if different from the current project
if different from the current project
:raises: OpenStackCloudException if it's not a valid project
:returns:
@ -364,10 +363,10 @@ class ComputeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -375,7 +374,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A keypair ``munch.Munch`` or None if no matching keypair is
found.
found.
"""
return _utils._get_entity(self, 'keypair', name_or_id, filters)
@ -388,18 +387,17 @@ class ComputeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering.
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:param get_extra:
Whether or not the list_flavors call should get the extra flavor
specs.
:param get_extra: Whether or not the list_flavors call should get the
extra flavor specs.
:returns: A flavor ``munch.Munch`` or None if no matching flavor is
found.
@ -417,8 +415,8 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param id: ID of the flavor.
:param get_extra:
Whether or not the list_flavors call should get the extra flavor
specs.
Whether or not the list_flavors call should get the extra flavor
specs.
:returns: A flavor ``munch.Munch``.
"""
return self.compute.get_flavor(id, get_extra_specs=get_extra)
@ -427,14 +425,14 @@ class ComputeCloudMixin(_normalize.Normalizer):
"""Get the console log for a server.
:param server: The server to fetch the console log for. Can be either
a server dict or the Name or ID of the server.
a server dict or the Name or ID of the server.
:param int length: The number of lines you would like to retrieve from
the end of the log. (optional, defaults to all)
the end of the log. (optional, defaults to all)
:returns: A string containing the text of the console log or an
empty string if the cloud does not support console logs.
empty string if the cloud does not support console logs.
:raises: OpenStackCloudException if an invalid server argument is given
or if something else unforseen happens
or if something else unforseen happens
"""
if not isinstance(server, dict):
@ -468,26 +466,26 @@ class ComputeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering.
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:param detailed: Whether or not to add detailed additional information.
Defaults to False.
Defaults to False.
:param 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.
server record. Defaults to False, meaning the addresses dict will
be populated as needed from neutron. Setting to True implies
detailed = False.
:param all_projects: Whether to get server from all projects or just
the current auth scoped project.
the current auth scoped project.
:returns: A server ``munch.Munch`` or None if no matching server is
found.
found.
"""
searchfunc = functools.partial(self.search_servers,
@ -526,7 +524,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'policy': 'affinity',
'policy': 'affinity',
}
OR
@ -534,7 +532,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A server groups dict or None if no matching server group
is found.
is found.
"""
return _utils._get_entity(self, 'server_group', name_or_id,
@ -576,14 +574,14 @@ class ComputeCloudMixin(_normalize.Normalizer):
"""Create an image by snapshotting an existing server.
..note::
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.
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.
:param name: Name of the image to be created
:param server: Server name or ID or dict representing the server
to be snapshotted
to be snapshotted
:param wait: If true, waits for image to be created.
:param timeout: Seconds to wait for image creation. None is forever.
:param metadata: Metadata to give newly-created image entity
@ -641,84 +639,76 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param name: Something to name the server.
:param image: Image dict, name or ID to boot with. image is required
unless boot_volume is given.
unless boot_volume is given.
:param flavor: Flavor dict, name or ID to boot onto.
:param auto_ip: Whether to take actions to find a routable IP for
the server. (defaults to True)
the server. (defaults to True)
:param ips: List of IPs to attach to the server (defaults to None)
:param ip_pool: Name of the network or floating IP pool to get an
address from. (defaults to None)
address from. (defaults to None)
:param root_volume: Name or ID of a volume to boot from
(defaults to None - deprecated, use boot_volume)
(defaults to None - deprecated, use boot_volume)
:param boot_volume: Name or ID of a volume to boot from
(defaults to None)
(defaults to None)
:param terminate_volume: If booting from a volume, whether it should
be deleted when the server is destroyed.
(defaults to False)
be deleted when the server is destroyed. (defaults to False)
:param volumes: (optional) A list of volumes to attach to the server
:param meta: (optional) A dict of arbitrary key/value metadata to
store for this server. Both keys and values must be
<=255 characters.
store for this server. Both keys and values must be <=255
characters.
:param 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.
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.
:param reservation_id: a UUID for the set of servers being requested.
:param min_count: (optional extension) The minimum number of
servers to launch.
:param max_count: (optional extension) The maximum number of
servers to launch.
:param min_count: (optional extension) The minimum number of servers to
launch.
:param max_count: (optional extension) The maximum number of servers to
launch.
:param security_groups: A list of security group names
:param userdata: user data to pass to be exposed by the metadata
server this can be a file type object as well or a
string.
server this can be a file type object as well or a string.
:param key_name: (optional extension) name of previously created
keypair to inject into the instance.
keypair to inject into the instance.
:param availability_zone: Name of the availability zone for instance
placement.
placement.
:param block_device_mapping: (optional) A dict of block
device mappings for this server.
device mappings for this server.
:param block_device_mapping_v2: (optional) A dict of block
device mappings for this server.
device mappings for this server.
:param nics: (optional extension) an ordered list of nics to be
added to this server, with information about
connected networks, fixed IPs, port etc.
added to this server, with information about connected networks,
fixed IPs, port etc.
:param scheduler_hints: (optional extension) arbitrary key-value pairs
specified by the client to help boot an instance
specified by the client to help boot an instance
:param config_drive: (optional extension) value for config drive
either boolean, or volume-id
either boolean, or volume-id
:param disk_config: (optional extension) control how the disk is
partitioned when the server is created. possible
values are 'AUTO' or 'MANUAL'.
partitioned when the server is created. possible values are 'AUTO'
or 'MANUAL'.
:param admin_pass: (optional extension) add a user supplied admin
password.
password.
:param wait: (optional) Wait for the address to appear as assigned
to the server. Defaults to False.
to the server. Defaults to False.
:param timeout: (optional) Seconds to wait, defaults to 60.
See the ``wait`` parameter.
See the ``wait`` parameter.
:param reuse_ips: (optional) Whether to attempt to reuse pre-existing
floating ips should a floating IP be
needed (defaults to True)
floating ips should a floating IP be needed (defaults to True)
:param 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.
server to. Mutually exclusive with the nics parameter. Can also
be a list of network names or IDs or network dicts.
:param 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.
implies True, but boot_from_volume=True with no boot_volume is
valid and will create a volume from the image and use that.
:param volume_size: When booting an image from volume, how big should
the created volume be? Defaults to 50.
the created volume be? Defaults to 50.
:param 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)
be attached to, if it's not possible to infer from the cloud's
configuration. (Optional, defaults to None)
:param 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)
If a group is provided in both scheduler_hints and in the group
param, the group param will win. (Optional, defaults to None)
:returns: A ``munch.Munch`` representing the created server.
:raises: OpenStackCloudException on operation error.
"""
@ -1103,11 +1093,10 @@ class ComputeCloudMixin(_normalize.Normalizer):
def set_server_metadata(self, name_or_id, metadata):
"""Set metadata in a server instance.
:param str name_or_id: The name or ID of the server instance
to update.
:param str name_or_id: The name or ID of the server instance to update.
:param dict metadata: 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.
to set in the server instance. It only updates the key=value pairs
provided. Existing ones will remain untouched.
:raises: OpenStackCloudException on operation error.
"""
@ -1247,13 +1236,13 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param name_or_id: Name of the server to be updated.
:param detailed: Whether or not to add detailed additional information.
Defaults to False.
Defaults to False.
:param 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
server record. Defaults to False, meaning the addresses dict will
be populated as needed from neutron. Setting to True implies
detailed = False.
:param name: New name for the server
:param description: New description for the server
:returns: a dictionary representing the updated server.
@ -1459,14 +1448,14 @@ class ComputeCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'availability_zone': 'nova',
'metadata': {
'cpu_allocation_ratio': '1.0'
}
'availability_zone': 'nova',
'metadata': {
'cpu_allocation_ratio': '1.0'
}
}
:returns: An aggregate dict or None if no matching aggregate is
found.
found.
"""
aggregate = self.compute.find_aggregate(
@ -1535,7 +1524,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param name_or_id: Name of the host aggregate to update
:param metadata: Dict containing metadata to replace (Use
{'key': None} to remove a key)
{'key': None} to remove a key)
:returns: a dict representing the new host aggregate.
@ -1612,7 +1601,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param name_or_id: project name or id
:raises: OpenStackCloudException if it's not a valid project or the
nova client call failed
nova client call failed
:returns: dict with the quotas
"""
@ -1625,10 +1614,10 @@ class ComputeCloudMixin(_normalize.Normalizer):
:param name_or_id: project name or id
:param start: :class:`datetime.datetime` or string. Start date in UTC
Defaults to 2010-07-06T12:00:00Z (the date the OpenStack
project was started)
Defaults to 2010-07-06T12:00:00Z (the date the OpenStack project
was started)
:param end: :class:`datetime.datetime` or string. End date in UTC.
Defaults to now
Defaults to now
:raises: OpenStackCloudException if it's not a valid project
:returns: Munch object with the usage

View File

@ -63,11 +63,11 @@ class DnsCloudMixin:
:param name: Name of the zone being created.
:param zone_type: Type of the zone (primary/secondary)
:param email: Email of the zone owner (only
applies if zone_type is primary)
applies if zone_type is primary)
:param description: Description of the zone
:param ttl: TTL (Time to live) value in seconds
:param masters: Master nameservers (only applies
if zone_type is secondary)
if zone_type is secondary)
:returns: a dict representing the created zone.
@ -110,11 +110,11 @@ class DnsCloudMixin:
:param name_or_id: Name or ID of the zone being updated.
:param email: Email of the zone owner (only
applies if zone_type is primary)
applies if zone_type is primary)
:param description: Description of the zone
:param ttl: TTL (Time to live) value in seconds
:param masters: Master nameservers (only applies
if zone_type is secondary)
if zone_type is secondary)
:returns: a dict representing the updated zone.

View File

@ -102,10 +102,10 @@ class FloatingIPCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -113,7 +113,7 @@ class FloatingIPCloudMixin(_normalize.Normalizer):
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A floating IP ``munch.Munch`` or None if no matching floating
IP is found.
IP is found.
"""
return _utils._get_entity(self, 'floating_ip', id, filters)
@ -250,7 +250,7 @@ class FloatingIPCloudMixin(_normalize.Normalizer):
:returns: a list of floating IP addresses.
:raises: ``OpenStackCloudResourceNotFound``, if an external network
that meets the specified criteria cannot be found.
that meets the specified criteria cannot be found.
"""
if project_id is None:
# Make sure we are only listing floatingIPs allocated the current
@ -309,7 +309,7 @@ class FloatingIPCloudMixin(_normalize.Normalizer):
:returns: a list of floating IP addresses.
:raises: ``OpenStackCloudResourceNotFound``, if a floating IP pool
is not specified and cannot be found.
is not specified and cannot be found.
"""
with _utils.shade_exceptions(

View File

@ -387,7 +387,7 @@ class IdentityCloudMixin:
:param name_or_id: Name or id of the desired service.
:param filters: a dict containing additional filters to use. e.g.
{'type': 'network'}.
{'type': 'network'}.
:returns: a list of ``munch.Munch`` containing the services description
@ -402,7 +402,7 @@ class IdentityCloudMixin:
:param name_or_id: Name or id of the desired service.
:param filters: a dict containing additional filters to use. e.g.
{'type': 'network'}
{'type': 'network'}
:returns: a ``munch.Munch`` containing the services description,
i.e. the following attributes::
@ -528,7 +528,7 @@ class IdentityCloudMixin:
:param id: endpoint id.
:param filters: a dict containing additional filters to use. e.g.
{'region': 'region-a.geo-1'}
{'region': 'region-a.geo-1'}
:returns: a list of ``munch.Munch`` containing the endpoint
description. Each dict contains the following attributes::
@ -553,7 +553,7 @@ class IdentityCloudMixin:
:param id: endpoint id.
:param filters: a dict containing additional filters to use. e.g.
{'region': 'region-a.geo-1'}
{'region': 'region-a.geo-1'}
:returns: a ``munch.Munch`` containing the endpoint description.
i.e. a ``munch.Munch`` containing the following attributes::
@ -673,7 +673,7 @@ class IdentityCloudMixin:
:param name_or_id: domain name or id
:param dict filters: A dict containing additional filters to use.
Keys to search on are id, name, enabled and description.
Keys to search on are id, name, enabled and description.
:returns: a list of ``munch.Munch`` containing the domain description.
Each ``munch.Munch`` contains the following attributes::
@ -698,7 +698,7 @@ class IdentityCloudMixin:
:param domain_id: domain id.
:param name_or_id: domain name or id.
:param dict filters: A dict containing additional filters to use.
Keys to search on are id, name, enabled and description.
Keys to search on are id, name, enabled and description.
:returns: a ``munch.Munch`` containing the domain description, or None
if not found. Each ``munch.Munch`` contains the following
@ -876,9 +876,9 @@ class IdentityCloudMixin:
:returns: a list of ``munch.Munch`` containing the role description.
Each ``munch.Munch`` contains the following attributes::
- id: <role id>
- name: <role name>
- description: <role description>
- id: <role id>
- name: <role name>
- description: <role description>
:raises: ``OpenStackCloudException``: if something goes wrong during
the OpenStack API call.
@ -897,9 +897,9 @@ class IdentityCloudMixin:
:returns: a single ``munch.Munch`` containing the role description.
Each ``munch.Munch`` contains the following attributes::
- id: <role id>
- name: <role name>
- description: <role description>
- id: <role id>
- name: <role name>
- description: <role description>
:raises: ``OpenStackCloudException``: if something goes wrong during
the OpenStack API call.
@ -952,16 +952,16 @@ class IdentityCloudMixin:
* 'effective' (boolean) - Return effective role assignments.
* 'include_subtree' (boolean) - Include subtree
'user' and 'group' are mutually exclusive, as are 'domain' and
'project'.
'user' and 'group' are mutually exclusive, as are 'domain' and
'project'.
:returns: a list of
:class:`openstack.identity.v3.role_assignment.RoleAssignment`
objects. Contains the following attributes::
- id: <role id>
- user|group: <user or group id>
- project|domain: <project or domain id>
- id: <role id>
- user|group: <user or group id>
- project|domain: <project or domain id>
:raises: ``OpenStackCloudException``: if something goes wrong during
the OpenStack API call.
@ -1111,13 +1111,13 @@ class IdentityCloudMixin:
:param bool wait: Wait for role to be granted
:param int timeout: 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: 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: for wait and timeout, sometimes granting roles is not
instantaneous.
NOTE: precedence is given first to project, then domain, then system
@ -1207,10 +1207,10 @@ class IdentityCloudMixin:
:param bool wait: Wait for role to be revoked
:param int timeout: Timeout to wait for role to be revoked
NOTE: for wait and timeout, sometimes revoking roles is not
instantaneous.
NOTE: for wait and timeout, sometimes revoking roles is not
instantaneous.
NOTE: project is required for keystone v2
NOTE: project is required for keystone v2
NOTE: precedence is given first to project, then domain, then system

View File

@ -44,7 +44,7 @@ class NetworkCloudMixin:
:param name_or_id: Name or ID of the desired network.
:param filters: a dict containing additional filters to use. e.g.
{'router:external': True}
{'router:external': True}
:returns: a list of ``munch.Munch`` containing the network description.
@ -63,7 +63,7 @@ class NetworkCloudMixin:
:param name_or_id: Name or ID of the desired router.
:param filters: a dict containing additional filters to use. e.g.
{'admin_state_up': True}
{'admin_state_up': True}
:returns: a list of ``munch.Munch`` containing the router description.
@ -82,7 +82,7 @@ class NetworkCloudMixin:
:param name_or_id: Name or ID of the desired subnet.
:param filters: a dict containing additional filters to use. e.g.
{'enable_dhcp': True}
{'enable_dhcp': True}
:returns: a list of ``munch.Munch`` containing the subnet description.
@ -101,7 +101,7 @@ class NetworkCloudMixin:
:param name_or_id: Name or ID of the desired port.
:param filters: a dict containing additional filters to use. e.g.
{'device_id': '2711c67a-b4a7-43dd-ace7-6187b791c3f0'}
{'device_id': '2711c67a-b4a7-43dd-ace7-6187b791c3f0'}
:returns: a list of ``munch.Munch`` containing the port description.
@ -217,10 +217,10 @@ class NetworkCloudMixin:
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -228,7 +228,7 @@ class NetworkCloudMixin:
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A policy ``munch.Munch`` or None if no matching network is
found.
found.
"""
if not self._has_neutron_extension('qos'):
@ -247,7 +247,7 @@ class NetworkCloudMixin:
:param name_or_id: Name or ID of the desired policy.
:param filters: a dict containing additional filters to use. e.g.
{'shared': True}
{'shared': True}
:returns: a list of ``munch.Munch`` containing the network description.
@ -325,10 +325,10 @@ class NetworkCloudMixin:
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -336,7 +336,7 @@ class NetworkCloudMixin:
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A network ``munch.Munch`` or None if no matching network is
found.
found.
"""
if not filters:
@ -363,10 +363,10 @@ class NetworkCloudMixin:
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -374,7 +374,7 @@ class NetworkCloudMixin:
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A router ``munch.Munch`` or None if no matching router is
found.
found.
"""
if not filters:
@ -393,14 +393,14 @@ class NetworkCloudMixin:
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
:returns: A subnet ``munch.Munch`` or None if no matching subnet is
found.
found.
"""
if not filters:
@ -427,10 +427,10 @@ class NetworkCloudMixin:
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -468,7 +468,8 @@ class NetworkCloudMixin:
:param bool external: Whether this network is externally accessible.
:param dict provider: A dict of network provider options. Example::
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
:param string project_id: Specify the project ID this network
will be created on (admin-only).
:param types.ListType availability_zone_hints: A list of availability
@ -558,7 +559,8 @@ class NetworkCloudMixin:
:param bool external: Whether this network is externally accessible.
:param dict provider: A dict of network provider options. Example::
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
{ 'network_type': 'vlan', 'segmentation_id': 'vlan1' }
:param int mtu_size: New maximum transmission unit value to address
fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.
:param bool port_security_enabled: Enable or disable port security.
@ -648,7 +650,7 @@ class NetworkCloudMixin:
:param name_or_id: project name or id
:param details: if set to True it will return details about usage
of quotas by given project
of quotas by given project
:raises: OpenStackCloudException if it's not a valid project
:returns: Munch object with the quotas
@ -670,7 +672,7 @@ class NetworkCloudMixin:
:param name_or_id: project name or id
:raises: OpenStackCloudException if it's not a valid project or the
network client call failed
network client call failed
:returns: dict with the quotas
"""
@ -696,20 +698,17 @@ class NetworkCloudMixin:
:param destination_ip_address: IPv4-, IPv6 address or CIDR.
:param destination_port: Port or port range (e.g. 80:90)
:param bool enabled: Status of firewall rule. You can disable rules
without disassociating them from firewall
policies. Defaults to True.
:param int ip_version: IP Version.
Valid values: 4, 6
Defaults to 4.
without disassociating them from firewall policies. Defaults to
True.
:param int ip_version: IP Version. Valid values: 4, 6 Defaults to 4.
:param name: Human-readable name.
:param project_id: Project id.
:param protocol: IP protocol.
Valid values: icmp, tcp, udp, null
:param bool shared: Visibility to other projects.
Defaults to False.
:param protocol: IP protocol. Valid values: icmp, tcp, udp, null
:param bool shared: Visibility to other projects. Defaults to False.
:param source_firewall_group_id: ID of source firewall group.
:param source_ip_address: IPv4-, IPv6 address or CIDR.
:param source_port: Port or port range (e.g. 80:90)
:raises: BadRequestException if parameters are malformed
:return: created firewall rule
:rtype: FirewallRule
@ -823,15 +822,14 @@ class NetworkCloudMixin:
Create firewall policy.
:param bool audited: 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.
Set to False each time the firewall policy or the associated
firewall rules are changed. Has to be explicitly set to True.
:param description: Human-readable description.
:param list[str] firewall_rules: List of associated firewall rules.
:param name: Human-readable name.
:param project_id: Project id.
:param bool shared: Visibility to other projects.
Defaults to False.
Defaults to False.
:raises: BadRequestException if parameters are malformed
:raises: ResourceNotFound if a resource from firewall_list not found
:return: created firewall policy
@ -940,7 +938,7 @@ class NetworkCloudMixin:
:param dict filters: optional filters
:raises: DuplicateResource on multiple matches
:raises: ResourceNotFound if firewall policy or any of the firewall
rules (inserted, after, before) is not found.
rules (inserted, after, before) is not found.
:return: updated firewall policy
:rtype: FirewallPolicy
"""
@ -1023,20 +1021,18 @@ class NetworkCloudMixin:
request.
:param bool admin_state_up: State of firewall group.
Will block all traffic if set to False.
Defaults to True.
Will block all traffic if set to False. Defaults to True.
:param description: Human-readable description.
:param egress_firewall_policy: Name or id of egress firewall policy.
:param ingress_firewall_policy: Name or id of ingress firewall policy.
:param name: Human-readable name.
:param list[str] ports: List of associated ports (name or id)
:param project_id: Project id.
:param shared: Visibility to other projects.
Defaults to False.
:param shared: Visibility to other projects. Defaults to False.
:raises: BadRequestException if parameters are malformed
:raises: DuplicateResource on multiple matches
:raises: ResourceNotFound if (ingress-, egress-) firewall policy or
a port is not found.
a port is not found.
:return: created firewall group
:rtype: FirewallGroup
"""
@ -1116,7 +1112,7 @@ class NetworkCloudMixin:
:raises: BadRequestException if parameters are malformed
:raises: DuplicateResource on multiple matches
:raises: ResourceNotFound if firewall group, a firewall policy
(egress, ingress) or port is not found
(egress, ingress) or port is not found
:return: updated firewall group
:rtype: FirewallGroup
"""
@ -1187,16 +1183,12 @@ class NetworkCloudMixin:
def update_qos_policy(self, name_or_id, **kwargs):
"""Update an existing QoS policy.
:param string name_or_id:
Name or ID of the QoS policy to update.
:param string policy_name:
The new name of the QoS policy.
:param string description:
The new description of the QoS policy.
:param bool shared:
If True, the QoS policy will be set as shared.
:param bool default:
If True, the QoS policy will be set as default for project.
:param string name_or_id: Name or ID of the QoS policy to update.
:param string policy_name: The new name of the QoS policy.
:param string description: The new description of the QoS policy.
:param bool shared: If True, the QoS policy will be set as shared.
:param bool default: If True, the QoS policy will be set as default for
project.
:returns: The updated QoS policy object.
:raises: OpenStackCloudException on operation error.
@ -1254,7 +1246,7 @@ class NetworkCloudMixin:
rules should be associated.
:param string rule_id: ID of searched rule.
:param filters: a dict containing additional filters to use. e.g.
{'max_kbps': 1000}
{'max_kbps': 1000}
:returns: a list of ``munch.Munch`` containing the bandwidth limit
rule descriptions.
@ -1444,7 +1436,7 @@ class NetworkCloudMixin:
rules should be associated.
:param string rule_id: ID of searched rule.
:param filters: a dict containing additional filters to use. e.g.
{'dscp_mark': 32}
{'dscp_mark': 32}
:returns: a list of ``munch.Munch`` containing the dscp marking
rule descriptions.
@ -1606,7 +1598,7 @@ class NetworkCloudMixin:
rules should be associated.
:param string rule_id: ID of searched rule.
:param filters: a dict containing additional filters to use. e.g.
{'min_kbps': 1000}
{'min_kbps': 1000}
:returns: a list of ``munch.Munch`` containing the bandwidth limit
rule descriptions.
@ -1783,8 +1775,8 @@ class NetworkCloudMixin:
:param string port_id: The ID of the port to use for the interface
:returns: A ``munch.Munch`` with the router ID (ID),
subnet ID (subnet_id), port ID (port_id) and tenant ID
(tenant_id).
subnet ID (subnet_id), port ID (port_id) and tenant ID
(tenant_id).
:raises: OpenStackCloudException on operation error.
"""
@ -1868,11 +1860,12 @@ class NetworkCloudMixin:
external network. Example::
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
]
:param string project_id: Project ID for the router.
:param types.ListType availability_zone_hints:
A list of availability zone hints.
@ -1920,11 +1913,12 @@ class NetworkCloudMixin:
external network. Example::
[
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
{
"subnet_id": "8ca37218-28ff-41cb-9b10-039601ea7e6b",
"ip_address": "192.168.10.2"
}
]
:param list routes:
A list of dictionaries with destination and nexthop parameters. To
clear all routes pass an empty list ([]).
@ -1932,11 +1926,12 @@ class NetworkCloudMixin:
Example::
[
{
"destination": "179.24.1.0/24",
"nexthop": "172.24.3.99"
}
{
"destination": "179.24.1.0/24",
"nexthop": "172.24.3.99"
}
]
:returns: The router object.
:raises: OpenStackCloudException on operation error.
"""
@ -2000,71 +1995,60 @@ class NetworkCloudMixin:
prefixlen=None, use_default_subnetpool=False, **kwargs):
"""Create a subnet on a specified network.
:param string network_name_or_id:
The unique name or ID of the attached network. If a non-unique
name is supplied, an exception is raised.
:param string cidr:
The CIDR.
:param int ip_version:
The IP version, which is 4 or 6.
:param bool enable_dhcp:
Set to ``True`` if DHCP is enabled and ``False`` if disabled.
Default is ``False``.
:param string subnet_name:
The name of the subnet.
:param string tenant_id:
The ID of the tenant who owns the network. Only administrative users
can specify a tenant ID other than their own.
:param allocation_pools:
A list of dictionaries of the start and end addresses for the
allocation pools. For example::
:param string network_name_or_id: The unique name or ID of the attached
network. If a non-unique name is supplied, an exception is raised.
:param string cidr: The CIDR.
:param int ip_version: The IP version, which is 4 or 6.
:param bool enable_dhcp: Set to ``True`` if DHCP is enabled and
``False`` if disabled. Default is ``False``.
:param string subnet_name: The name of the subnet.
:param string tenant_id: The ID of the tenant who owns the network.
Only administrative users can specify a tenant ID other than their
own.
:param 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"
}
]
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
:param string gateway_ip:
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.
:param bool disable_gateway_ip:
Set to ``True`` if gateway IP address is disabled and ``False`` if
enabled. It is not allowed with gateway_ip.
Default is ``False``.
:param dns_nameservers:
A list of DNS name servers for the subnet. For example::
:param string gateway_ip: 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.
:param bool disable_gateway_ip: Set to ``True`` if gateway IP address
is disabled and ``False`` if enabled. It is not allowed with
gateway_ip. Default is ``False``.
:param dns_nameservers: A list of DNS name servers for the subnet. For
example::
[ "8.8.8.7", "8.8.8.8" ]
[ "8.8.8.7", "8.8.8.8" ]
:param host_routes:
A list of host route dictionaries for the subnet. For example::
:param 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"
}
]
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
:param string ipv6_ra_mode:
IPv6 Router Advertisement mode. Valid values are: 'dhcpv6-stateful',
'dhcpv6-stateless', or 'slaac'.
:param string ipv6_address_mode:
IPv6 address mode. Valid values are: 'dhcpv6-stateful',
'dhcpv6-stateless', or 'slaac'.
:param string prefixlen:
The prefix length to use for subnet allocation from a subnet pool.
:param bool use_default_subnetpool:
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.
:param string ipv6_ra_mode: IPv6 Router Advertisement mode. Valid
values are: 'dhcpv6-stateful', 'dhcpv6-stateless', or 'slaac'.
:param string ipv6_address_mode: IPv6 address mode. Valid values are:
'dhcpv6-stateful', 'dhcpv6-stateless', or 'slaac'.
:param string prefixlen: The prefix length to use for subnet allocation
from a subnet pool.
:param bool use_default_subnetpool: 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.
:param kwargs: Key value pairs to be passed to the Neutron API.
:returns: The new subnet object.
@ -2166,49 +2150,44 @@ class NetworkCloudMixin:
host_routes=None):
"""Update an existing subnet.
:param string name_or_id:
Name or ID of the subnet to update.
:param string subnet_name:
The new name of the subnet.
:param bool enable_dhcp:
Set to ``True`` if DHCP is enabled and ``False`` if disabled.
:param string gateway_ip:
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.
:param bool disable_gateway_ip:
Set to ``True`` if gateway IP address is disabled and ``False`` if
enabled. It is not allowed with gateway_ip.
Default is ``False``.
:param allocation_pools:
A list of dictionaries of the start and end addresses for the
allocation pools. For example::
:param string name_or_id: Name or ID of the subnet to update.
:param string subnet_name: The new name of the subnet.
:param bool enable_dhcp: Set to ``True`` if DHCP is enabled and
``False`` if disabled.
:param string gateway_ip: 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.
:param bool disable_gateway_ip: Set to ``True`` if gateway IP address
is disabled and ``False`` if enabled. It is not allowed with
gateway_ip. Default is ``False``.
:param 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"
}
]
[
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
]
:param dns_nameservers:
A list of DNS name servers for the subnet. For example::
:param dns_nameservers: A list of DNS name servers for the subnet. For
example::
[ "8.8.8.7", "8.8.8.8" ]
[ "8.8.8.7", "8.8.8.8" ]
:param host_routes:
A list of host route dictionaries for the subnet. For example::
:param 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"
}
]
[
{
"destination": "0.0.0.0/0",
"nexthop": "123.456.78.9"
},
{
"destination": "192.168.0.0/24",
"nexthop": "192.168.0.1"
}
]
:returns: The updated subnet object.
:raises: OpenStackCloudException on operation error.
@ -2259,15 +2238,15 @@ class NetworkCloudMixin:
which is up (true, default) or down (false). (Optional)
:param mac_address: The MAC address. (Optional)
:param fixed_ips: List of ip_addresses and subnet_ids. See subnet_id
and ip_address. (Optional)
For example::
and ip_address. (Optional) For example::
[
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
]
:param 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
@ -2280,20 +2259,22 @@ class NetworkCloudMixin:
For example::
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
:param extra_dhcp_opts: Extra DHCP options. (Optional).
For example::
[
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
:param device_owner: The ID of the entity that uses this port.
For example, a DHCP agent. (Optional)
:param device_id: The ID of the device that uses this port.
@ -2335,30 +2316,33 @@ class NetworkCloudMixin:
For example::
[
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
{
"ip_address": "10.29.29.13",
"subnet_id": "a78484c4-c380-4b47-85aa-21c51a2d8cbd"
}, ...
]
:param security_groups: List of security group UUIDs. (Optional)
:param allowed_address_pairs: Allowed address pairs list (Optional)
For example::
[
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
{
"ip_address": "23.23.23.1",
"mac_address": "fa:16:3e:c4:cd:3f"
}, ...
]
:param extra_dhcp_opts: Extra DHCP options. (Optional).
For example::
[
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
{
"opt_name": "opt name1",
"opt_value": "value1"
}, ...
]
:param device_owner: The ID of the entity that uses this port.
For example, a DHCP agent. (Optional)
:param device_id: The ID of the resource this port is attached to.

View File

@ -593,16 +593,16 @@ class Normalizer:
:returns:
A list of normalized dicts with the following attributes::
[
{
"id": "this-is-a-floating-ip-id",
"fixed_ip_address": "192.0.2.10",
"floating_ip_address": "198.51.100.10",
"network": "this-is-a-net-or-pool-id",
"attached": True,
"status": "ACTIVE"
}, ...
]
[
{
"id": "this-is-a-floating-ip-id",
"fixed_ip_address": "192.0.2.10",
"floating_ip_address": "198.51.100.10",
"network": "this-is-a-net-or-pool-id",
"attached": True,
"status": "ACTIVE"
}, ...
]
"""
return [

View File

@ -76,10 +76,10 @@ class SecurityGroupCloudMixin(_normalize.Normalizer):
of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
@ -87,7 +87,7 @@ class SecurityGroupCloudMixin(_normalize.Normalizer):
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
:returns: A security group ``munch.Munch`` or None if no matching
security group is found.
security group is found.
"""
return _utils._get_entity(
@ -130,7 +130,7 @@ class SecurityGroupCloudMixin(_normalize.Normalizer):
:raises: OpenStackCloudException on operation error.
:raises: OpenStackCloudUnavailableFeature if security groups are
not supported on this cloud.
not supported on this cloud.
"""
# Security groups not supported
@ -166,7 +166,7 @@ class SecurityGroupCloudMixin(_normalize.Normalizer):
:raises: OpenStackCloudException on operation error.
:raises: OpenStackCloudUnavailableFeature if security groups are
not supported on this cloud.
not supported on this cloud.
"""
# Security groups not supported
if not self._has_secgroups():
@ -384,7 +384,7 @@ class SecurityGroupCloudMixin(_normalize.Normalizer):
:raises: OpenStackCloudException on operation error.
:raises: OpenStackCloudUnavailableFeature if security groups are
not supported on this cloud.
not supported on this cloud.
"""
# Security groups not supported
if not self._has_secgroups():

View File

@ -37,8 +37,7 @@ _decorated_methods = []
def _make_unicode(input):
"""Turn an input into unicode unconditionally
:param input:
A unicode, string or other object
:param input: A unicode, string or other object
"""
try:
if isinstance(input, unicode):
@ -66,24 +65,23 @@ def _dictify_resource(resource):
def _filter_list(data, name_or_id, filters):
"""Filter a list by name/ID and arbitrary meta data.
:param list data:
The list of dictionary data to filter. It is expected that
each dictionary contains an 'id' and 'name'
key if a value for name_or_id is given.
:param string name_or_id:
The name or ID of the entity being filtered. Can be a glob pattern,
such as 'nb01*'.
:param filters:
A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example::
:param list data: The list of dictionary data to filter. It is expected
that each dictionary contains an 'id' and 'name' key if a value for
name_or_id is given.
:param string name_or_id: The name or ID of the entity being filtered. Can
be a glob pattern, such as 'nb01*'.
:param filters: A dictionary of meta data to use for further filtering.
Elements of this dictionary may, themselves, be dictionaries. Example::
{
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
'last_name': 'Smith',
'other': {
'gender': 'Female'
}
}
OR
A string containing a jmespath expression for further filtering.
"""
# The logger is openstack.cloud.fmmatch to allow a user/operator to
@ -158,20 +156,16 @@ def _filter_list(data, name_or_id, filters):
def _get_entity(cloud, resource, name_or_id, filters, **kwargs):
"""Return a single entity from the list returned by a given method.
:param object cloud:
The controller class (Example: the main OpenStackCloud object) .
:param string or callable resource:
The string that identifies the resource to use to lookup the
get_<>_by_id or search_<resource>s methods(Example: network)
or a callable to invoke.
:param string name_or_id:
The name or ID of the entity being filtered or an object or dict.
If this is an object/dict with an 'id' attr/key, we return it and
bypass resource lookup.
:param filters:
A dictionary of meta data to use for further filtering.
OR
A string containing a jmespath expression for further filtering.
:param object cloud: The controller class (Example: the main OpenStackCloud
object).
:param string or callable resource: The string that identifies the resource
to use to lookup the get_<>_by_id or search_<resource>s methods
(Example: network) or a callable to invoke.
:param string name_or_id: The name or ID of the entity being filtered or an
object or dict. If this is an object/dict with an 'id' attr/key, we
return it and bypass resource lookup.
:param filters: A dictionary of meta data to use for further filtering.
OR A string containing a jmespath expression for further filtering.
Example:: "[?last_name==`Smith`] | [?other.gender]==`Female`]"
"""
@ -414,13 +408,13 @@ def shade_exceptions(error_message=None):
:param string error_message: String to use for the exception message
content on non-OpenStackCloudExceptions.
Useful for avoiding wrapping shade OpenStackCloudException exceptions
within themselves. Code called from within the context may throw such
exceptions without having to catch and reraise them.
Useful for avoiding wrapping shade OpenStackCloudException exceptions
within themselves. Code called from within the context may throw such
exceptions without having to catch and reraise them.
Non-OpenStackCloudException exceptions thrown within the context will
be wrapped and the exception message will be appended to the given error
message.
Non-OpenStackCloudException exceptions thrown within the context will
be wrapped and the exception message will be appended to the given
error message.
"""
try:
yield
@ -506,16 +500,15 @@ def _call_client_and_retry(client, url, retry_on=None,
the ability to retry upon known error codes.
:param object client: The client method, such as:
``self.baremetal_client.post``
``self.baremetal_client.post``
:param string url: The URL to perform the operation upon.
:param integer retry_on: A list of error codes that can be retried on.
The method also supports a single integer to be
defined.
The method also supports a single integer to be
defined.
:param integer call_retries: The number of times to retry the call upon
the error code defined by the 'retry_on'
parameter. Default: 3
the error code defined by the 'retry_on' parameter. Default: 3
:param integer retry_wait: The time in seconds to wait between retry
attempts. Default: 2
attempts. Default: 2
:returns: The object returned by the client call.
"""