/** * This method looks for all storage pools that are compatible with the given volume. * <ul> * <li>We will look for storage systems that are zone wide.</li> * <li>We also all storage available filtering by data center, pod and cluster as the current storage pool used by the given volume.</li> * </ul> */ private List<? extends StoragePool> getAllStoragePoolCompatileWithVolumeSourceStoragePool(StoragePool srcVolumePool) { List<StoragePoolVO> storagePools = new ArrayList<>(); List<StoragePoolVO> zoneWideStoragePools = _poolDao.findZoneWideStoragePoolsByTags(srcVolumePool.getDataCenterId(), null); if (CollectionUtils.isNotEmpty(zoneWideStoragePools)) { storagePools.addAll(zoneWideStoragePools); } List<StoragePoolVO> clusterAndLocalStoragePools = _poolDao.listBy(srcVolumePool.getDataCenterId(), srcVolumePool.getPodId(), srcVolumePool.getClusterId(), null); if (CollectionUtils.isNotEmpty(clusterAndLocalStoragePools)) { storagePools.addAll(clusterAndLocalStoragePools); } return storagePools; }
public boolean shouldAvoid(StoragePool pool) { if (_dcIds != null && _dcIds.contains(pool.getDataCenterId())) { return true; } if (_podIds != null && _podIds.contains(pool.getPodId())) { return true; } if (_clusterIds != null && _clusterIds.contains(pool.getClusterId())) { return true; } if (_poolIds != null && _poolIds.contains(pool.getId())) { return true; } return false; }
double storageAllocatedThreshold = CapacityManager.StorageAllocatedCapacityDisableThreshold.valueIn(pool.getDataCenterId());
private long getBytesRequiredForTemplate(VMTemplateVO tmpl, StoragePool pool) { DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName()); DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); if (storeDriver instanceof PrimaryDataStoreDriver) { PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver)storeDriver; TemplateInfo templateInfo = tmplFactory.getReadyTemplateOnImageStore(tmpl.getId(), pool.getDataCenterId()); return primaryStoreDriver.getBytesRequiredForTemplate(templateInfo, pool); } return tmpl.getSize(); }
private ModifyStoragePoolAnswer sendModifyStoragePoolCommand(ModifyStoragePoolCommand cmd, StoragePool storagePool, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify storage pool command for storage pool: " + storagePool.getId()); } if (!answer.getResult()) { String msg = "Unable to attach storage pool " + storagePool.getId() + " to the host " + hostId; alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, storagePool.getDataCenterId(), storagePool.getPodId(), msg, msg); throw new CloudRuntimeException(msg); } assert (answer instanceof ModifyStoragePoolAnswer) : "ModifyStoragePoolAnswer not returned from ModifyStoragePoolCommand; Storage pool = " + storagePool.getId() + "; Host = " + hostId; LOGGER.info("Connection established between storage pool " + storagePool + " and host " + hostId); return (ModifyStoragePoolAnswer)answer; } }
double storageUsedThreshold = CapacityManager.StorageCapacityDisableThreshold.valueIn(pool.getDataCenterId()); if (sc != null) { long totalSize = pool.getCapacityBytes();
templateStoreRef = _tmplStoreDao.findByTemplateZoneDownloadStatus(templateId, pool.getDataCenterId(), VMTemplateStorageResourceAssoc.Status.DOWNLOADED); if (templateStoreRef == null) { s_logger.error("Unable to find a secondary storage host who has completely downloaded the template.");
private void sendModifyStoragePoolCommand(ModifyStoragePoolCommand cmd, StoragePool storagePool, long hostId) { Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify storage pool command (" + storagePool.getId() + ")"); } if (!answer.getResult()) { String msg = "Unable to attach storage pool " + storagePool.getId() + " to host " + hostId; alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, storagePool.getDataCenterId(), storagePool.getPodId(), msg, msg); throw new CloudRuntimeException("Unable to establish a connection from agent to storage pool " + storagePool.getId() + " due to " + answer.getDetails() + " (" + storagePool.getId() + ")"); } assert (answer instanceof ModifyStoragePoolAnswer) : "ModifyStoragePoolAnswer expected ; Pool = " + storagePool.getId() + " Host = " + hostId; LOGGER.info("Connection established between storage pool " + storagePool + " and host + " + hostId); } }
int maxValue = StorageManager.MaxNumberOfManagedClusteredFileSystems.valueIn(clusterId); return getNumberOfManagedClusteredFileSystemsInComputeCluster(storagePool.getDataCenterId(), clusterId) < maxValue;
long exstPoolDcId = pool.getDataCenterId(); long exstPoolPodId = pool.getPodId() != null ? pool.getPodId() : -1; long exstPoolClusterId = pool.getClusterId() != null ? pool.getClusterId() : -1;
if (!(storTO instanceof NfsTO)) { srcData = cacheSnapshotChain(snapshot, new ZoneScope(pool.getDataCenterId()));
alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, pool.getDataCenterId(), pool.getPodId(), msg, msg); throw new CloudRuntimeException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails() + pool.getId()); if (mspAnswer.getLocalDatastoreName() != null && pool.isShared()) { String datastoreName = mspAnswer.getLocalDatastoreName(); List<StoragePoolVO> localStoragePools = this.primaryStoreDao.listLocalStoragePoolByPath(pool.getDataCenterId(), datastoreName); for (StoragePoolVO localStoragePool : localStoragePools) { if (datastoreName.equals(localStoragePool.getPath())) {
long rootVolDcId = pool.getDataCenterId(); Long rootVolPodId = pool.getPodId(); Long rootVolClusterId = pool.getClusterId();
@Override public boolean hostConnect(long hostId, long poolId) { StoragePool pool = (StoragePool) this.dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary); StoragePoolHostVO storagePoolHost = storagePoolHostDao.findByPoolHost(poolId, hostId); HostVO host = _hostDao.findById(hostId); if (storagePoolHost == null) { storagePoolHost = new StoragePoolHostVO(poolId, hostId, ""); storagePoolHostDao.persist(storagePoolHost); } StoragePoolVO poolVO = storagePoolDao.findById(pool.getId()); if(poolVO.isManaged() && (host.getHypervisorType() != HypervisorType.KVM)){ return true; } ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool); final Answer answer = agentMgr.easySend(hostId, cmd); if (answer == null) { throw new CloudRuntimeException("Unable to get an answer to the modify storage pool command" + pool.getId()); } if (!answer.getResult()) { String msg = "Unable to attach storage pool" + poolId + " to the host" + hostId; alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST,pool.getDataCenterId(), pool.getPodId(), msg, msg); throw new CloudRuntimeException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails() + pool.getId()); } assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId() + "Host=" + hostId; s_logger.info("Connection established between " + pool + " host + " + hostId); return true; }
hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZone(pool.getDataCenterId()); hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(poolVO.getHypervisor(), pool.getDataCenterId());
if (pool.getDataCenterId() != volume.getDataCenterId()) { throw new InvalidParameterValueException("Invalid storageId specified; refers to the pool outside of the volume's zone");
s_logger.debug("Root volume is ready, need to place VM in volume's cluster"); final long rootVolDcId = pool.getDataCenterId(); final Long rootVolPodId = pool.getPodId(); final Long rootVolClusterId = pool.getClusterId();