The heat.engine.service Module

The heat.engine.service Module

class heat.engine.service.EngineListener(host, engine_id, thread_group_mgr)[source]

Bases: object

Listen on an AMQP queue named for the engine.

Allows individual engines to communicate with each other for multi-engine support.

ACTIONS = ('stop_stack', 'send')
SEND = 'send'
STOP_STACK = 'stop_stack'
listening(*args, **kwargs)[source]

Respond to a watchdog request.

Respond affirmatively to confirm that the engine performing the action is still alive.

send(*args, **kwargs)[source]
start(*args, **kwargs)[source]
stop(*args, **kwargs)[source]
stop_stack(*args, **kwargs)[source]

Stop any active threads on a stack.

class heat.engine.service.EngineService(host, topic)[source]

Bases: oslo_service.service.ServiceBase

Manages the running instances from creation to destruction.

All the methods in here are called from the RPC backend. This is all done dynamically so if a call is made via RPC that does not have a corresponding method here, an exception will be thrown when it attempts to call into this class. Arguments to these methods are also dynamically added and will be named as keyword arguments by the RPC caller.

RPC_API_VERSION = '1.35'
abandon_stack(*args, **kwargs)[source]

Abandon a given stack.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to abandon.
  • abandon – Delete Heat stack but not physical resources.
authenticated_to_backend(*args, **kwargs)[source]

Validate the credentials in the RPC context.

Verify that the credentials in the RPC context are valid for the current cloud backend.

check_software_deployment(*args, **kwargs)[source]
count_stacks(*args, **kwargs)[source]

Return the number of stacks that match the given filters.

Parameters:
  • cnxt – RPC context.
  • filters – a dict of ATTR:VALUE to match against stacks
  • tenant_safe – DEPRECATED, if true, scope the request by the current tenant
  • show_deleted – if true, count will include the deleted stacks
  • show_nested – if true, count will include nested stacks
  • show_hidden – if true, count will include hidden stacks
  • tags – count stacks containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • tags_any – count stacks containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
  • not_tags – count stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • not_tags_any – count stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
Returns:

an integer representing the number of matched stacks

create_periodic_tasks(*args, **kwargs)[source]
create_software_config(*args, **kwargs)[source]
create_software_deployment(*args, **kwargs)[source]
create_stack(*args, **kwargs)[source]

Create a new stack using the template provided.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • cnxt – RPC context.
  • stack_name – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params
  • files – Files referenced from the template
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
  • owner_id – parent stack ID for nested stacks, only expected when called from another heat-engine (not a user option)
  • nested_depth – the nested depth for nested stacks, only expected when called from another heat-engine
  • user_creds_id – the parent user_creds record for nested stacks
  • stack_user_project_id – the parent stack_user_project_id for nested stacks
  • parent_resource_name – the parent resource name
  • template_id – the ID of a pre-stored template in the DB
create_watch_data(*args, **kwargs)[source]

Creates data for CloudWatch and WaitConditions.

This could be used by CloudWatch and WaitConditions and treat HA service events like any other CloudWatch.

delete_snapshot(*args, **kwargs)[source]
delete_software_config(*args, **kwargs)[source]
delete_software_deployment(*args, **kwargs)[source]
delete_stack(*args, **kwargs)[source]

Delete a given stack.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to delete.
describe_stack_resource(*args, **kwargs)[source]
describe_stack_resources(*args, **kwargs)[source]
export_stack(*args, **kwargs)[source]

Exports the stack data json.

Intended to be used to safely retrieve the stack data before performing the abandon action.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to export.
find_physical_resource(*args, **kwargs)[source]

Return an identifier for the specified resource.

Parameters:
  • cnxt – RPC context.
  • physical_resource_id – The physical resource ID to look up.
generate_template(*args, **kwargs)[source]

Generate a template based on the specified type.

Parameters:
  • cnxt – RPC context.
  • type_name – Name of the resource type to generate a template for.
  • template_type – the template type to generate, cfn or hot.
get_environment(*args, **kwargs)[source]

Returns the environment for an existing stack.

Parameters:
  • cnxt – RPC context
  • stack_identity – identifies the stack
Return type:

dict

get_files(*args, **kwargs)[source]

Returns the files for an existing stack.

Parameters:
  • cnxt – RPC context
  • stack_identity – identifies the stack
Return type:

dict

