The watcher.decision_engine.strategy.strategies.zone_migration Module

The watcher.decision_engine.strategy.strategies.zone_migration Module

Zone migration using instance and volume migration

This is zone migration strategy to migrate many instances and volumes efficiently with minimum downtime for hardware maintenance.

class watcher.decision_engine.strategy.strategies.zone_migration.ActionCounter(total_limit=6, per_pool_limit=2, per_node_limit=2)[source]

Bases: object

Manage the number of actions in parallel

add_node(node)[source]

Add the number of actions on node

Parameters:host – compute node
Returns:True if action can be added, False otherwise
add_pool(pool)[source]

Increment the number of actions on host and total count

Parameters:pool – storage pool
Returns:True if incremented, False otherwise
is_node_max(node)[source]

Check if per node count reached limit

Returns:True if count reached limit, False otherwise
is_pool_max(pool)[source]

Check if per pool count reached limit

Returns:True if count reached limit, False otherwise
is_total_max()[source]

Check if total count reached limit

Returns:True if total count reached limit, False otherwise
class watcher.decision_engine.strategy.strategies.zone_migration.BaseFilter(values=[], **kwargs)[source]

Bases: object

Base class for Filter

apply_filter(targets)[source]

apply filter to targets

Parameters:targets – dict of instance object and volume object list keys of dict are instance and volume
exec_filter(items, sort_key)[source]

This is implemented by sub class

is_allowed(key)[source]
class watcher.decision_engine.strategy.strategies.zone_migration.ComputeHostSortFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.SortMovingToFrontFilter

compare_func(item, sort_key)[source]

Compare compute name of item with sort_key

Parameters:
  • item – instance object
  • sort_key – compute host name
Returns:

true: compute name on which intance is equals sort_key false: otherwise

get_host(item)[source]

get hostname on which item is

Parameters:item – instance object
Returns:hostname on which item is
class watcher.decision_engine.strategy.strategies.zone_migration.ComputeSpecSortFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.BaseFilter

exec_filter(items, sort_key)[source]
get_disk_size(item, flavors)[source]

Get disk size of item

Parameters:
  • item – instance
  • flavors – flavors
Returns:

disk size of item

get_mem_size(item, flavors)[source]

Get memory size of item

Parameters:
  • item – instance
  • flavors – flavors
Returns:

memory size of item

get_sorted_items(items, sort_key)[source]

Sort items by sort_key

Parameters:
  • items – instances
  • sort_key – sort_key
Returns:

items sorted by sort_key

get_vcpu_num(item, flavors)[source]

Get vcpu number of item

Parameters:
  • item – instance
  • flavors – flavors
Returns:

vcpu number of item

class watcher.decision_engine.strategy.strategies.zone_migration.ProjectSortFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.SortMovingToFrontFilter

ComputeHostSortFilter

compare_func(item, sort_key)[source]

Compare project id of item with sort_key

Parameters:
  • item – instance object or volume object
  • sort_key – project id
Returns:

true: project id of item equals sort_key false: otherwise

get_project_id(item)[source]

get project id of item

Parameters:item – instance object or volume object
Returns:project id
class watcher.decision_engine.strategy.strategies.zone_migration.SortMovingToFrontFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.BaseFilter

This is to move to front if a condition is True

compare_func(item, sort_key)[source]
exec_filter(items, sort_key)[source]
sort_moving_to_front(items, sort_key=None, compare_func=None)[source]
class watcher.decision_engine.strategy.strategies.zone_migration.StorageHostSortFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.SortMovingToFrontFilter

StoragehostSortFilter

compare_func(item, sort_key)[source]

Compare pool name of item with sort_key

Parameters:
  • item – volume object
  • sort_key – storage pool name
Returns:

true: pool name on which intance is equals sort_key false: otherwise

get_host(item)[source]
class watcher.decision_engine.strategy.strategies.zone_migration.StorageSpecSortFilter(values=[], **kwargs)[source]

Bases: watcher.decision_engine.strategy.strategies.zone_migration.BaseFilter

exec_filter(items, sort_key)[source]
class watcher.decision_engine.strategy.strategies.zone_migration.ZoneMigration(config, osc=None)[source]

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

Zone migration using instance and volume migration

do_execute()[source]

Strategy execution phase

filtered_targets()[source]

Filter targets

prioritize instances and volumes based on priorities from input parameters.

Returns:prioritized targets
get_available_compute_nodes()[source]
get_available_storage_nodes()[source]
classmethod get_display_name()[source]
get_dst_node(src_node)[source]

Get destination node from self.migration_compute_nodes

Parameters:src_node – compute node name
Returns:destination node name
get_dst_pool_and_type(src_pool, src_type)[source]

Get destination pool and type from self.migration_storage_pools

Parameters:
  • src_pool – storage pool name
  • src_type – storage volume type
Returns:

set of storage pool name and volume type name

get_host_by_pool(pool)[source]

Get host name from pool name

Utility method to get host name from pool name which is formatted as host@backend#pool.

Parameters:pool – pool name
Returns:host name
get_instances()[source]

Get migrate target instances

Returns:instance list on src nodes and compute scope
classmethod get_name()[source]
get_priority_filter_list()[source]

Get priority filters

Returns:list of filter object with arguments in self.priority
get_priority_filter_map()[source]

Get priority filter map

Returns:filter map key is the key in priority input parameters. value is filter class for prioritizing.
classmethod get_schema()[source]
get_src_node_list()[source]

Get src nodes from migrate_compute_nodes

Returns:src node name list
get_src_pool_list()[source]

Get src pools from migrate_storage_pools

Returns:src pool name list
classmethod get_translatable_display_name()[source]
get_volumes()[source]

Get migrate target volumes

Returns:volume list on src pools and storage scope
instances_migration(instances, action_counter)[source]
instances_no_attached(instances)[source]
is_available(volume)[source]
is_cold(instance)[source]
is_in_use(volume)[source]
is_live(instance)[source]
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.

set_migration_count(targets)[source]

Set migration count

Parameters:targets – dict of instance object and volume object list keys of dict are instance and volume
volumes_migration(volumes, action_counter)[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.