The heat.engine.service Module

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

Bases: oslo_service.service.Service

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]

Confirm the engine performing the action is still alive.

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

reset(*args, **kwargs)

Reset a service in case it received a SIGHUP.

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

Stop a service.

Parameters:graceful – indicates whether to wait for all threads to finish or terminate them instantly
stop_stack(*args, **kwargs)[source]

Stop any active threads on a stack.

wait(*args, **kwargs)

Wait for a service to shut down.

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

Bases: oslo_service.service.Service

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.18'
abandon_stack(*args, **kwargs)[source]

The abandon_stack method abandons a given stack.

Parameters:
  • cnxt – RPC context.
  • stack_identity – Name of the stack you want to abandon.
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.

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 – 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, combine multiple tags using the boolean AND expression
  • tags_any – count stacks containing these tags, combine multiple tags using the boolean OR expression
  • not_tags – count stacks not containing these tags, combine multiple tags using the boolean AND expression
  • not_tags_any – count stacks not containing these tags, combine multiple tags using the boolean OR expression
Returns:

a 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]

Creates 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
  • 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
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]

The delete_stack method deletes 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]
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_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’).
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
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 – 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, combine multiple tags using the boolean AND expression
  • tags_any – show stacks containing these tags, combine multiple tags using the boolean OR expression
  • not_tags – show stacks not containing these tags, combine multiple tags using the boolean AND expression
  • not_tags_any – show stacks not containing these tags, combine multiple tags 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]
preview_stack(*args, **kwargs)[source]

Simulates 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
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_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.
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_stack_and_resource_to_failed(*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_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
show_watch(*args, **kwargs)[source]

The show_watch method returns 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]

The show_watch method returns 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]

Updates 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
validate_template(*args, **kwargs)[source]

The validate_template method uses the stack parser to check the validity of a template.

Parameters:
  • cnxt – RPC context.
  • template – Template of stack you want to create.
  • params – Stack Input Params
  • files – Files referenced from the template
  • show_nested – if True, any nested templates will be checked
wait(*args, **kwargs)

Wait for a service to shut down.

class heat.engine.service.ThreadGroupManager[source]

Bases: object

add_event(stack_id, event)[source]
add_timer(stack_id, func, *args, **kwargs)[source]

Define a periodic task in the stack threadgroups.

Defining is to be run in a separate thread.

Periodicity is cfg.CONF.periodic_interval

remove_event(gt, stack_id, event)[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.

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 if acquire a stack lock is successful.

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]

Previous topic

The heat.engine.scheduler Module

Next topic

The heat.engine.service_software_config Module

Project Source

This Page