use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class DataCenterGuideModel method updateOptionsNonLocalFS.
private void updateOptionsNonLocalFS() {
if (clusters == null || allStorageDomains == null || attachedStorageDomains == null || isoStorageDomains == null || allHosts == null) {
return;
}
updateAddClusterAvailability();
Set<Guid> clusterIds = clusters.stream().map(Cluster::getId).collect(Collectors.toSet());
List<VDS> hosts = allHosts.stream().filter(h -> clusterIds.contains(h.getClusterId())).collect(Collectors.toList());
List<VDS> upHosts = hosts.stream().filter(v -> v.getStatus() == VDSStatus.Up).collect(Collectors.toList());
List<VDS> availableHosts = allHosts.stream().filter(v -> v.getStatus() == VDSStatus.Maintenance || v.getStatus() == VDSStatus.PendingApproval).filter(v -> doesHostSupportAnyCluster(clusters, v)).collect(Collectors.toList());
updateAddAndSelectHostAvailability(hosts, availableHosts);
List<StorageDomain> unattachedStorages = getUnattachedStorages();
List<StorageDomain> attachedDataStorages = new ArrayList<>();
List<StorageDomain> attachedIsoStorages = new ArrayList<>();
for (StorageDomain sd : attachedStorageDomains) {
if (sd.getStorageDomainType().isDataDomain()) {
attachedDataStorages.add(sd);
} else if (sd.getStorageDomainType() == StorageDomainType.ISO) {
attachedIsoStorages.add(sd);
}
}
updateAddAndAttachDataDomainAvailability(upHosts, unattachedStorages, attachedDataStorages);
updateAddAndAttachIsoDomainAvailability(upHosts, attachedDataStorages, attachedIsoStorages);
stopProgress();
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class VolumeModel method addBricks.
public void addBricks() {
if (getWindow() != null || getCluster().getSelectedItem() == null) {
return;
}
final VolumeBrickModel volumeBrickModel = new VolumeBrickModel();
volumeBrickModel.getVolumeType().setEntity(getTypeList().getSelectedItem());
volumeBrickModel.getReplicaCount().setEntity(getReplicaCount().getEntity());
volumeBrickModel.getReplicaCount().setIsChangeable(true);
volumeBrickModel.getReplicaCount().setIsAvailable(getReplicaCount().getIsAvailable());
volumeBrickModel.getStripeCount().setEntity(getStripeCount().getEntity());
volumeBrickModel.getStripeCount().setIsChangeable(true);
volumeBrickModel.getStripeCount().setIsAvailable(getStripeCount().getIsAvailable());
Cluster cluster = getCluster().getSelectedItem();
if (cluster != null) {
volumeBrickModel.getForce().setIsAvailable(true);
volumeBrickModel.getForce().setEntity(isForceAddBricks());
volumeBrickModel.setIsBrickProvisioningSupported();
}
setWindow(volumeBrickModel);
volumeBrickModel.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
volumeBrickModel.setHelpTag(HelpTag.add_bricks);
// $NON-NLS-1$
volumeBrickModel.setHashName("add_bricks");
AsyncDataProvider.getInstance().getHostListByCluster(volumeBrickModel.asyncQuery(hostList -> {
Iterator<VDS> iterator = hostList.iterator();
while (iterator.hasNext()) {
if (iterator.next().getStatus() != VDSStatus.Up) {
iterator.remove();
}
}
volumeBrickModel.setHostList(hostList);
}), getCluster().getSelectedItem().getName());
// TODO: fetch the mount points to display
if (getBricks().getItems() != null) {
volumeBrickModel.getBricks().setItems(getBricks().getItems());
} else {
volumeBrickModel.getBricks().setItems(new ArrayList<EntityModel<GlusterBrickEntity>>());
}
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("OnAddBricks", this);
volumeBrickModel.getCommands().add(command);
// $NON-NLS-1$
volumeBrickModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class VolumeModel method clusterSelectedItemChanged.
private void clusterSelectedItemChanged() {
setBricks(new ListModel<EntityModel<GlusterBrickEntity>>());
if (getCluster().getSelectedItem() != null) {
final Cluster cluster = getCluster().getSelectedItem();
updateArbiterAvailability();
updateDefaults();
AsyncDataProvider.getInstance().isAnyHostUpInCluster(new AsyncQuery<>(returnValue -> {
// In case the result of previous call is returned after selecting some other cluster
if (!getCluster().getSelectedItem().getId().equals(cluster.getId())) {
return;
}
if (returnValue) {
getAddBricksCommand().setIsExecutionAllowed(true);
setMessage(null);
} else {
getAddBricksCommand().setIsExecutionAllowed(false);
setMessage(ConstantsManager.getInstance().getConstants().volumeEmptyClusterValidationMsg());
}
}), cluster.getName());
} else {
getAddBricksCommand().setIsExecutionAllowed(false);
setMessage(null);
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigModel method clusterSelectedItemChanged.
private void clusterSelectedItemChanged() {
Cluster selectedCluster = getClusters().getSelectedItem();
if (selectedCluster == null) {
return;
}
AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue returnValue) {
Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = returnValue.getReturnValue();
if (configs != null) {
List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst();
Collections.sort(clusterConfigOptions, Comparator.comparing(GlusterVolumeSnapshotConfig::getParamName));
setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs);
} else {
getClusterConfigOptions().setItems(null);
}
}
private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) {
List<EntityModel<GlusterVolumeSnapshotConfig>> coll = new ArrayList<>();
for (GlusterVolumeSnapshotConfig cfg : cfgs) {
EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<>();
cfgModel.setEntity(cfg);
fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue());
coll.add(cfgModel);
}
// set the entity items
listModel.setItems(coll);
}
}), selectedCluster.getId(), null);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class NewNetworkModel method onGetClusterList.
protected void onGetClusterList(List<Cluster> clusterList) {
// Cluster list
List<NetworkClusterModel> items = new ArrayList<>();
for (Cluster cluster : clusterList) {
items.add(createNetworkClusterModel(cluster));
}
getNetworkClusterList().setItems(items);
selectExternalProviderBasedOnCluster();
}
Aggregations