get_revision(*args, **kwargs)[source]
get_template(*args, **kwargs)[source]

Get the template.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to see.
identify_stack(*args, **kwargs)[source]

The full stack identifier for a single, live stack with stack_name.

Parameters:
  • cnxt – RPC context.
  • stack_name – Name or UUID of the stack to look up.
list_events(*args, **kwargs)[source]

Lists all events associated with a given stack.

It supports pagination (limit and marker), sorting (sort_keys and sort_dir) and filtering(filters) of the results.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to get events for
  • filters – a dict with attribute:value to filter the list
  • limit – the number of events to list (integer or string)
  • marker – the ID of the last event in the previous page
  • sort_keys – an array of fields used to sort the list
  • sort_dir – the direction of the sort (‘asc’ or ‘desc’).
  • nested_depth – Levels of nested stacks to list events for.
list_outputs(*args, **kwargs)[source]

Get a list of stack outputs.

Parameters:
  • cntx – RPC context.
  • stack_identity – Name of the stack you want to see.
Returns:

list of stack outputs in defined format.

list_resource_types(*args, **kwargs)[source]

Get a list of supported resource types.

Parameters:
  • cnxt – RPC context.
  • support_status – Support status of resource type
  • type_name – Resource type’s name (regular expression allowed)
  • heat_version – Heat version
  • with_description – Either return resource type description or not
list_services(*args, **kwargs)[source]
list_software_configs(*args, **kwargs)[source]
list_software_deployments(*args, **kwargs)[source]
list_stack_resources(*args, **kwargs)[source]
list_stacks(*args, **kwargs)[source]

Returns attributes of all stacks.

It supports pagination (limit and marker), sorting (sort_keys and sort_dir) and filtering (filters) of the results.

Parameters:
  • cnxt – RPC context
  • limit – the number of stacks to list (integer or string)
  • marker – the ID of the last item in the previous page
  • sort_keys – an array of fields used to sort the list
  • sort_dir – the direction of the sort (‘asc’ or ‘desc’)
  • filters – a dict with attribute:value to filter the list
  • tenant_safe – DEPRECATED, if true, scope the request by the current tenant
  • show_deleted – if true, show soft-deleted stacks
  • show_nested – if true, show nested stacks
  • show_hidden – if true, show hidden stacks
  • tags – show stacks containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • tags_any – show stacks containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
  • not_tags – show stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • not_tags_any – show stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
Returns:

a list of formatted stacks

list_template_functions(*args, **kwargs)[source]
list_template_versions(*args, **kwargs)[source]
metadata_software_deployments(*args, **kwargs)[source]
migrate_convergence_1(*args, **kwargs)[source]
preview_stack(*args, **kwargs)[source]

Simulate a new stack using the provided template.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • cnxt – RPC context.
  • stack_name – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params
  • files – Files referenced from the template
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
preview_update_stack(*args, **kwargs)[source]

Shows the resources that would be updated.

The preview_update_stack method shows the resources that would be changed with an update to an existing stack based on the provided template and parameters. See update_stack for description of parameters.

This method cannot guarantee that an update will have the actions specified because resource plugins can influence changes/replacements at runtime.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

reset(*args, **kwargs)[source]
reset_stack_status(*args, **kwargs)[source]
resource_mark_unhealthy(*args, **kwargs)[source]

Mark the resource as healthy or unhealthy.

Put the resource in CHECK_FAILED state if ‘mark_unhealthy’ is true. Put the resource in CHECK_COMPLETE if ‘mark_unhealthy’ is false and the resource is in CHECK_FAILED state. Otherwise, make no change.
Parameters:
  • resource_name – either the logical name of the resource or the physical resource ID.
  • mark_unhealthy – indicates whether the resource is unhealthy.
  • resource_status_reason – reason for health change.
resource_schema(*args, **kwargs)[source]

Return the schema of the specified type.

Parameters:
  • cnxt – RPC context.
  • type_name – Name of the resource type to obtain the schema of.
  • with_description – Return result with description or not.
resource_signal(*args, **kwargs)[source]

Calls resource’s signal for the specified resource.

Parameters:sync_call – indicates whether a synchronized call behavior is expected. This is reserved for CFN WaitCondition implementation.
service_manage_cleanup(*args, **kwargs)[source]
service_manage_report(*args, **kwargs)[source]
set_watch_state(*args, **kwargs)[source]

