use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method updateExistingVm.
private void updateExistingVm(final boolean applyCpuChangesLater) {
final UnitVmModel model = (UnitVmModel) getWindow();
if (model.getProgress() != null) {
return;
}
// runEditVM: should be true if Cluster hasn't changed or if
// Cluster has changed and Editing it in the Backend has succeeded:
VM selectedItem = getSelectedItem();
Guid oldClusterID = selectedItem.getClusterId();
Guid newClusterID = model.getSelectedCluster().getId();
if (!oldClusterID.equals(newClusterID)) {
ChangeVMClusterParameters parameters = new ChangeVMClusterParameters(newClusterID, getcurrentVm().getId(), model.getCustomCompatibilityVersion().getSelectedItem());
model.startProgress();
Frontend.getInstance().runAction(ActionType.ChangeVMCluster, parameters, result -> {
final VmListModel<Void> vmListModel = (VmListModel<Void>) result.getState();
ActionReturnValue returnValueBase = result.getReturnValue();
if (returnValueBase != null && returnValueBase.getSucceeded()) {
VM vm = vmListModel.getcurrentVm();
VmManagementParametersBase updateVmParams = vmListModel.getUpdateVmParameters(applyCpuChangesLater);
Frontend.getInstance().runAction(ActionType.UpdateVm, updateVmParams, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, vm.getId()), vmListModel);
} else {
vmListModel.getWindow().stopProgress();
}
}, this);
} else {
model.startProgress();
VmManagementParametersBase updateVmParams = getUpdateVmParameters(applyCpuChangesLater);
Frontend.getInstance().runAction(ActionType.UpdateVm, updateVmParams, new UnitVmModelNetworkAsyncCallback(model, defaultNetworkCreatingManager, getcurrentVm().getId()), this);
}
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method run.
private void run() {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM a = (VM) item;
list.add(new RunVmParams(a.getId()));
}
Frontend.getInstance().runMultipleAction(ActionType.RunVm, list, result -> {
}, null);
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method edit.
private void edit() {
VM vm = getSelectedItem();
if (vm == null) {
return;
}
if (getWindow() != null) {
return;
}
// populating VMInit
AsyncQuery<VM> getVmInitQuery = new AsyncQuery<>(result -> {
editedVm = result;
vmInitLoaded(editedVm);
});
if (vm.isNextRunConfigurationExists()) {
AsyncDataProvider.getInstance().getVmNextRunConfiguration(getVmInitQuery, vm.getId());
} else {
AsyncDataProvider.getInstance().getVmById(getVmInitQuery, vm.getId());
}
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method getAttachedTagsToSelectedVMs.
private void getAttachedTagsToSelectedVMs(final TagListModel model) {
ArrayList<Guid> vmIds = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
vmIds.add(vm.getId());
}
attachedTagsToEntities = new HashMap<>();
allAttachedTags = new ArrayList<>();
selectedItemsCounter = 0;
for (Guid id : vmIds) {
AsyncDataProvider.getInstance().getAttachedTagsToVm(new AsyncQuery<>(returnValue -> {
allAttachedTags.addAll(returnValue);
selectedItemsCounter++;
if (selectedItemsCounter == getSelectedItems().size()) {
postGetAttachedTags(model);
}
}), id);
}
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class VmListModel method pause.
private void pause() {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM a = (VM) item;
list.add(new VmOperationParameterBase(a.getId()));
}
Frontend.getInstance().runMultipleAction(ActionType.HibernateVm, list, result -> {
}, null);
}
Aggregations