protected boolean createStoragePool(long hostId, StoragePool pool) { s_logger.debug("creating pool " + pool.getName() + " on host " + hostId); if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM && pool.getPoolType() != StoragePoolType.SMB && pool.getPoolType() != StoragePoolType.Gluster) { s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType()); return false; } CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool); final Answer answer = agentMgr.easySend(hostId, cmd); if (answer != null && answer.getResult()) { return true; } else { primaryDataStoreDao.expunge(pool.getId()); String msg = ""; if (answer != null) { msg = "Can not create storage pool through host " + hostId + " due to " + answer.getDetails(); s_logger.warn(msg); } else { msg = "Can not create storage pool through host " + hostId + " due to CreateStoragePoolCommand returns null"; s_logger.warn(msg); } throw new CloudRuntimeException(msg); } }
private boolean createStoragePool(long hostId, StoragePool pool) { s_logger.debug("creating pool " + pool.getName() + " on host " + hostId); if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && pool.getPoolType() != StoragePoolType.IscsiLUN && pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && pool.getPoolType() != StoragePoolType.SharedMountPoint && pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2 && pool.getPoolType() != StoragePoolType.RBD && pool.getPoolType() != StoragePoolType.CLVM) { s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType()); return false; } CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool); final Answer answer = agentMgr.easySend(hostId, cmd); if (answer != null && answer.getResult()) { return true; } else { primaryDataStoreDao.expunge(pool.getId()); String msg = ""; if (answer != null) { msg = "Can not create storage pool through host " + hostId + " due to " + answer.getDetails(); s_logger.warn(msg); } else { msg = "Can not create storage pool through host " + hostId + " due to CreateStoragePoolCommand returns null"; s_logger.warn(msg); } throw new CloudRuntimeException(msg); } }
protected List<StoragePool> reorderPoolsByCapacity(DeploymentPlan plan, List<StoragePool> pools) { Long clusterId = plan.getClusterId(); short capacityType; if(pools != null && pools.size() != 0){ capacityType = pools.get(0).getPoolType().isShared() ? Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED : Capacity.CAPACITY_TYPE_LOCAL_STORAGE; } else{ return null; } List<Long> poolIdsByCapacity = capacityDao.orderHostsByFreeCapacity(clusterId, capacityType); if (s_logger.isDebugEnabled()) { s_logger.debug("List of pools in descending order of free capacity: "+ poolIdsByCapacity); } //now filter the given list of Pools by this ordered list Map<Long, StoragePool> poolMap = new HashMap<>(); for (StoragePool pool : pools) { poolMap.put(pool.getId(), pool); } List<Long> matchingPoolIds = new ArrayList<>(poolMap.keySet()); poolIdsByCapacity.retainAll(matchingPoolIds); List<StoragePool> reorderedPools = new ArrayList<>(); for(Long id: poolIdsByCapacity){ reorderedPools.add(poolMap.get(id)); } return reorderedPools; }
@Override public boolean prepareNodes(List<HostVO> hosts, StoragePool pool) { if (pool.getPoolType() != StoragePoolType.OCFS2) { throw new CloudRuntimeException("None OCFS2 storage pool is getting into OCFS2 manager!"); } return prepareNodes(getClusterName(pool.getClusterId()), hosts); }
if (pool.getPoolType().supportsOverProvisioning()) { BigDecimal overProvFactor = getStorageOverProvisioningFactor(pool.getId()); s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString() + " with over-provisioning factor " + overProvFactor.toString()); s_logger.debug("Total over-provisioned capacity calculated is " + overProvFactor + " * " + pool.getCapacityBytes()); } else { totalOverProvCapacity = pool.getCapacityBytes(); s_logger.debug("Found storage pool " + poolVO.getName() + " of type " + pool.getPoolType().toString());
public DestroyCommand(StoragePool pool, VMTemplateStorageResourceAssoc templatePoolRef) { volume = new VolumeTO(templatePoolRef.getId(), null, pool.getPoolType(), pool.getUuid(), null, pool.getPath(), templatePoolRef.getInstallPath(), templatePoolRef.getTemplateSize(), null); }
public StorageFilerTO(StoragePool pool) { this.id = pool.getId(); this.host = pool.getHostAddress(); this.port = pool.getPort(); this.path = pool.getPath(); this.type = pool.getPoolType(); this.uuid = pool.getUuid(); this.userInfo = pool.getUserInfo(); }
if (pool.getPoolType() == StoragePoolType.SMB && folder != null && folder.contains("?")) { folder = folder.substring(0, folder.indexOf("?"));
if(!checkHypervisorCompatibility(dskCh.getHypervisorType(), dskCh.getType(), pool.getPoolType())){ return false;
protected VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePool pool) { Long lastPoolId = volume.getPoolId(); String folder = pool.getPath(); // For SMB, pool credentials are also stored in the uri query string. We trim the query string // part here to make sure the credentials do not get stored in the db unencrypted. if (pool.getPoolType() == StoragePoolType.SMB && folder != null && folder.contains("?")) { folder = folder.substring(0, folder.indexOf("?")); } VolumeVO newVol = new VolumeVO(volume); newVol.setInstanceId(null); newVol.setChainInfo(null); newVol.setPath(null); newVol.setFolder(folder); newVol.setPodId(pool.getPodId()); newVol.setPoolId(pool.getId()); newVol.setLastPoolId(lastPoolId); newVol.setPodId(pool.getPodId()); return volDao.persist(newVol); }
public VolumeTO(Volume volume, StoragePool pool) { this.id = volume.getId(); this.name = volume.getName(); this.path = volume.getPath(); this.size = volume.getSize(); this.type = volume.getVolumeType(); this.storagePoolType = pool.getPoolType(); this.storagePoolUuid = pool.getUuid(); this.mountPoint = volume.getFolder(); this.chainInfo = volume.getChainInfo(); this.chainSize = volume.getVmSnapshotChainSize(); if (volume.getDeviceId() != null) this.deviceId = volume.getDeviceId(); }
if (destPool.getPoolType() == StoragePoolType.SMB && folder != null && folder.contains("?")) { folder = folder.substring(0, folder.indexOf("?"));