The watcher.applier.actions.change_nova_service_state Module

The watcher.applier.actions.change_nova_service_state Module

class watcher.applier.actions.change_nova_service_state.ChangeNovaServiceState(config, osc=None)[source]

Bases: watcher.applier.actions.base.BaseAction

Disables or enables the nova-compute service, deployed on a host

By using this action, you will be able to update the state of a nova-compute service. A disabled nova-compute service can not be selected by the nova scheduler for future deployment of server.

The action schema is:

schema = Schema({
 'resource_id': str,
 'state': str,
 'disabled_reason': str,
})

The resource_id references a nova-compute service name (list of available nova-compute services is returned by this command: nova service-list --binary nova-compute). The state value should either be ONLINE or OFFLINE. The disabled_reason references the reason why Watcher disables this nova-compute service. The value should be with watcher_ prefix, such as watcher_disabled, watcher_maintaining.

execute()[source]

Executes the main logic of the action

This method can be used to perform an action on a given set of input parameters to accomplish some type of operation. This operation may return a boolean value as a result of its execution. If False, this will be considered as an error and will then trigger the reverting of the actions.

Returns:A flag indicating whether or not the action succeeded
Return type:bool
get_description()[source]

Description of the action

post_condition()[source]

Hook: called after the execution of an action

This function is called regardless of whether an action succeeded or not. So you can use it to perform cleanup operations.

pre_condition()[source]

Hook: called before the execution of an action

This method can be used to perform some initializations or to make some more advanced validation on its input parameters. So if you wish to block its execution based on this factor, raise the related exception.

revert()[source]

Revert this action

This method should rollback the resource to its initial state in the event of a faulty execution. This happens when the action raised an exception during its execute().

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.