use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class DataCenterListModel method updateDetailsAvailability.
@Override
protected void updateDetailsAvailability() {
super.updateDetailsAvailability();
if (getSelectedItem() != null) {
StoragePool storagePool = getSelectedItem();
quotaListModel.setIsAvailable(storagePool.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
updateIscsiBondListAvailability(storagePool);
}
}
use of org.ovirt.engine.core.common.businessentities.StoragePool 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.StoragePool in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method doInit.
protected void doInit() {
final StoragePool dataCenter = getStoragePool();
if (dataCenter == null) {
return;
}
setStoragePool(dataCenter);
getClusterQuota().setIsAvailable(dataCenter.getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED);
getCluster().getSelectedItemChangedEvent().addListener(clusterChangedListener);
// get cluster
getCluster().setItems(null);
AsyncDataProvider.getInstance().getVnicProfilesByDcId(new AsyncQuery<>(returnValue -> {
networkProfiles = returnValue;
initNetworksList();
initClusterAndStorage(dataCenter);
}), dataCenter.getId());
}
use of org.ovirt.engine.core.common.businessentities.StoragePool 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);
}
use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.
the class ImportVmsModel method initDataCenters.
private void initDataCenters() {
getDataCenters().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
clearVms();
exportDomain.setEntity(null);
loadProviders();
StoragePool dataCenter = dataCenters.getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, new IdQueryParameters(dataCenter.getId()), new AsyncQuery<>(createGetStorageDomainsByStoragePoolIdCallback()));
});
dataCenters.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() {
@Override
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> {
List<VDS> upHosts = filterUpHosts(hosts);
proxyHosts.setItems(addAnyHostInCluster(upHosts));
xenProxyHosts.setItems(addAnyHostInCluster(upHosts));
kvmProxyHosts.setItems(addAnyHostInCluster(upHosts));
ImportVmsModel.this.hosts.setItems(upHosts);
stopProgress();
}), dataCenters.getSelectedItem().getId());
}
private List<VDS> filterUpHosts(List<VDS> hosts) {
List<VDS> result = new ArrayList<>();
for (VDS host : hosts) {
if (host.getStatus() == VDSStatus.Up) {
result.add(host);
}
}
return result;
}
private List<VDS> addAnyHostInCluster(List<VDS> hosts) {
List<VDS> result = new ArrayList<>(hosts);
// Any host in the cluster
result.add(0, null);
return result;
}
});
AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery<>(returnValue -> {
List<StoragePool> dataCenters = new ArrayList<>();
for (StoragePool a : returnValue) {
if (a.getStatus() == StoragePoolStatus.Up) {
dataCenters.add(a);
}
}
if (dataCenters.isEmpty()) {
getDataCenters().setIsChangeable(false);
getImportSources().setIsChangeable(false);
setError(constants.notAvailableWithNoUpDC());
stopProgress();
return;
}
Collections.sort(dataCenters, new NameableComparator());
ImportVmsModel.this.dataCenters.setItems(dataCenters);
}));
}
Aggregations