Merge "Correct baremetal/ironic consume_from_instance..."
This commit is contained in:
commit
a5f09ddddf
|
@ -40,7 +40,7 @@ class BaseBaremetalNodeState(host_manager.HostState):
|
|||
stats = compute.get('stats', '{}')
|
||||
self.stats = jsonutils.loads(stats)
|
||||
|
||||
def consume_from_instance(self, instance):
|
||||
def consume_from_instance(self, context, instance):
|
||||
"""Consume nodes entire resources regardless of instance request."""
|
||||
self.free_ram_mb = 0
|
||||
self.free_disk_mb = 0
|
||||
|
|
|
@ -68,9 +68,9 @@ class IronicNodeState(bbhm.BaseBaremetalNodeState):
|
|||
self.total_usable_disk_gb = compute['local_gb']
|
||||
self.updated = compute['updated_at']
|
||||
|
||||
def consume_from_instance(self, instance):
|
||||
def consume_from_instance(self, context, instance):
|
||||
"""Consume nodes entire resources regardless of instance request."""
|
||||
super(IronicNodeState, self).consume_from_instance(instance)
|
||||
super(IronicNodeState, self).consume_from_instance(context, instance)
|
||||
|
||||
self.updated = timeutils.utcnow()
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ class IronicHostManagerChangedNodesTestCase(test.NoDBTestCase):
|
|||
host.update_from_compute_node(self.compute_node)
|
||||
|
||||
instance = dict(root_gb=10, ephemeral_gb=0, memory_mb=1024, vcpus=1)
|
||||
host.consume_from_instance(instance)
|
||||
host.consume_from_instance('fake-context', instance)
|
||||
|
||||
self.assertEqual(1, host.vcpus_used)
|
||||
self.assertEqual(0, host.free_ram_mb)
|
||||
|
@ -166,7 +166,7 @@ class IronicHostManagerChangedNodesTestCase(test.NoDBTestCase):
|
|||
host.update_from_compute_node(self.compute_node)
|
||||
|
||||
instance = dict(root_gb=20, ephemeral_gb=0, memory_mb=2048, vcpus=2)
|
||||
host.consume_from_instance(instance)
|
||||
host.consume_from_instance('fake-context', instance)
|
||||
|
||||
self.assertEqual(1, host.vcpus_used)
|
||||
self.assertEqual(0, host.free_ram_mb)
|
||||
|
@ -177,7 +177,7 @@ class IronicHostManagerChangedNodesTestCase(test.NoDBTestCase):
|
|||
host.update_from_compute_node(self.compute_node)
|
||||
|
||||
instance = dict(root_gb=5, ephemeral_gb=0, memory_mb=512, vcpus=1)
|
||||
host.consume_from_instance(instance)
|
||||
host.consume_from_instance('fake-context', instance)
|
||||
|
||||
self.assertEqual(1, host.vcpus_used)
|
||||
self.assertEqual(0, host.free_ram_mb)
|
||||
|
|
Loading…
Reference in New Issue