BugFix: Prevent float type variables from being passed to random
>>> random.sample([5,10], 1.3) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.6/random.py", line 321, in sample result = [None] * k TypeError: can't multiply sequence by non-int of type 'float' Change-Id: Ifa5dca06f07220512579e4fe3c5c741aeffc71cc
This commit is contained in:
parent
a993849928
commit
6dd2f2a9c1
@ -197,9 +197,9 @@ class SavingEnergy(base.SavingEnergyBaseStrategy):
|
||||
|
||||
def save_energy(self):
|
||||
|
||||
need_poweron = max(
|
||||
need_poweron = int(max(
|
||||
(len(self.with_vms_node_pool) * self.free_used_percent / 100), (
|
||||
self.min_free_hosts_num))
|
||||
self.min_free_hosts_num)))
|
||||
len_poweron = len(self.free_poweron_node_pool)
|
||||
len_poweroff = len(self.free_poweroff_node_pool)
|
||||
if len_poweron > need_poweron:
|
||||
|
Loading…
x
Reference in New Issue
Block a user