The watcher.decision_engine.strategy.strategies.host_maintenance Module

The watcher.decision_engine.strategy.strategies.host_maintenance Module

class watcher.decision_engine.strategy.strategies.host_maintenance.HostMaintenance(config, osc=None)[source]

Bases: watcher.decision_engine.strategy.strategies.base.HostMaintenanceBaseStrategy

[PoC]Host Maintenance

Description

It is a migration strategy for one compute node maintenance, without having the user’s application been interruptted. If given one backup node, the strategy will firstly migrate all instances from the maintenance node to the backup node. If the backup node is not provided, it will migrate all instances, relying on nova-scheduler.

Requirements

  • You must have at least 2 physical compute nodes to run this strategy.

Limitations

  • This is a proof of concept that is not meant to be used in production
  • It migrates all instances from one host to other hosts. It’s better to execute such strategy when load is not heavy, and use this algorithm with ONESHOT audit.
  • It assume that cold and live migrations are possible
add_action_enable_compute_node(node)[source]

Add an action for node enabler into the solution.

add_action_maintain_compute_node(node)[source]

Add an action for node maintenance into the solution.

do_execute()[source]

Strategy execution phase

This phase is where you should put the main logic of your strategy.

enable_compute_node_if_disabled(node)[source]
get_disabled_compute_nodes()[source]
get_disabled_compute_nodes_with_reason(reason=None)[source]
classmethod get_display_name()[source]

The goal display name for the strategy

get_instance_state_str(instance)[source]

Get instance state in string format

classmethod get_name()[source]

The name of the strategy

get_node_capacity(node)[source]

Collect cpu, ram and disk capacity of a node.

Parameters:node – node object
Returns:dict(cpu(cores), ram(MB), disk(B))
get_node_free(node)[source]

Collect cpu, ram and disk free of a node.

Parameters:node – node object
Returns:dict(cpu(cores), ram(MB), disk(B))
get_node_status_str(node)[source]

Get node status in string format

get_node_used(node)[source]

Collect cpu, ram and disk used of a node.

Parameters:node – node object
Returns:dict(cpu(cores), ram(MB), disk(B))
classmethod get_schema()[source]

Defines a Schema that the input parameters shall comply to

Returns:A jsonschema format (mandatory default setting)
Return type:dict
classmethod get_translatable_display_name()[source]

The translatable msgid of the strategy

host_fits(source_node, destination_node)[source]

check host fits

return True if VMs could intensively migrate from source_node to destination_node.

host_migration(source_node, destination_node)[source]

host migration

Migrate all instances from source_node to destination_node. Active instances use “live-migrate”, and other instances use “cold-migrate”

instance_migration(instance, src_node, des_node=None)[source]

Add an action for instance migration into the solution.

Parameters:
  • instance – instance object
  • src_node – node object
  • des_node – node object. if None, the instance will be migrated relying on nova-scheduler
Returns:

None

post_execute()[source]

Post-execution phase

This can be used to compute the global efficacy

pre_execute()[source]

Pre-execution phase

This can be used to fetch some pre-requisites or data.

safe_maintain(maintenance_node, backup_node=None)[source]

safe maintain one compute node

Migrate all instances of the maintenance_node intensively to the backup host. If users didn’t give the backup host, it will select one unused node to backup the maintaining node.

It calculate the resource both of the backup node and maintaining node to evaluate the migrations from maintaining node to backup node. If all instances of the maintaining node can migrated to the backup node, it will set the maintaining node in ‘watcher_maintaining’ status., and add the migrations to solution.

try_maintain(maintenance_node)[source]

try to maintain one compute node

It firstly set the maintenance_node in ‘watcher_maintaining’ status. Then try to migrate all instances of the maintenance node, rely on nova-scheduler.

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.