def test_delete_nodes_not_in_list(self, mock__delete_node, mock__list_node_uuids): uuid2 = 'uuid2' uuids = {self.uuid} mock__list_node_uuids.return_value = {self.uuid, uuid2} session = db.get_session() with session.begin(): node_cache.delete_nodes_not_in_list(uuids) mock__delete_node.assert_called_once_with(uuid2)
def test_delete_nodes_not_in_list(self, mock__delete_node, mock__list_node_uuids, mock__get_lock_ctx): uuid2 = uuidutils.generate_uuid() uuids = {self.uuid} mock__list_node_uuids.return_value = {self.uuid, uuid2} session = db.get_session() with session.begin(): node_cache.delete_nodes_not_in_list(uuids) mock__delete_node.assert_called_once_with(uuid2) mock__get_lock_ctx.assert_called_once_with(uuid2) mock__get_lock_ctx.return_value.__enter__.assert_called_once_with()
def sync_with_ironic(conductor): if (conductor.coordinator is not None and not conductor.coordinator.is_leader): LOG.debug('The conductor is not a leader, skipping syncing ' 'with ironic') return LOG.debug('Syncing with ironic') ironic = ir_utils.get_client() # TODO(yuikotakada): pagination ironic_nodes = ironic.nodes(fields=["uuid"], limit=None) ironic_node_uuids = {node.id for node in ironic_nodes} node_cache.delete_nodes_not_in_list(ironic_node_uuids)
def sync_with_ironic(): ironic = ir_utils.get_client() # TODO(yuikotakada): pagination ironic_nodes = ironic.node.list(limit=0) ironic_node_uuids = {node.uuid for node in ironic_nodes} node_cache.delete_nodes_not_in_list(ironic_node_uuids)
def sync_with_ironic(): ironic = utils.get_client() # TODO(yuikotakada): pagination ironic_nodes = ironic.node.list(limit=0) ironic_node_uuids = {node.uuid for node in ironic_nodes} node_cache.delete_nodes_not_in_list(ironic_node_uuids)