public ModifyStoragePoolCommand(boolean add, StoragePool pool) { this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); }
public DeleteStoragePoolCommand(StoragePool pool) { this(pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes())); }
@Override public void removeStoragePoolFromCluster(long hostId, String iScsiName, StoragePool storagePool) { final Map<String, String> details = new HashMap<>(); details.put(DeleteStoragePoolCommand.DATASTORE_NAME, iScsiName); details.put(DeleteStoragePoolCommand.IQN, iScsiName); details.put(DeleteStoragePoolCommand.STORAGE_HOST, storagePool.getHostAddress()); details.put(DeleteStoragePoolCommand.STORAGE_PORT, String.valueOf(storagePool.getPort())); final DeleteStoragePoolCommand cmd = new DeleteStoragePoolCommand(); cmd.setDetails(details); cmd.setRemoveDatastore(true); final Answer answer = _agentMgr.easySend(hostId, cmd); if (answer == null || !answer.getResult()) { String errMsg = "Error interacting with host (related to DeleteStoragePoolCommand)" + (StringUtils.isNotBlank(answer.getDetails()) ? ": " + answer.getDetails() : ""); s_logger.error(errMsg); throw new CloudRuntimeException(errMsg); } }
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(); }
/** * Tell the underlying storage plug-in to create a new volume, put it in the VAG of the destination cluster, and * send a command to the destination cluster to create an SR and to attach to the SR from all hosts in the cluster. */ private String handleManagedVolumePreMigration(VolumeInfo volumeInfo, StoragePool storagePool, Host destHost) { final PrimaryDataStoreDriver pdsd = (PrimaryDataStoreDriver)volumeInfo.getDataStore().getDriver(); VolumeDetailVO volumeDetailVo = new VolumeDetailVO(volumeInfo.getId(), PrimaryDataStoreDriver.BASIC_CREATE, Boolean.TRUE.toString(), false); volumeDetailsDao.persist(volumeDetailVo); pdsd.createAsync(volumeInfo.getDataStore(), volumeInfo, null); volumeDetailVo = new VolumeDetailVO(volumeInfo.getId(), PrimaryDataStoreDriver.BASIC_GRANT_ACCESS, Boolean.TRUE.toString(), false); volumeDetailsDao.persist(volumeDetailVo); pdsd.grantAccess(volumeInfo, destHost, volumeInfo.getDataStore()); final Map<String, String> details = new HashMap<>(); final String iqn = getBasicIqn(volumeInfo.getId()); details.put(CreateStoragePoolCommand.DATASTORE_NAME, iqn); details.put(CreateStoragePoolCommand.IQN, iqn); details.put(CreateStoragePoolCommand.STORAGE_HOST, storagePool.getHostAddress()); details.put(CreateStoragePoolCommand.STORAGE_PORT, String.valueOf(storagePool.getPort())); final CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, storagePool); cmd.setDetails(details); cmd.setCreateDatastore(true); final Answer answer = agentMgr.easySend(destHost.getId(), cmd); if (answer == null || !answer.getResult()) { String errMsg = "Error interacting with host (related to CreateStoragePoolCommand)" + (StringUtils.isNotBlank(answer.getDetails()) ? ": " + answer.getDetails() : ""); s_logger.error(errMsg); throw new CloudRuntimeException(errMsg); } return iqn; }
boolean isLocalPoolSameHostAsSourcePool = pool.isLocal() && StringUtils.equals(host.getPrivateIpAddress(), pool.getHostAddress()); if (isLocalPoolSameHostAsSourcePool || pool.isShared()) { suitablePools.add(pool);
details.put(DiskTO.STORAGE_HOST, destPool.getHostAddress());