def test_all_enroll_actions(self, mock_facade, mock_facade_set_node_provision_state): node_manager = NodeManager() fake_node = copy.deepcopy(POOL_OF_FAKE_IRONIC_NODES[1]) fake_node.provision_state = 'enroll' node_manager.manage_node_provision_state(fake_node) mock_facade_set_node_provision_state.assert_called_with( fake_node, 'manage')
def test_manage_provision_state_inspection_enabled( self, mock_facade, mock_inspection_enabled): mock_facade = facade.Facade() mock_facade.set_node_provision_state = mock.MagicMock() mock_inspection_enabled.return_value = True fake_node = copy.deepcopy(POOL_OF_FAKE_IRONIC_NODES[1]) fake_node.provision_state = 'manageable' node_manager = NodeManager() node_manager.manage_node_provision_state(fake_node) mock_facade.set_node_provision_state.assert_called_with( fake_node, 'inspect')
def test_manage_node_provision_state_with_node_in_inspect_failed( self, mock_facade): mock_facade = facade.Facade() mock_facade.set_node_provision_state = mock.MagicMock() fake_node = copy.deepcopy(POOL_OF_FAKE_IRONIC_NODES[1]) fake_node.provision_state = 'inspect failed' fake_node.last_error = ("OneView exception occurred. Error: Node %s is" " already in use by OneView.") % fake_node.id node_manager = NodeManager() node_manager.manage_node_provision_state(fake_node) mock_facade.set_node_provision_state.assert_called_with( fake_node, 'manage')
def do_manage_ironic_nodes(): """Show a list of OneView servers to be created as nodes in Ironic.""" node_manager = NodeManager() retry_interval_in_ms = CONF.DEFAULT.retry_interval * 1000 @retrying.retry(wait_fixed=retry_interval_in_ms) def execute(): try: node_manager.pull_ironic_nodes() except Exception as ex: LOG.error(ex) raise Exception("Continue trying...") execute()