use of org.ovirt.engine.core.common.action.MigrateVmToServerParameters in project ovirt-engine by oVirt.
the class VmListModel method onMigrate.
private void onMigrate() {
MigrateModel model = (MigrateModel) getWindow();
if (model.getProgress() != null) {
return;
}
model.startProgress();
if (model.getIsAutoSelect()) {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
list.add(new MigrateVmParameters(true, vm.getId(), vm.getClusterId()));
}
Frontend.getInstance().runMultipleAction(ActionType.MigrateVm, list, result -> {
MigrateModel localModel = (MigrateModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
} else {
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
if (vm.getRunOnVds().equals(model.getHosts().getSelectedItem().getId())) {
continue;
}
list.add(new MigrateVmToServerParameters(true, vm.getId(), model.getHosts().getSelectedItem().getId(), vm.getClusterId()));
}
Frontend.getInstance().runMultipleAction(ActionType.MigrateVmToServer, list, result -> {
MigrateModel localModel = (MigrateModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
}
Aggregations