private void disconnectVdc(String vdcId) throws Exception { URI id = new URI(vdcId); VirtualDataCenter vdc = dbClient.queryObject(VirtualDataCenter.class, id); vdc.setConnectionStatus(VirtualDataCenter.ConnectionStatus.DISCONNECTED); dbClient.updateAndReindexObject(vdc); dbClient.addVdcNodesToBlacklist(vdc); }
private void updateBlackListForReconnectedVdc() { List<URI> vdcIds = dbClient.queryByType(VirtualDataCenter.class, true); dbClient.clearBlackList(); log.info("After clear, get current black list {}", dbClient.getBlacklist()); for (URI vdcId : vdcIds) { VirtualDataCenter vdc = dbClient.queryObject(VirtualDataCenter.class, vdcId); if (vdc.getConnectionStatus() == VirtualDataCenter.ConnectionStatus.DISCONNECTED) { log.info("Add vdc {} with status {} to blacklist", vdc.getId(), vdc.getConnectionStatus()); dbClient.addVdcNodesToBlacklist(vdc); } } }