diff --git a/nova/tests/baremetal/test_driver.py b/nova/tests/baremetal/test_driver.py index bf0a4740b8..f017253704 100644 --- a/nova/tests/baremetal/test_driver.py +++ b/nova/tests/baremetal/test_driver.py @@ -283,38 +283,10 @@ class BareMetalDriverWithDBTestCase(bm_db_base.BMDBTestCase): node1 = self._create_node() self.assertEqual(1, len(self.driver.get_available_nodes())) - node_info = bm_db_utils.new_bm_node( - id=456, - service_host='test_host', - cpus=2, - memory_mb=2048, - ) - nic_info = [ - {'address': 'cc:cc:cc', 'datapath_id': '0x1', - 'port_no': 1}, - {'address': 'dd:dd:dd', 'datapath_id': '0x2', - 'port_no': 2}, - ] - node2 = self._create_node(node_info=node_info, nic_info=nic_info) - self.assertEqual(2, len(self.driver.get_available_nodes())) - self.assertEqual([node1['node']['uuid'], node2['node']['uuid']], - self.driver.get_available_nodes()) - node1['instance']['hostname'] = 'test-host-1' - node2['instance']['hostname'] = 'test-host-2' - self.driver.spawn(**node1['spawn_params']) self.assertEqual(1, len(self.driver.get_available_nodes())) - - self.driver.spawn(**node2['spawn_params']) - self.assertEqual(0, len(self.driver.get_available_nodes())) - - self.driver.destroy(**node1['destroy_params']) - self.assertEqual(1, len(self.driver.get_available_nodes())) - - self.driver.destroy(**node2['destroy_params']) - self.assertEqual(2, len(self.driver.get_available_nodes())) - self.assertEqual([node1['node']['uuid'], node2['node']['uuid']], + self.assertEqual([node1['node']['uuid']], self.driver.get_available_nodes()) def test_list_instances(self): diff --git a/nova/virt/baremetal/driver.py b/nova/virt/baremetal/driver.py index cd07598bdc..736b511b93 100755 --- a/nova/virt/baremetal/driver.py +++ b/nova/virt/baremetal/driver.py @@ -486,4 +486,4 @@ class BareMetalDriver(driver.ComputeDriver): def get_available_nodes(self): context = nova_context.get_admin_context() return [str(n['uuid']) for n in - db.bm_node_get_unassociated(context, service_host=CONF.host)] + db.bm_node_get_all(context, service_host=CONF.host)]