public static PrimaryStorageClusterRefInventory valueOf(PrimaryStorageClusterRefVO vo) { PrimaryStorageClusterRefInventory inv = new PrimaryStorageClusterRefInventory(); inv.setClusterUuid(vo.getClusterUuid()); inv.setId(vo.getId()); inv.setLastOpDate(vo.getLastOpDate()); inv.setCreateDate(vo.getCreateDate()); return inv; }
@Override public String call(PrimaryStorageClusterRefVO arg) { return arg.getClusterUuid(); } });
Map<String, Set<String>> clusterPs = new HashMap<>(); for (PrimaryStorageClusterRefVO ref : refs) { Set<String> pss = clusterPs.get(ref.getClusterUuid()); if (pss == null) { pss = new HashSet<>(); clusterPs.put(ref.getClusterUuid(), pss); pss.add(ref.getPrimaryStorageUuid());
private void recalculatePrimaryStorageCapacity(String clusterUuid) { SimpleQuery<PrimaryStorageClusterRefVO> q = dbf.createQuery(PrimaryStorageClusterRefVO.class); q.add(PrimaryStorageClusterRefVO_.clusterUuid, Op.EQ, clusterUuid); List<PrimaryStorageClusterRefVO> refs = q.list(); if (refs != null && !refs.isEmpty()) { for (PrimaryStorageClusterRefVO ref : refs) { RecalculatePrimaryStorageCapacityMsg msg = new RecalculatePrimaryStorageCapacityMsg(); msg.setPrimaryStorageUuid(ref.getPrimaryStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, ref.getPrimaryStorageUuid()); bus.send(msg); } } }
@Override public String call(PrimaryStorageClusterRefVO arg) { return arg.getClusterUuid(); } });
private void handle(PrimaryStorageRemoveCachedImageMsg msg) { if (self.getAttachedClusterRefs().isEmpty()) { PrimaryStorageRemoveCachedImageReply reply = new PrimaryStorageRemoveCachedImageReply(); reply.setError(operr("primary storage[uuid:%s] doesn't attach to any cluster", self.getUuid())); bus.reply(msg, reply); return; } PrimaryStorageClusterRefVO ref = self.getAttachedClusterRefs().iterator().next(); ClusterVO cluster = dbf.findByUuid(ref.getClusterUuid(), ClusterVO.class); getBackend(HypervisorType.valueOf(cluster.getHypervisorType())).deleteImageCache(msg.getInventory()); }
.anyMatch(ref -> ref.getClusterUuid().equals(d.getInventory().getClusterUuid()))) { return false;
protected PrimaryStorageInventory(PrimaryStorageVO vo) { setZoneUuid(vo.getZoneUuid()); setCreateDate(vo.getCreateDate()); setDescription(vo.getDescription()); setLastOpDate(vo.getLastOpDate()); setName(vo.getName()); setState(vo.getState().toString()); setType(vo.getType()); setUrl(vo.getUrl()); setUuid(vo.getUuid()); setMountPath(vo.getMountPath()); setStatus(vo.getStatus().toString()); attachedClusterUuids = new ArrayList<String>(vo.getAttachedClusterRefs().size()); for (PrimaryStorageClusterRefVO ref : vo.getAttachedClusterRefs()) { attachedClusterUuids.add(ref.getClusterUuid()); } if (vo.getCapacity() != null) { setTotalCapacity(vo.getCapacity().getTotalCapacity()); setAvailableCapacity(vo.getCapacity().getAvailableCapacity()); setTotalPhysicalCapacity(vo.getCapacity().getTotalPhysicalCapacity()); setAvailablePhysicalCapacity(vo.getCapacity().getAvailablePhysicalCapacity()); setSystemUsedCapacity(vo.getCapacity().getSystemUsedCapacity()); } }