Temporarily set the state of a given watch.

Parameters:
  • cnxt – RPC context.
  • watch_name – Name of the watch.
  • state – State (must be one defined in WatchRule class.
show_output(*args, **kwargs)[source]

Returns dict with specified output key, value and description.

Parameters:
  • cntx – RPC context.
  • stack_identity – Name of the stack you want to see.
  • output_key – key of desired stack output.
Returns:

dict with output key, value and description in defined format.

show_snapshot(*args, **kwargs)[source]
show_software_config(*args, **kwargs)[source]
show_software_deployment(*args, **kwargs)[source]
show_stack(*args, **kwargs)[source]

Return detailed information about one or all stacks.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to show, or None to show all
  • resolve_outputs – If True, outputs for given stack/stacks will be resolved
show_watch(*args, **kwargs)[source]

Return the attributes of one watch/alarm.

Parameters:
  • cnxt – RPC context.
  • watch_name – Name of the watch you want to see, or None to see all.
show_watch_metric(*args, **kwargs)[source]

Return the datapoints for a metric.

Parameters:
  • cnxt – RPC context.
  • metric_namespace – Name of the namespace you want to see, or None to see all.
  • metric_name – Name of the metric you want to see, or None to see all.
signal_software_deployment(*args, **kwargs)[source]
stack_cancel_update(*args, **kwargs)[source]

Cancel currently running stack update.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack for which to cancel update.
  • cancel_with_rollback – Force rollback when cancel update.
stack_check(*args, **kwargs)[source]

Handle request to perform a check action on a stack.

stack_list_snapshots(*args, **kwargs)[source]
stack_restore(*args, **kwargs)[source]
stack_resume(*args, **kwargs)[source]

Handle request to perform a resume action on a stack.

stack_snapshot(*args, **kwargs)[source]
stack_suspend(*args, **kwargs)[source]

Handle request to perform suspend action on a stack.

start(*args, **kwargs)[source]
stop(*args, **kwargs)[source]
update_software_deployment(*args, **kwargs)[source]
update_stack(*args, **kwargs)[source]

Update an existing stack based on the provided template and params.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params
  • files – Files referenced from the template
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
  • template_id – the ID of a pre-stored template in the DB
validate_template(*args, **kwargs)[source]

Check the validity of a template.

Checks, so far as we can, that a template is valid, and returns information about the parameters suitable for producing a user interface through which to specify the parameter values.

Parameters:
  • cnxt – RPC context.
  • template – Template of stack you want to create.
  • params – Stack Input Params
  • files – Files referenced from the template
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
  • show_nested – if True, any nested templates will be checked
  • ignorable_errors – List of error_code to be ignored as part of

validation

wait(*args, **kwargs)[source]
class heat.engine.service.ThreadGroupManager[source]

Bases: object

add_msg_queue(stack_id, msg_queue)[source]
add_timer(stack_id, func, *args, **kwargs)[source]

Define a periodic task in the stack threadgroups.

The task is run in a separate greenthread.

Periodicity is cfg.CONF.periodic_interval

remove_msg_queue(gt, stack_id, msg_queue)[source]
send(stack_id, message)[source]
start(stack_id, func, *args, **kwargs)[source]

Run the given method in a sub-thread.

start_with_acquired_lock(stack, lock, func, *args, **kwargs)[source]

Run the given method in a sub-thread with an existing stack lock.

Release the provided lock when the thread finishes.

Parameters:
  • stack (heat.engine.parser.Stack) – Stack to be operated on
  • lock (heat.engine.stack_lock.StackLock) – The acquired stack lock
  • func (function or instancemethod) – Callable to be invoked in sub-thread
  • args – Args to be passed to func
  • kwargs – Keyword-args to be passed to func
start_with_lock(cnxt, stack, engine_id, func, *args, **kwargs)[source]

Run the method in sub-thread after acquiring the stack lock.

Release the lock when the thread finishes.

Parameters:
  • cnxt – RPC context
  • stack (heat.engine.parser.Stack) – Stack to be operated on
  • engine_id – The UUID of the engine/worker acquiring the lock
  • func (function or instancemethod) – Callable to be invoked in sub-thread
  • args – Args to be passed to func
  • kwargs – Keyword-args to be passed to func.
stop(stack_id, graceful=False)[source]

Stop any active threads on a stack.

stop_timers(stack_id)[source]
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.