@Override public Boolean fenceOff(VirtualMachine vm, Host host) { VirtualMachine.Type type = vm.getType(); if (type != VirtualMachine.Type.ConsoleProxy && type != VirtualMachine.Type.DomainRouter && type != VirtualMachine.Type.SecondaryStorageVm) { if (s_logger.isDebugEnabled()) { s_logger.debug("Don't know how to fence off " + type); } return null; } List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); for (VolumeVO vol : vols) { if (!vol.isRecreatable()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Unable to fence off volumes that are not recreatable: " + vol); } return null; } if (vol.getPoolType().isShared()) { if (s_logger.isDebugEnabled()) { s_logger.debug("Unable to fence off volumes that are shared: " + vol); } return null; } } return true; } }
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());
private ModifyTargetsCommand getModifyTargetsCommand(long storagePoolId, String iqn, boolean add) { StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId); Map<String, String> details = new HashMap<>(); details.put(ModifyTargetsCommand.IQN, iqn); details.put(ModifyTargetsCommand.STORAGE_TYPE, storagePool.getPoolType().name()); details.put(ModifyTargetsCommand.STORAGE_UUID, storagePool.getUuid()); details.put(ModifyTargetsCommand.STORAGE_HOST, storagePool.getHostAddress()); details.put(ModifyTargetsCommand.STORAGE_PORT, String.valueOf(storagePool.getPort())); ModifyTargetsCommand cmd = new ModifyTargetsCommand(); List<Map<String, String>> targets = new ArrayList<>(); targets.add(details); cmd.setTargets(targets); cmd.setApplyToAllHostsInCluster(true); cmd.setAdd(add); cmd.setTargetTypeToRemove(ModifyTargetsCommand.TargetTypeToRemove.DYNAMIC); return cmd; }
if(!pool.getPoolType().supportsOverProvisioning() ) { throw new InvalidParameterValueException("Unable to update storage pool with id " + resourceId + ". Overprovision not supported for " + pool.getPoolType());
NfsTO nfsStore = (NfsTO)data.getDataStore(); dataStoreUrl = nfsStore.getUrl(); } else if (dataStore instanceof PrimaryDataStoreTO && ((PrimaryDataStoreTO) dataStore).getPoolType().equals(StoragePoolType.NetworkFilesystem)) { final KVMPhysicalDisk physicalDisk = _storagePoolMgr.getPhysicalDisk(store.getPoolType(), store.getUuid(), data.getPath()); final KVMStoragePool pool = physicalDisk.getPool(); if(StoragePoolType.RBD.equals(pool.getType())) { final int devId = volume.getDiskSeq().intValue(); final String device = mapRbdDevice(physicalDisk);
details.put(DiskTO.IQN, volumeToAttach.get_iScsiName()); details.put(DiskTO.MOUNT_POINT, volumeToAttach.get_iScsiName()); details.put(DiskTO.PROTOCOL_TYPE, (volumeToAttach.getPoolType() != null) ? volumeToAttach.getPoolType().toString() : null);
@Override public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type) { s_logger.info("Attempting to create storage pool " + name + " (" + type.toString() + ") in libvirt");
" (" + destPool.getType().toString() + ") with size " + size);
params.put("clusterId", host.getClusterId()); params.put("podId", host.getPodId()); params.put("url", pInfo.getPoolType().toString() + "://" + pInfo.getHost() + "/" + pInfo.getHostPath()); params.put("name", name); params.put("localStorage", true);
poolResponse.setZoneId(pool.getZoneUuid()); poolResponse.setZoneName(pool.getZoneName()); poolResponse.setType(pool.getPoolType().toString()); poolResponse.setPodId(pool.getPodUuid()); poolResponse.setPodName(pool.getPodName());
primaryPool.getType().toString() + " pool."); } catch (RbdException e) { s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() + s_logger.warn("Operation not implemented for storage pool type of " + primaryPool.getType().toString()); throw new InternalErrorException("Operation not implemented for storage pool type of " + primaryPool.getType().toString());
if (storagePool.getPoolType().supportsOverProvisioning()) { s_logger.debug("Found storage pool " + storagePool.getName() + " of type " + storagePool.getPoolType().toString() + " with overprovisioning factor " + overProvFactor.toString()); s_logger.debug("Total over provisioned capacity calculated is " + overProvFactor + " * " + storagePool.getCapacityBytes()); } else { s_logger.debug("Found storage pool " + storagePool.getName() + " of type " + storagePool.getPoolType().toString()); totalOverProvCapacity = storagePool.getCapacityBytes();
} else { return new Answer(cmd, false, "The pool type: " + pool.getType().name() + " is not supported.");
poolResponse.setZoneName(pool.getZoneName()); if (pool.getPoolType() != null) { poolResponse.setType(pool.getPoolType().toString());
details.put(NexentaUtil.SPARSE_VOLUMES, params.isSparseVolumes().toString()); details.put(NexentaUtil.STORAGE_TYPE, params.getStorageType().toString()); details.put(NexentaUtil.STORAGE_HOST, params.getStorageHost()); details.put(NexentaUtil.STORAGE_PORT, params.getStoragePort().toString());
+ pool.getType().name() + " is not supported."); } catch (Exception e) { LOGGER.debug("ModifyStoragePoolCommand failed", e);
StoragePoolType storagePoolType = StoragePoolType.valueOf(target.get(ModifyTargetsCommand.STORAGE_TYPE)); String storageUuid = target.get(ModifyTargetsCommand.STORAGE_UUID); String path = target.get(ModifyTargetsCommand.IQN);
} else if (pool.getType() == StoragePoolType.PreSetup) { } else { return new Answer(command, false, "The pool type: " + pool.getType().name() + " is not supported.");
public KVMStoragePoolManager(StorageLayer storagelayer, KVMHAMonitor monitor) { this._haMonitor = monitor; this._storageMapper.put("libvirt", new LibvirtStorageAdaptor(storagelayer)); // add other storage adaptors here // this._storageMapper.put("newadaptor", new NewStorageAdaptor(storagelayer)); this._storageMapper.put(StoragePoolType.ManagedNFS.toString(), new ManagedNfsStorageAdaptor(storagelayer)); // add any adaptors that wish to register themselves via annotation Reflections reflections = new Reflections("com.cloud.hypervisor.kvm.storage"); Set<Class<? extends StorageAdaptor>> storageAdaptors = reflections.getSubTypesOf(StorageAdaptor.class); for (Class<? extends StorageAdaptor> storageAdaptor : storageAdaptors) { StorageAdaptorInfo info = storageAdaptor.getAnnotation(StorageAdaptorInfo.class); if (info != null && info.storagePoolType() != null) { if (this._storageMapper.containsKey(info.storagePoolType().toString())) { s_logger.error("Duplicate StorageAdaptor type " + info.storagePoolType().toString() + ", not loading " + storageAdaptor.getName()); } else { try { this._storageMapper.put(info.storagePoolType().toString(), storageAdaptor.newInstance()); } catch (Exception ex) { throw new CloudRuntimeException(ex.toString()); } } } } for (Map.Entry<String, StorageAdaptor> adaptors : this._storageMapper.entrySet()) { s_logger.debug("Registered a StorageAdaptor for " + adaptors.getKey()); } }