use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class DiskProfileBaseModel method flush.
@Override
public void flush() {
if (getProfile() == null) {
setProfile(new DiskProfile());
}
DiskProfile diskProfile = getProfile();
diskProfile.setName(getName().getEntity());
diskProfile.setDescription(getDescription().getEntity());
StorageDomain storageDomain = getParentListModel().getSelectedItem();
diskProfile.setStorageDomainId(storageDomain != null ? storageDomain.getId() : null);
StorageQos storageQos = getQos().getSelectedItem();
diskProfile.setQosId(storageQos != null && storageQos.getId() != null && !storageQos.getId().equals(Guid.Empty) ? storageQos.getId() : null);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportRepoImageModel method filterStorageDomains.
@Override
protected List<StorageDomain> filterStorageDomains(List<StorageDomain> storageDomains) {
List<StorageDomain> availableStorageDomains = new ArrayList<>();
// Filtering out domains that are not active
for (StorageDomain storageDomainItem : storageDomains) {
if (Linq.isDataActiveStorageDomain(storageDomainItem)) {
availableStorageDomains.add(storageDomainItem);
}
}
// Sorting by name
Collections.sort(availableStorageDomains, new NameableComparator());
return availableStorageDomains;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportSanStorageModel method getUnregisteredStorageDomains.
protected void getUnregisteredStorageDomains(List<StorageServerConnections> connections) {
VDS vds = getContainer().getHost().getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetUnregisteredBlockStorageDomains, new GetUnregisteredBlockStorageDomainsParameters(vds.getId(), getType(), connections), new AsyncQuery<QueryReturnValue>(returnValue -> {
Pair<List<StorageDomain>, List<StorageServerConnections>> returnValuePair = returnValue.getReturnValue();
ArrayList<StorageDomain> storageDomains = (ArrayList<StorageDomain>) returnValuePair.getFirst();
ArrayList<StorageServerConnections> connections1 = (ArrayList<StorageServerConnections>) returnValuePair.getSecond();
if (storageDomains != null) {
addStorageDomains(storageDomains);
}
postGetUnregisteredStorageDomains(storageDomains, connections1);
}));
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method postInitStorageDomains.
protected void postInitStorageDomains() {
if (getModel().getDisks() == null) {
return;
}
ActionGroup actionGroup = getModel().isCreateInstanceOnly() ? ActionGroup.CREATE_INSTANCE : ActionGroup.CREATE_VM;
StoragePool dataCenter = getModel().getSelectedDataCenter();
AsyncDataProvider.getInstance().getPermittedStorageDomainsByStoragePoolId(new AsyncQuery<>(storageDomains -> {
ArrayList<StorageDomain> activeStorageDomains = filterStorageDomains(storageDomains);
boolean provisioning = getModel().getProvisioning().getEntity();
ArrayList<DiskModel> disks = (ArrayList<DiskModel>) getModel().getDisks();
activeStorageDomains.sort(new NameableComparator());
List<DiskModel> diskImages = Linq.filterDisksByType(disks, DiskStorageType.IMAGE);
for (DiskModel diskModel : diskImages) {
List<StorageDomain> availableDiskStorageDomains;
diskModel.getQuota().setItems(getModel().getQuota().getItems());
List<Guid> storageIds = ((DiskImage) diskModel.getDisk()).getStorageIds();
// Active storage domains that the disk resides on
List<StorageDomain> activeDiskStorageDomains = Linq.getStorageDomainsByIds(storageIds, activeStorageDomains);
// Set target storage domains
availableDiskStorageDomains = provisioning ? activeStorageDomains : activeDiskStorageDomains;
availableDiskStorageDomains.sort(new NameableComparator());
diskModel.getStorageDomain().setItems(availableDiskStorageDomains);
diskModel.getStorageDomain().setChangeProhibitionReason(constants.noActiveTargetStorageDomainAvailableMsg());
diskModel.getStorageDomain().setIsChangeable(!availableDiskStorageDomains.isEmpty());
}
List<DiskModel> cinderDisks = Linq.filterDisksByType(disks, DiskStorageType.CINDER);
Collection<StorageDomain> cinderStorageDomains = Linq.filterStorageDomainsByStorageType(storageDomains, StorageType.CINDER);
initStorageDomainsForCinderDisks(cinderDisks, cinderStorageDomains);
}), dataCenter.getId(), actionGroup);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AddVmCommand method validateSpaceRequirements.
/**
* Check if destination storage has enough space
*/
protected boolean validateSpaceRequirements() {
for (Map.Entry<Guid, List<DiskImage>> sdImageEntry : storageToDisksMap.entrySet()) {
StorageDomain destStorageDomain = destStorages.get(sdImageEntry.getKey());
List<DiskImage> disksList = sdImageEntry.getValue();
StorageDomainValidator storageDomainValidator = createStorageDomainValidator(destStorageDomain);
if (!validateDomainsThreshold(storageDomainValidator) || !validateFreeSpace(storageDomainValidator, disksList)) {
return false;
}
}
return true;
}
Aggregations