use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class JsonObjectSerializationEntitiesTest method randomStorageDomainStatic.
private static StorageDomainStatic randomStorageDomainStatic() {
RandomUtils random = RandomUtils.instance();
StorageDomainStatic sds = new StorageDomainStatic();
sds.setId(Guid.newGuid());
sds.setStorage(random.nextString(10));
sds.setStorageType(random.nextEnum(StorageType.class));
sds.setStorageName(random.nextString(10));
sds.setDescription(random.nextString(10));
sds.setWarningLowSpaceIndicator(5);
sds.setCriticalSpaceActionBlocker(10);
return sds;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class DataCenterGuideModel method savePosixStorage.
private void savePosixStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
PosixStorageModel posixModel = (PosixStorageModel) storageModel;
path = posixModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewPosixStorage();
}
}), null, path);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNfsStorage.
private void saveNfsStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
NfsStorageModel nfsModel = (NfsStorageModel) storageModel;
path = nfsModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
storageDomain.setStorageFormat(model.getFormat().getSelectedItem());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewNfsStorage();
}
}), null, path);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveLocalStorage.
private void saveLocalStorage(final TaskContext context) {
this.context = context;
StorageModel model = (StorageModel) getWindow();
VDS host = model.getHost().getSelectedItem();
boolean isNew = model.getStorage() == null;
storageModel = model.getCurrentStorageItem();
LocalStorageModel localModel = (LocalStorageModel) storageModel;
path = localModel.getPath().getEntity();
storageDomain = new StorageDomainStatic();
storageDomain.setStorageType(isNew ? storageModel.getType() : storageDomain.getStorageType());
storageDomain.setStorageDomainType(isNew ? storageModel.getRole() : storageDomain.getStorageDomainType());
storageDomain.setStorageName(model.getName().getEntity());
AsyncDataProvider.getInstance().getStorageDomainsByConnection(new AsyncQuery<>(storages -> {
if (storages != null && storages.size() > 0) {
String storageName = storages.get(0).getStorageName();
onFinish(context, false, storageModel, ConstantsManager.getInstance().getMessages().createOperationFailedDcGuideMsg(storageName));
} else {
saveNewLocalStorage();
}
}), host.getStoragePoolId(), path);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class ExportVmCommand method buildMoveOrCopyImageGroupParametersForMemoryDumpImage.
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, DiskImage disk) {
MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, disk.getId(), disk.getImageId(), getParameters().getStorageDomainId(), ImageOperation.Copy);
StorageDomainStatic sourceDomain = storageDomainStaticDao.get(disk.getStorageIds().get(0));
// so we need to use copy collapse in order to convert it to be sparsed in the export domain
if (sourceDomain.getStorageType().isBlockDomain()) {
params.setUseCopyCollapse(true);
params.setVolumeType(VolumeType.Sparse);
params.setVolumeFormat(VolumeFormat.RAW);
}
return params;
}
Aggregations