use of org.ovirt.engine.core.common.businessentities.Cluster 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.Cluster 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);
}));
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class UnitVmModel method updateMigrationOptions.
private void updateMigrationOptions() {
DataCenterWithCluster dataCenterWithCluster = getDataCenterWithClustersList().getSelectedItem();
if (dataCenterWithCluster == null) {
return;
}
Cluster cluster = dataCenterWithCluster.getCluster();
Version version = getCompatibilityVersion();
// test migration support for VM/cluster level along with the cluster architecture
Boolean isMigrationSupported = AsyncDataProvider.getInstance().isMigrationSupported(cluster.getArchitecture(), version);
if (isMigrationSupported && getVmType().getSelectedItem() != VmType.HighPerformance) {
getMigrationMode().setItems(Arrays.asList(MigrationSupport.values()));
} else {
getMigrationMode().setItems(Arrays.asList(MigrationSupport.PINNED_TO_HOST));
}
autoConverge.setIsChangeable(true);
migrateCompressed.setIsChangeable(true);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class UnitVmModel method validateMemoryAlignment.
private void validateMemoryAlignment(EntityModel<Integer> model) {
if (!model.getIsValid()) {
return;
}
int memSize = model.getEntity();
DataCenterWithCluster dataCenterWithCluster = getDataCenterWithClustersList().getSelectedItem();
if (dataCenterWithCluster == null) {
return;
}
Cluster cluster = dataCenterWithCluster.getCluster();
ArchitectureType architectureFamily = cluster.getArchitecture().getFamily();
if (architectureFamily == ArchitectureType.ppc && memSize % 256 != 0) {
model.getInvalidityReasons().add(ConstantsManager.getInstance().getMessages().memSizeMultipleOf(architectureFamily.toString(), 256));
model.setIsValid(false);
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class UnitVmModel method getCompatibilityVersion.
public Version getCompatibilityVersion() {
ListModel<Version> customCompatibilityVersion = getCustomCompatibilityVersion();
if (customCompatibilityVersion != null && customCompatibilityVersion.getSelectedItem() != null) {
return customCompatibilityVersion.getSelectedItem();
}
Cluster cluster = getSelectedCluster();
if (cluster != null) {
return cluster.getCompatibilityVersion();
}
return null;
}
Aggregations