private void printPoolDetails2(HFCPool pool, StringBuffer sb) { sb.append(pool._poolName); sb.append("\n").append(pool.toString()).append(" "); if (pool.cellInfo == null) { return; } PoolCellInfo cellInfo = pool.cellInfo; PoolCostInfo costInfo = cellInfo.getPoolCostInfo(); PoolCostInfo.PoolSpaceInfo spaceInfo = costInfo.getSpaceInfo(); PoolCostInfo.PoolQueueInfo queueInfo = costInfo.getStoreQueue(); long total = spaceInfo.getTotalSpace(); long precious = spaceInfo.getPreciousSpace(); sb.append(" ") .append("Mode=") .append(pool.getPoolModeString()) .append(";Total=") .append(total) .append(";Precious=") .append(precious) .append(";Frac=") .append((float) precious / (float) total) .append(";Queue={") .append(queueInfo.toString()) .append("}\n"); for (Object o : pool.flushInfos.values()) { HFCFlushInfo info = (HFCFlushInfo) o; StorageClassFlushInfo flush = info.getStorageClassFlushInfo(); String storeName = flush.getStorageClass() + "@" + flush.getHsm(); long size = flush.getTotalPendingFileSize(); int count = flush.getRequestCount(); int active = flush.getActiveCount(); sb.append(" ") .append(storeName) .append(" ") .append(info._flushingRequested ? "R" : "-") .append(info._flushingPending ? "P" : "-") .append(info._flushingError != 0 ? "E" : "-") .append("(") .append(info._flushingId) .append(")") .append(";Size=") .append(size) .append(";Count=") .append(count) .append(";Active=") .append(active) .append("\n"); } }
private void queryAllPoolModes() { List<HFCPool> list; synchronized (this) { list = new ArrayList<>(_configuredPoolList.values()); } for (HFCPool pool : list) { pool.queryMode(); } }
public String ac_query_pool_mode_$_1(Args args) { String poolName = args.argv(0); HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { throw new NoSuchElementException("Pool not found : " + poolName); } pool.queryMode(); return "Pool mode query sent to Pool " + poolName; }
public Object ac_ls_pool_$_0_1(Args args) { String poolName = args.argc() == 0 ? null : args.argv(0); boolean detail = args.hasOption("l"); boolean binary = args.hasOption("binary"); StringBuffer sb = new StringBuffer(); if (poolName == null) { if (binary) { Collection<HsmFlushControlCore.PoolDetails> list = new ArrayList<>(); for (Object pool : _eventDispatcher.getConfiguredPools()) { list.add(((HFCPool) pool).getDetails()); } return list; } else { Set<String> set = new TreeSet<>(_poolCollector.getConfiguredPoolNames()); for (Object configuredPoolName : set) { String name = configuredPoolName.toString(); if (!detail) { sb.append(name).append("\n"); } else { HFCPool pool = _poolCollector.getPoolByName(name); printPoolDetails2(pool, sb); } } } } else { HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { throw new NoSuchElementException("Pool not found : " + poolName); } if (binary) { return pool.getDetails(); /* HsmFlushControlCore.PoolDetails details = pool.getDetails() ; sb.append("PoolDetails\n"). append(" Name ").append(details.getName()).append("\n"). append(" CellInfo ").append(details.getCellInfo()).append("\n"). append(" isActive ").append(details.isActive()).append("\n") ; for( Iterator i = details.getFlushInfos().iterator() ; i.hasNext() ; ){ HsmFlushControlCore.FlushInfoDetails flush = (HsmFlushControlCore.FlushInfoDetails)i.next() ; sb.append(" StorageClass ").append(flush.getName()).append("\n"). append(" isFlushing ").append(flush.isFlushing()).append("\n"). append(" FlushInfo ").append(flush.getStorageClassFlushInfo()).append("\n"); } */ } else { printPoolDetails2(pool, sb); } } return sb.toString(); }
private void poolModeInfoArrived(PoolManagerPoolModeMessage msg) { if (LOG_ENABLED) { _log.info("PoolManagerPoolModeMessage : " + msg); } String poolName = msg.getPoolName(); synchronized (_poolCollector) { HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { _log.warn("poolModeInfoArrived : message arrived for non configured pool : " + poolName); return; } pool.mode = msg.getPoolMode(); _eventDispatcher.poolIoModeUpdated(pool); } }
private void poolFlushGainControlMessageDidntArrive(String poolName) { if (LOG_ENABLED) { _log.info("poolFlushGainControlMessageDidntArrive : " + poolName); } synchronized (_poolCollector) { HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { _log.warn( "PoolFlushGainControlMessage : message arrived for non configured pool : " + poolName); return; } pool.isActive = false; pool.lastUpdated = System.currentTimeMillis(); pool.answerCount++; _eventDispatcher.poolFlushInfoUpdated(pool); } }
public String ac_flush_pool_$_2(Args args) throws Exception { String poolName = args.argv(0); String storageClass = args.argv(1); String countString = args.getOpt("count"); int count = (countString == null) || countString.equals("") ? 0 : Integer.parseInt(countString); HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { throw new NoSuchElementException("Pool not found : " + poolName); } HsmFlushControlCore.FlushInfo info = pool.getFlushInfoByStorageClass(storageClass); if (info == null) { throw new NoSuchElementException("StorageClass not found : " + storageClass); } info.flush(count); return "Flush initiated for (" + poolName + "," + storageClass + ")"; }
public String ac_set_pool_$_2(Args args) { String poolName = args.argv(0); String mode = args.argv(1); HFCPool pool = _poolCollector.getPoolByName(poolName); if (pool == null) { throw new NoSuchElementException("Pool not found : " + poolName); } switch (mode) { case "rdonly": pool.setReadOnly(true); break; case "rw": pool.setReadOnly(false); break; default: throw new IllegalArgumentException("Illegal mode : rdonly|rw"); } return "Pool " + poolName + " set to " + mode; }
private void updateFlushCellAndFlushInfos(PoolFlushControlInfoMessage msg, HFCPool pool) { pool.cellInfo = msg.getCellInfo(); StorageClassFlushInfo[] flushInfos = msg.getFlushInfos(); HashMap<String, HFCFlushInfo> map = new HashMap<>(); if (flushInfos != null) { for (StorageClassFlushInfo flushInfo : flushInfos) { String storageClass = flushInfo.getStorageClass() + "@" + flushInfo.getHsm(); HFCFlushInfo info = pool.flushInfos.get(storageClass); if (info == null) { map.put(storageClass, new HFCFlushInfo(pool, flushInfo)); } else { info.updateFlushInfo(flushInfo); map.put(storageClass, info); } } } pool.flushInfos = map; pool.isActive = true; pool.lastUpdated = System.currentTimeMillis(); pool.answerCount++; }