openstack scheduler weight类

openstack weight 类主要对计算节点进行称重,最终根据各项指标返回主机的权值,

一个weight类的示例,返回未使用的虚拟CPU的数量:

class MyWeigher(weights.BaseHostWeigher):
	minval = 0
    	maxval = None

    	def _weigh_object(self, host_state, weight_properties):
        		unused_vcpus = host_state.vcpus_total - host_state.vcpus_used
        		return unused_vcpus

	def weight_multiplier(self):
      		return weight_multiplier


称重的过程主要有以下5步:

The procedure of weight action for one weight class:
1、execute _weigh_object method in weight class, get a weight list which contains metrics of every compute node. Take RamWeigher for example, the return value is:

图在下面


2、normalize:
 1)、get the minval and maxval value, these values can be got as the default configuration, if there is no default configuraion, can be get by this:
 minval = min(weigths); maxval = max(weights);
If minval is equal to maxval set the weight list to all zero then return.
 2)、execute the following expression for every element in weight list:
 i = ( i - minval ) / ( maxval - minval ).

get a new weight list.


3、accumulation:

 compute_node.weight += weigher.weight_multiplier( )  *  weight
the weight value is obtained from the weight list, for each compute node execute the above expression.


4、sort (reverse)


5、select one compute from the N best hosts, which is specified by the parameter “scheduler_host_subset_size”




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值