@Transactional(readOnly = true) private void checkIfBackupStorageAttachedToMyZone(String bsUuid) { String sql = "select bs.uuid" + " from BackupStorageVO bs, BackupStorageZoneRefVO ref" + " where bs.uuid = ref.backupStorageUuid" + " and ref.zoneUuid = :zoneUuid" + " and bs.uuid = :bsUuid"; TypedQuery<String> q = dbf.getEntityManager().createQuery(sql, String.class); q.setParameter("zoneUuid", self.getZoneUuid()); q.setParameter("bsUuid", bsUuid); if (q.getResultList().isEmpty()) { throw new OperationFailureException(operr("backup storage[uuid:%s] is not attached to zone[uuid:%s] the primary storage[uuid:%s] belongs to", bsUuid, self.getZoneUuid(), self.getUuid())); } }
@Override void downloadImageToCache(ImageInventory img, final ReturnValueCompletion<String> completion) { ImageBackupStorageSelector selector = new ImageBackupStorageSelector(); selector.setZoneUuid(self.getZoneUuid()); selector.setImageUuid(img.getUuid()); final String bsUuid = selector.select(); "1. check if image is in status of Deleted\n" + "2. check if the backup storage on which the image is shown as Ready is attached to the zone[uuid:%s]", img.getUuid(), img.getName(), self.getZoneUuid() ));
@Override void downloadImageToCache(ImageInventory img, String hostUuid, final ReturnValueCompletion<String> completion) { ImageBackupStorageSelector selector = new ImageBackupStorageSelector(); selector.setZoneUuid(self.getZoneUuid()); selector.setImageUuid(img.getUuid()); final String bsUuid = selector.select(); "1. check if image is in status of Deleted\n" + "2. check if the backup storage on which the image is shown as Ready is attached to the zone[uuid:%s]", img.getUuid(), img.getName(), self.getZoneUuid()));
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()); } }