@@ -1319,6 +1319,29 @@ def test_get_host_states_by_uuids(self, mock_get_by_host, mock_get_all,
1319
1319
num_hosts2 = len (list (host_states2 ))
1320
1320
self .assertEqual (0 , num_hosts2 )
1321
1321
1322
+ @mock .patch ('nova.scheduler.host_manager.HostManager.'
1323
+ '_get_computes_for_cells' ,
1324
+ return_value = (mock .sentinel .compute_nodes ,
1325
+ mock .sentinel .services ))
1326
+ @mock .patch ('nova.scheduler.host_manager.HostManager._get_host_states' )
1327
+ def test_get_host_states_by_uuids_allow_cross_cell_move (
1328
+ self , mock_get_host_states , mock_get_computes ):
1329
+ """Tests that get_host_states_by_uuids will not restrict to a given
1330
+ cell if allow_cross_cell_move=True in the request spec.
1331
+ """
1332
+ ctxt = nova_context .get_admin_context ()
1333
+ compute_uuids = [uuids .compute_node_uuid ]
1334
+ spec_obj = objects .RequestSpec (
1335
+ requested_destination = objects .Destination (
1336
+ cell = objects .CellMapping (uuid = uuids .cell1 ),
1337
+ allow_cross_cell_move = True ))
1338
+ self .host_manager .get_host_states_by_uuids (
1339
+ ctxt , compute_uuids , spec_obj )
1340
+ mock_get_computes .assert_called_once_with (
1341
+ ctxt , self .host_manager .enabled_cells , compute_uuids = compute_uuids )
1342
+ mock_get_host_states .assert_called_once_with (
1343
+ ctxt , mock .sentinel .compute_nodes , mock .sentinel .services )
1344
+
1322
1345
1323
1346
class HostStateTestCase (test .NoDBTestCase ):
1324
1347
"""Test case for HostState class."""
0 commit comments