use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class AbstractVmPopupWidget method getDefaultEmulatedMachineLabel.
private String getDefaultEmulatedMachineLabel() {
Cluster cluster = getModel().getSelectedCluster();
String newClusterEmulatedMachine = constants.clusterDefaultOption();
if (cluster != null) {
// $NON-NLS-1$
String emulatedMachine = (cluster.getEmulatedMachine() == null) ? "" : cluster.getEmulatedMachine();
// $NON-NLS-1$ //$NON-NLS-2$
newClusterEmulatedMachine += "(" + emulatedMachine + ")";
}
return newClusterEmulatedMachine;
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterGuideModel method onAddDataCenter.
public void onAddDataCenter() {
@SuppressWarnings("unchecked") ListModel<EntityModel<StoragePool>> dataCentersModel = (ListModel<EntityModel<StoragePool>>) getWindow();
EntityModel<StoragePool> dataCenter = dataCentersModel.getSelectedItem();
if (dataCenter != null) {
Cluster cluster = getEntity();
cluster.setStoragePoolId(dataCenter.getEntity().getId());
dataCentersModel.startProgress();
Frontend.getInstance().runAction(ActionType.UpdateCluster, new ManagementNetworkOnClusterOperationParameters(cluster), result -> {
if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
// Succeeded, close this window.
ClusterGuideModel guideModel = (ClusterGuideModel) result.getState();
guideModel.postAction();
}
// Close popup window.
setWindow(null);
}, this);
} else {
setWindow(null);
}
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeClusterTitle());
model.setHelpTag(HelpTag.remove_cluster);
// $NON-NLS-1$
model.setHashName("remove_cluster");
ArrayList<String> list = new ArrayList<>();
for (Cluster a : getSelectedItems()) {
list.add(a.getName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method onResetClusterEmulatedMachine.
public void onResetClusterEmulatedMachine() {
final ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> prms = new ArrayList<>();
for (Cluster cluster : getSelectedItems()) {
ManagementNetworkOnClusterOperationParameters currentParam = new ManagementNetworkOnClusterOperationParameters(cluster);
currentParam.setForceResetEmulatedMachine(true);
prms.add(currentParam);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.UpdateCluster, prms, result -> {
model.stopProgress();
cancel();
});
}
use of org.ovirt.engine.core.common.businessentities.Cluster in project ovirt-engine by oVirt.
the class ClusterListModel method onSaveInternalWithModel.
private void onSaveInternalWithModel(final ClusterModel model) {
Cluster cluster = buildCluster(model, model.getIsNew() ? new Cluster() : (Cluster) Cloner.clone(getSelectedItem()));
model.startProgress();
final Network managementNetwork = model.getManagementNetwork().getSelectedItem();
final ManagementNetworkOnClusterOperationParameters clusterOperationParameters = new ManagementNetworkOnClusterOperationParameters(cluster, managementNetwork.getId());
final ActionType actionType = model.getIsNew() ? ActionType.AddCluster : ActionType.UpdateCluster;
Frontend.getInstance().runAction(actionType, clusterOperationParameters, result -> {
ClusterListModel<Void> localModel = (ClusterListModel<Void>) result.getState();
if (model.getIsImportGlusterConfiguration().getEntity()) {
localModel.postOnSaveInternalWithImport(result.getReturnValue());
} else {
localModel.postOnSaveInternal(result.getReturnValue());
}
}, this);
}
Aggregations