Updated the VM selection algorithm to return a list of VMs
This commit is contained in:
parent
d6c53793c6
commit
c6c79740a6
@ -41,7 +41,7 @@ def random_factory(time_step, migration_time, params):
|
||||
:return: A function implementing the random VM selection algorithm.
|
||||
:rtype: function
|
||||
"""
|
||||
return lambda vms_cpu, vms_ram, state=None: (random(vms_cpu), {})
|
||||
return lambda vms_cpu, vms_ram, state=None: ([random(vms_cpu)], {})
|
||||
|
||||
|
||||
@contract
|
||||
@ -61,7 +61,7 @@ def minimum_utilization_factory(time_step, migration_time, params):
|
||||
:rtype: function
|
||||
"""
|
||||
return lambda vms_cpu, vms_ram, state=None: \
|
||||
(minimum_utilization(vms_cpu), {})
|
||||
([minimum_utilization(vms_cpu)], {})
|
||||
|
||||
|
||||
@contract
|
||||
@ -81,7 +81,7 @@ def minimum_migration_time_factory(time_step, migration_time, params):
|
||||
:rtype: function
|
||||
"""
|
||||
return lambda vms_cpu, vms_ram, state=None: \
|
||||
(minimum_migration_time(vms_ram), {})
|
||||
([minimum_migration_time(vms_ram)], {})
|
||||
|
||||
|
||||
@contract
|
||||
|
@ -35,7 +35,7 @@ class Selection(TestCase):
|
||||
values = x.values()
|
||||
vm_index = values.index(min(values))
|
||||
vm = x.keys()[vm_index]
|
||||
assert alg(dict(), x) == (vm, {})
|
||||
assert alg(dict(), x) == ([vm], {})
|
||||
|
||||
@qc(10)
|
||||
def minimum_utilization_factory(
|
||||
@ -52,7 +52,7 @@ class Selection(TestCase):
|
||||
last_utilization.append(utilization[-1])
|
||||
vm_index = last_utilization.index(min(last_utilization))
|
||||
vm = x.keys()[vm_index]
|
||||
assert alg(x, dict()) == (vm, {})
|
||||
assert alg(x, dict()) == ([vm], {})
|
||||
|
||||
@qc(10)
|
||||
def random_factory(
|
||||
@ -67,7 +67,7 @@ class Selection(TestCase):
|
||||
alg = selection.random_factory(300, 20., dict())
|
||||
vm = x.keys()[random.randrange(len(x))]
|
||||
expect(selection).choice(x.keys()).and_return(vm).once()
|
||||
assert alg(x, dict()) == (vm, {})
|
||||
assert alg(x, dict()) == ([vm], {})
|
||||
|
||||
@qc(10)
|
||||
def minimum_migration_time(
|
||||
|
Loading…
Reference in New Issue
Block a user