heat.engine.clients.os.nova module

class heat.engine.clients.os.nova.FlavorConstraint[source]

Bases: NovaBaseConstraint

expected_exceptions = (<class 'novaclient.exceptions.NotFound'>,)
resource_getter_name = 'find_flavor_by_name_or_id'
class heat.engine.clients.os.nova.HostConstraint[source]

Bases: NovaBaseConstraint

expected_exceptions = (<class 'novaclient.exceptions.NotFound'>,)
resource_getter_name = 'get_host'
class heat.engine.clients.os.nova.KeypairConstraint[source]

Bases: NovaBaseConstraint

resource_getter_name = 'get_keypair'
validate_with_client(client, key_name)[source]
class heat.engine.clients.os.nova.NovaBaseConstraint[source]

Bases: BaseCustomConstraint

resource_client_name = 'nova'
class heat.engine.clients.os.nova.NovaClientPlugin(context)[source]

Bases: MicroversionMixin, ClientPlugin

COMPUTE = 'compute'
NOVA_API_VERSION = '2.1'
absolute_limits()[source]

Return the absolute limits as a dictionary.

associate_floatingip(server_id, floatingip_id)[source]
associate_floatingip_address(server_id, fip_address)[source]
attach_volume(server_id, volume_id, device)[source]
static build_ignition_data(metadata, userdata)[source]
build_userdata(metadata, userdata=None, instance_user=None, user_data_format='HEAT_CFNTOOLS')[source]

Build multipart data blob for CloudInit and Ignition.

Data blob includes user-supplied Metadata, user data, and the required Heat in-instance configuration.

Parameters:
  • resource (heat.engine.Resource) – the resource implementation

  • userdata (str or None) – user data string

  • instance_user (string) – the user to create on the server

  • user_data_format (string) – Format of user data to return

Returns:

multipart mime as a string

check_delete_server_complete(server_id)[source]

Wait for server to disappear from Nova.

check_detach_volume_complete(server_id, attach_id)[source]

Check that nova server lost attachment.

This check is needed for immediate reattachment when updating: there might be some time between cinder marking volume as ‘available’ and nova removing attachment from its own objects, so we check that nova already knows that the volume is detached.

check_interface_attach(server_id, port_id)[source]
check_interface_detach(server_id, port_id)[source]
check_rebuild(server_id)[source]

Verify that a rebuilding server is rebuilt.

Raise error if it ends up in an ERROR state.

check_resize(server_id, flavor)[source]

Verify that a resizing server is properly resized.

If that’s the case, confirm the resize, if not raise an error.

check_verify_resize(server_id)[source]
deferred_server_statuses = {'BUILD', 'HARD_REBOOT', 'PASSWORD', 'REBOOT', 'RESCUE', 'RESIZE', 'REVERT_RESIZE', 'SHUTOFF', 'SUSPENDED', 'VERIFY_RESIZE'}
detach_volume(server_id, attach_id)[source]
dissociate_floatingip(floatingip_id)[source]
dissociate_floatingip_address(fip_address)[source]
exceptions_module = <module 'novaclient.exceptions' from '/home/zuul/src/opendev.org/openstack/heat/.tox/docs/lib/python3.10/site-packages/novaclient/exceptions.py'>
fetch_server(server_id)[source]

Fetch fresh server object from Nova.

Log warnings and return None for non-critical API errors. Use this method in various check_*_complete resource methods, where intermittent errors can be tolerated.

fetch_server_attr(server_id, attr)[source]
find_flavor_by_name_or_id(flavor)[source]

Find the specified flavor by name or id.

Parameters:

flavor – the name of the flavor to find

Returns:

the id of :flavor:

get_console_urls(server)[source]

Return dict-like structure of server’s console urls.

The actual console url is lazily resolved on access.

get_flavor(flavor_identifier)[source]

Get the flavor object for the specified flavor name or id.

Parameters:

flavor_identifier – the name or id of the flavor to find

Returns:

a flavor object with name or id :flavor:

get_host(hypervisor_hostname)[source]

Gets list of matching hypervisors by specified name.

Parameters:

hypervisor_hostname – the name of host to find

Returns:

list of matching hypervisor hosts

Raises:

nova client exceptions.NotFound

get_ip(server, net_type, ip_version)[source]

Return the server’s IP of the given type and version.

get_keypair(key_name)[source]

Get the public key specified by :key_name:

Parameters:

key_name – the name of the key to look for

Returns:

the keypair (name, public_key) for :key_name:

Raises:

exception.EntityNotFound

get_max_microversion()[source]
get_server(server)[source]

Return fresh server object.

Substitutes Nova’s NotFound for Heat’s EntityNotFound, to be returned to user as HTTP error.

get_status(server)[source]

Return the server’s status.

Parameters:

server – server object

Returns:

status as a string

interface_attach(server_id, port_id=None, net_id=None, fip=None, security_groups=None)[source]
interface_detach(server_id, port_id)[source]
is_bad_request(ex)[source]
is_conflict(ex)[source]

Returns True if the exception is a conflict.

static is_ignition_format(userdata)[source]
is_not_found(ex)[source]

Returns True if the exception is a not-found.

is_over_limit(ex)[source]

Returns True if the exception is an over-limit.

is_unprocessable_entity(ex)[source]
is_version_supported(version)[source]
max_microversion = None
meta_serialize(metadata)[source]

Serialize non-string metadata values before sending them to Nova.

meta_update(server, metadata)[source]

Delete/Add the metadata in nova as needed.

rebuild(server_id, image_id, password=None, preserve_ephemeral=False, meta=None, files=None)[source]

Rebuild the server and call check_rebuild to verify.

refresh_server(server)[source]

Refresh server’s attributes.

Also log warnings for non-critical API errors.

rename(server, name)[source]

Update the name for a server.

resize(server_id, flavor_id)[source]

Resize the server.

server_to_ipaddress(server)[source]

Return the server’s IP address, fetching it from Nova.

service_types = ['compute']
verify_resize(server_id)[source]
class heat.engine.clients.os.nova.ServerConstraint[source]

Bases: NovaBaseConstraint

resource_getter_name = 'get_server'