use of com.cloud.storage.VolumeDetailVO in project cloudstack by apache.
the class SolidFireIntegrationTestManagerImpl method getSolidFireVolumeSize.
@Override
public long getSolidFireVolumeSize(String volumeUuid) {
VolumeVO volume = volumeDao.findByUuid(volumeUuid);
VolumeDetailVO volumeDetail = volumeDetailsDao.findDetail(volume.getId(), SolidFireUtil.VOLUME_SIZE);
if (volumeDetail != null && volumeDetail.getValue() != null) {
return Long.parseLong(volumeDetail.getValue());
}
throw new CloudRuntimeException("Unable to determine the size of the SolidFire volume");
}
use of com.cloud.storage.VolumeDetailVO in project cloudstack by apache.
the class XenServerStorageMotionStrategy method handleManagedVolumePreMigration.
/**
* 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;
}
use of com.cloud.storage.VolumeDetailVO in project cloudstack by apache.
the class XenServerStorageMotionStrategy method handleManagedVolumePostMigration.
private void handleManagedVolumePostMigration(VolumeInfo volumeInfo, Host srcHost, VolumeObjectTO volumeTO) {
final Map<String, String> details = new HashMap<>();
details.put(DeleteStoragePoolCommand.DATASTORE_NAME, volumeInfo.get_iScsiName());
final DeleteStoragePoolCommand cmd = new DeleteStoragePoolCommand();
cmd.setDetails(details);
cmd.setRemoveDatastore(true);
final Answer answer = agentMgr.easySend(srcHost.getId(), 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);
}
final PrimaryDataStoreDriver pdsd = (PrimaryDataStoreDriver) volumeInfo.getDataStore().getDriver();
pdsd.revokeAccess(volumeInfo, srcHost, volumeInfo.getDataStore());
VolumeDetailVO volumeDetailVo = new VolumeDetailVO(volumeInfo.getId(), PrimaryDataStoreDriver.BASIC_DELETE, Boolean.TRUE.toString(), false);
volumeDetailsDao.persist(volumeDetailVo);
pdsd.deleteAsync(volumeInfo.getDataStore(), volumeInfo, null);
VolumeVO volumeVO = volDao.findById(volumeInfo.getId());
volumeVO.setPath(volumeTO.getPath());
volDao.update(volumeVO.getId(), volumeVO);
}
use of com.cloud.storage.VolumeDetailVO in project cloudstack by apache.
the class XenServerStorageMotionStrategy method handleManagedVolumesAfterFailedMigration.
private void handleManagedVolumesAfterFailedMigration(Map<VolumeInfo, DataStore> volumeToPool, Host destHost) {
for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
VolumeInfo volumeInfo = entry.getKey();
StoragePool storagePool = storagePoolDao.findById(volumeInfo.getPoolId());
if (storagePool.isManaged()) {
final Map<String, String> details = new HashMap<>();
details.put(DeleteStoragePoolCommand.DATASTORE_NAME, getBasicIqn(volumeInfo.getId()));
final DeleteStoragePoolCommand cmd = new DeleteStoragePoolCommand();
cmd.setDetails(details);
cmd.setRemoveDatastore(true);
final Answer answer = agentMgr.easySend(destHost.getId(), cmd);
if (answer == null || !answer.getResult()) {
String errMsg = "Error interacting with host (related to handleManagedVolumesAfterFailedMigration)" + (StringUtils.isNotBlank(answer.getDetails()) ? ": " + answer.getDetails() : "");
s_logger.error(errMsg);
// regardless of the success or lack thereof concerning this method
return;
}
final PrimaryDataStoreDriver pdsd = (PrimaryDataStoreDriver) volumeInfo.getDataStore().getDriver();
VolumeDetailVO volumeDetailVo = new VolumeDetailVO(volumeInfo.getId(), PrimaryDataStoreDriver.BASIC_REVOKE_ACCESS, Boolean.TRUE.toString(), false);
volumeDetailsDao.persist(volumeDetailVo);
pdsd.revokeAccess(volumeInfo, destHost, volumeInfo.getDataStore());
volumeDetailVo = new VolumeDetailVO(volumeInfo.getId(), PrimaryDataStoreDriver.BASIC_DELETE_FAILURE, Boolean.TRUE.toString(), false);
volumeDetailsDao.persist(volumeDetailVo);
pdsd.deleteAsync(volumeInfo.getDataStore(), volumeInfo, null);
}
}
}
use of com.cloud.storage.VolumeDetailVO in project cloudstack by apache.
the class SolidFirePrimaryDataStoreDriver method addBasicCreateInfoToVolumeDetails.
private void addBasicCreateInfoToVolumeDetails(long volumeId, SolidFireUtil.SolidFireVolume sfVolume) {
VolumeDetailVO volumeDetailVo = new VolumeDetailVO(volumeId, BASIC_SF_ID, String.valueOf(sfVolume.getId()), false);
volumeDetailsDao.persist(volumeDetailVo);
volumeDetailVo = new VolumeDetailVO(volumeId, BASIC_IQN, sfVolume.getIqn(), false);
volumeDetailsDao.persist(volumeDetailVo);
}
Aggregations