use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onDetach.
public void onDetach() {
final ConfirmationModel confirmModel = (ConfirmationModel) getWindow();
if (confirmModel.getProgress() != null) {
return;
}
if (!confirmModel.validate()) {
return;
}
// A list of 'detach' action parameters
setDetachParams(new ArrayList<>());
// A list of 'remove' action parameters
setRemoveParams(new ArrayList<>());
String localStorgaeDC = null;
for (StorageDomain a : getSelectedItems()) {
// For local storage - remove; otherwise - detach
if (a.getStorageType() == StorageType.LOCALFS && a.getStorageDomainType() != StorageDomainType.ISO) {
getRemoveParams().add(new RemoveStorageDomainParameters(a.getId()));
localStorgaeDC = a.getStoragePoolName();
} else {
getDetachParams().add(new DetachStorageDomainFromPoolParameters(a.getId(), getEntity().getId()));
}
}
confirmModel.startProgress();
if (getRemoveParams().size() > 0) {
AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
for (ActionParametersBase item : getRemoveParams()) {
((RemoveStorageDomainParameters) item).setVdsId(locaVds != null ? locaVds.getId() : null);
((RemoveStorageDomainParameters) item).setDoFormat(confirmModel.getForce().getEntity());
}
postDetach(getWindow());
}), localStorgaeDC);
} else {
postDetach(confirmModel);
}
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportVmFromExportDomainModel method doInit.
protected void doInit() {
StoragePool dataCenter = getStoragePool();
if (dataCenter == null) {
return;
}
getClusterQuota().setIsAvailable(dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
getCluster().getSelectedItemChangedEvent().addListener(clusterChangedListener);
// get cluster
getCluster().setItems(null);
AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
ArchitectureType targetArch = getTargetArchitecture();
if (targetArch != null) {
List<Cluster> filteredClusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
getCluster().setItems(filteredClusters);
getCluster().setSelectedItem(Linq.firstOrNull(filteredClusters));
} else {
getCluster().setItems(clusters);
getCluster().setSelectedItem(Linq.firstOrNull(clusters));
}
// get storage domains
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
// filter storage domains
filteredStorageDomains = new ArrayList<>();
for (StorageDomain domain : storageDomains) {
if (Linq.isDataActiveStorageDomain(domain)) {
filteredStorageDomains.add(domain);
}
}
if (getClusterQuota().getIsAvailable()) {
initQuotaForStorageDomains();
} else {
initDisksStorageDomainsList();
}
}), getStoragePool().getId());
}), dataCenter.getId(), true, false);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method initQuotaForStorageDomains.
private void initQuotaForStorageDomains() {
List<QueryType> queryTypeList = new ArrayList<>();
List<QueryParametersBase> queryParamsList = new ArrayList<>();
for (StorageDomain storage : getStorage().getItems()) {
queryTypeList.add(QueryType.GetAllRelevantQuotasForStorage);
queryParamsList.add(new IdQueryParameters(storage.getId()));
}
storageQuotaMap = new HashMap<>();
Frontend.getInstance().runMultipleQueries(queryTypeList, queryParamsList, result -> {
Iterator<QueryReturnValue> returnValuesIter = result.getReturnValues().iterator();
Iterator<StorageDomain> domainsIter = getStorage().getItems().iterator();
boolean noQuota = true;
while (domainsIter.hasNext()) {
ArrayList<Quota> quotaList = returnValuesIter.next().getReturnValue();
noQuota = noQuota && quotaList.isEmpty();
storageQuotaMap.put(domainsIter.next().getId(), quotaList);
}
if (noQuota && QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(storagePool.getQuotaEnforcementType())) {
showCloseMessage(ConstantsManager.getInstance().getConstants().missingQuotaStorageEnforceMode());
}
initDisksStorageDomainsList();
});
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method initDisksStorageDomainsList.
protected void initDisksStorageDomainsList() {
for (Object item : getItems()) {
ImportVmData importVmData = (ImportVmData) item;
VM vm = importVmData.getVm();
for (Disk disk : vm.getDiskMap().values()) {
DiskImage diskImage = (DiskImage) disk;
addDiskImportData(diskImage.getDiskAlias(), new ArrayList<StorageDomain>(), diskImage.getVolumeType(), importVmData.getCollapseSnapshots());
}
}
initIsoImages();
postInitDisks();
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method initClusterAndStorage.
private void initClusterAndStorage(StoragePool dataCenter) {
AsyncDataProvider.getInstance().getClusterByServiceList(new AsyncQuery<>(clusters -> {
ArchitectureType targetArch = getTargetArchitecture();
if (targetArch != null) {
clusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, targetArch);
}
getCluster().setItems(clusters);
getCluster().setSelectedItem(Linq.firstOrNull(clusters));
// get storage domains
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
// filter storage domains
List<StorageDomain> filteredStorageDomains = new ArrayList<>();
for (StorageDomain domain : storageDomains) {
if (Linq.isDataActiveStorageDomain(domain)) {
filteredStorageDomains.add(domain);
}
}
getStorage().setItems(filteredStorageDomains);
if (getClusterQuota().getIsAvailable()) {
initQuotaForStorageDomains();
} else {
initDisksStorageDomainsList();
}
}), getStoragePool().getId());
}), dataCenter.getId(), true, false);
}
Aggregations