rt: remove ComputeNode.create_inventory
The ComputeNode.update_inventory() and ComputeNode.create_inventory() were writing changes to the inventories table in the API database (or possibly even the cell database depending on whether the deployment was Mitaka or Newton milestone-2. This code path is no longer desired, and since no code is the scheduler currently *reads* the inventory information via the ComputeNode object, we can safely get rid of the call to ComputeNode.create_inventory() that were being made in the scheduler reporting client. Change-Id: Ia10036a8c2e9b1e40cf5674584ce468f892b8f97 blueprint: generic-resource-pools blueprint: compute-node-inventory-newton
This commit is contained in:
parent
ba4ff10867
commit
9dcf0236b4
@ -22,6 +22,4 @@ class SchedulerReportClient(object):
|
|||||||
|
|
||||||
:param compute_node: updated nova.objects.ComputeNode to report
|
:param compute_node: updated nova.objects.ComputeNode to report
|
||||||
"""
|
"""
|
||||||
if not compute_node.update_inventory():
|
|
||||||
compute_node.create_inventory()
|
|
||||||
compute_node.save()
|
compute_node.save()
|
||||||
|
@ -38,10 +38,7 @@ class SchedulerReportClientTestCase(test.NoDBTestCase):
|
|||||||
self.client = scheduler_report_client.SchedulerReportClient()
|
self.client = scheduler_report_client.SchedulerReportClient()
|
||||||
|
|
||||||
@mock.patch.object(objects.ComputeNode, 'save')
|
@mock.patch.object(objects.ComputeNode, 'save')
|
||||||
@mock.patch.object(objects.ComputeNode, 'create_inventory')
|
def test_update_resource_stats_saves(self, mock_save):
|
||||||
@mock.patch.object(objects.ComputeNode, 'update_inventory')
|
|
||||||
def test_update_resource_stats_saves(self, mock_update,
|
|
||||||
mock_create, mock_save):
|
|
||||||
cn = objects.ComputeNode(context=self.context)
|
cn = objects.ComputeNode(context=self.context)
|
||||||
cn.host = 'fakehost'
|
cn.host = 'fakehost'
|
||||||
cn.hypervisor_hostname = 'fakenode'
|
cn.hypervisor_hostname = 'fakenode'
|
||||||
@ -50,29 +47,8 @@ class SchedulerReportClientTestCase(test.NoDBTestCase):
|
|||||||
"product_id": "foo",
|
"product_id": "foo",
|
||||||
"count": 1,
|
"count": 1,
|
||||||
"a": "b"}])
|
"a": "b"}])
|
||||||
mock_update.return_value = True
|
|
||||||
self.client.update_resource_stats(cn)
|
self.client.update_resource_stats(cn)
|
||||||
mock_save.assert_called_once_with()
|
mock_save.assert_called_once_with()
|
||||||
mock_update.assert_called_once_with()
|
|
||||||
self.assertFalse(mock_create.called)
|
|
||||||
|
|
||||||
@mock.patch.object(objects.ComputeNode, 'save')
|
|
||||||
@mock.patch.object(objects.ComputeNode, 'create_inventory')
|
|
||||||
@mock.patch.object(objects.ComputeNode, 'update_inventory')
|
|
||||||
def test_update_resource_stats_creates(self, mock_update,
|
|
||||||
mock_create, mock_save):
|
|
||||||
cn = objects.ComputeNode(context=self.context)
|
|
||||||
cn.host = 'fakehost'
|
|
||||||
cn.hypervisor_hostname = 'fakenode'
|
|
||||||
cn.pci_device_pools = pci_device_pool.from_pci_stats(
|
|
||||||
[{"vendor_id": "foo",
|
|
||||||
"product_id": "foo",
|
|
||||||
"count": 1,
|
|
||||||
"a": "b"}])
|
|
||||||
mock_update.return_value = False
|
|
||||||
self.client.update_resource_stats(cn)
|
|
||||||
mock_save.assert_called_once_with()
|
|
||||||
mock_create.assert_called_once_with()
|
|
||||||
|
|
||||||
|
|
||||||
class SchedulerQueryClientTestCase(test.NoDBTestCase):
|
class SchedulerQueryClientTestCase(test.NoDBTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user