List<String> backupStorageTypes = getBackupStorageTypesByPrimaryStorageTypeFromMetrics(ps.getType());
PrimaryStorageType psType = PrimaryStorageType.valueOf(ps.getType()); List<String> bsUuids = psType.findBackupStorage(ps.getUuid()); bq.setParameter("types", hostAllocatorMgr.getBackupStorageTypesByPrimaryStorageTypeFromMetrics(ps.getType())); lst.addAll(bq.getResultList()); } else if (!bsUuids.isEmpty()) { } else { logger.warn(String.format("the primary storage[uuid:%s, type:%s] needs a bound backup storage," + " but seems it's not added", ps.getUuid(), ps.getType()));
String psUuid = getSelfInventory().getRootVolume().getPrimaryStorageUuid(); PrimaryStorageVO ps = dbf.getEntityManager().find(PrimaryStorageVO.class, psUuid); PrimaryStorageType psType = PrimaryStorageType.valueOf(ps.getType()); List<String> bsUuids = psType.findBackupStorage(psUuid); q.setParameter("bsTypes", hostAllocatorMgr.getBackupStorageTypesByPrimaryStorageTypeFromMetrics(ps.getType())); return ImageInventory.valueOf(q.getResultList()); } else if (!bsUuids.isEmpty()) {
PrimaryStorageType type = PrimaryStorageType.valueOf(psvo.getType()); List<String> bsUuids = type.findBackupStorage(psUuid); if (bsUuids == null) { List<String> possibleBsTypes = hostAllocatorMgr.getBackupStorageTypesByPrimaryStorageTypeFromMetrics(psvo.getType()); sql = "select count(bs)" + " from BackupStorageVO bs, ImageBackupStorageRefVO ref" +
private Boolean isCephPrimaryStorageVolume(String volumeUuid) { VolumeVO volumeVO = Q.New(VolumeVO.class).eq(VolumeVO_.uuid, volumeUuid).find(); PrimaryStorageVO primaryStorageVO = Q.New(PrimaryStorageVO.class) .eq(PrimaryStorageVO_.uuid, volumeVO.getPrimaryStorageUuid()).find(); return primaryStorageVO.getType().equals(type.toString()); } }
for (VmInstanceVO vo : candidates) { PrimaryStorageVO psVo = dbf.findByUuid(vo.getRootVolume().getPrimaryStorageUuid(), PrimaryStorageVO.class); if (LocalStorageConstants.LOCAL_STORAGE_TYPE.equals(psVo.getType()) && VolumeStatus.NotInstantiated.equals(vol.getStatus())) { String volumeUuid = vo.getRootVolumeUuid(); VolumeVO rootVolumeVO = dbf.findByUuid(volumeUuid, VolumeVO.class);
while (it.hasNext()) { PrimaryStorageVO psvo = it.next(); if (!spec.getPossiblePrimaryStorageTypes().contains(psvo.getType())) { logger.debug(String.format("the primary storage[name:%s, uuid:%s, type:%s] is not in possible primary storage types[%s]," + " remove it", psvo.getName(), psvo.getUuid(), psvo.getType(), spec.getPossiblePrimaryStorageTypes())); it.remove(); while (it.hasNext()) { PrimaryStorageVO psvo = it.next(); if (spec.getExcludePrimaryStorageTypes().contains(psvo.getType())) { logger.debug(String.format("the primary storage[name:%s, uuid:%s, type:%s] is in exclude primary storage types[%s]," + " remove it", psvo.getName(), psvo.getUuid(), psvo.getType(), spec.getExcludePrimaryStorageTypes())); it.remove();
while (it.hasNext()) { PrimaryStorageVO psvo = it.next(); if (!spec.getPossiblePrimaryStorageTypes().contains(psvo.getType())) { logger.debug(String.format("the primary storage[name:%s, uuid:%s, type:%s] is not in possible primary storage types[%s]," + " remove it", psvo.getName(), psvo.getUuid(), psvo.getType(), spec.getPossiblePrimaryStorageTypes())); it.remove(); while (it.hasNext()) { PrimaryStorageVO psvo = it.next(); if (spec.getExcludePrimaryStorageTypes().contains(psvo.getType())) { logger.debug(String.format("the primary storage[name:%s, uuid:%s, type:%s] is in exclude primary storage types[%s]," + " remove it", psvo.getName(), psvo.getUuid(), psvo.getType(), spec.getExcludePrimaryStorageTypes())); it.remove();
private void passThrough(PrimaryStorageMessage pmsg) { PrimaryStorageVO vo = dbf.findByUuid(pmsg.getPrimaryStorageUuid(), PrimaryStorageVO.class); if (vo == null && allowedMessageAfterSoftDeletion.contains(pmsg.getClass())) { PrimaryStorageEO eo = dbf.findByUuid(pmsg.getPrimaryStorageUuid(), PrimaryStorageEO.class); vo = ObjectUtils.newAndCopy(eo, PrimaryStorageVO.class); } Message msg = (Message) pmsg; if (vo == null) { bus.replyErrorByMessageType(msg, err(SysErrors.RESOURCE_NOT_FOUND, "Cannot find primary storage[uuid:%s], it may have been deleted", pmsg.getPrimaryStorageUuid())); return; } PrimaryStorageFactory factory = getPrimaryStorageFactory(PrimaryStorageType.valueOf(vo.getType())); PrimaryStorageVO finalVo = vo; PrimaryStorage ps = Platform.New(()-> factory.getPrimaryStorage(finalVo)); ps.handleMessage(msg); }
)); } else { path = exts.get(0).getCommitAgentPath(self.getType()); hostname = exts.get(0).getHostName(msg.getBackupStorageUuid()); DebugUtils.Assert(path != null, String.format("found the extension point: [%s], but return null path",
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()); } }
if(requiredPrimaryStorageUuidForDataVolume.getType().equals(LocalStorageConstants.LOCAL_STORAGE_TYPE)){ ErrorCode errorCode = operr("The cluster mounts multiple primary storage[%s(%s), other non-LocalStorage primary storage], primaryStorageUuidForDataVolume cannot be specified %s", requiredPrimaryStorageUuidForDataVolume.getUuid(), requiredPrimaryStorageUuidForDataVolume.getType(), LocalStorageConstants.LOCAL_STORAGE_TYPE); trigger.fail(errorCode);