基本离线服务器整合

概要

显示名称: Basic offline consolidation

目标: server_consolidation

良好的服务器整合策略

使用实时迁移进行基本的离线整合

在 OpenStack 等云环境中,整合虚拟机对于实现能源优化至关重要。随着虚拟机的启动和/或移动,有必要在服务器之间迁移虚拟机以降低成本。然而,虚拟机的迁移会引入运行时开销并消耗额外的能源,因此良好的服务器整合策略应仔细规划迁移,以便最大限度地减少能源消耗并符合各种 SLA。

该算法不仅可以最大限度地减少使用的服务器总数,还可以最大限度地减少迁移次数。

它仅为测试而开发。要运行它,您至少需要 2 个物理计算节点,因此您可以轻松地在 DevStack 上运行它。它假定您的 OpenStack 集群上可以进行实时迁移。

需求

指标

基本策略需要以下指标

指标

服务名称

插件

comment

compute.node.cpu.percent

ceilometer

none

需要在 nova.conf 中将 compute_monitors 选项设置为 cpu.virt_driver

cpu

ceilometer

none

集群数据模型

默认 Watcher 的计算集群数据模型

Nova 集群数据模型收集器

Nova 集群数据模型收集器创建了计算服务暴露的资源的内存表示。

行动

默认 Watcher 的动作

动作

description

迁移

将服务器迁移到目标 nova-compute 宿主机

此动作允许您将服务器迁移到另一个计算目标宿主机。迁移类型“live”只能用于迁移活动虚拟机。迁移类型“cold”可用于迁移非活动虚拟机以及活动虚拟机,在迁移过程中将关闭它们。

动作模式是

schema = Schema({
 'resource_id': str,  # should be a UUID
 'migration_type': str,  # choices -> "live", "cold"
 'destination_node': str,
 'source_node': str,
})

resource_id 是要迁移的服务器的 UUID。 source_nodedestination_node 参数分别是源和目标计算主机名。

注意

如果提供了 destination_node 参数,则 Nova API 版本必须为 2.56 或更高版本。

change_nova_service_state

禁用或启用部署在宿主机上的 nova-compute 服务

通过使用此动作,您将能够更新 nova-compute 服务的状态。被禁用的 nova-compute 服务不能被 nova 调度器选择用于服务器的未来部署。

动作模式是

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

resource_id 引用一个 nova-compute 服务名称。 state 值应为 updowndisabled_reason 引用 Watcher 禁用此 nova-compute 服务的理由。该值应以 watcher_ 前缀开头,例如 watcher_disabledwatcher_maintaining

规划器

默认 Watcher 的规划器

权重规划器实现

此实现根据权重构建具有父级的动作。权重较高的动作集将在其他动作之前被调度。有 2 个配置选项可以配置:action_weights 和 parallelization。

Limitations

  • 此规划器需要对 action_weights 和 parallelization 配置进行良好的调整。

配置

策略参数是

参数

type

默认值

description

migration_attempts

数字

0

策略在搜索潜在候选者时尝试的最大组合数。要删除限制,请将其设置为 0

周期

数字

7200

从指标数据源获取统计聚合的时间间隔(秒)

效能指标

[{'name': 'released_nodes_ratio', 'description': 'Ratio of released compute nodes divided by the total number of enabled compute nodes.', 'unit': '%', 'value': 0}]

如何使用它?

$ openstack optimize audittemplate create \
  at1 server_consolidation --strategy basic

$ openstack optimize audit create -a at1 -p migration_attempts=4