use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.
the class PoolListModel method onRemove.
public void onRemove() {
ConfirmationModel model = (ConfirmationModel) getWindow();
if (model.getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VmPool pool = (VmPool) item;
list.add(new VmPoolParametersBase(pool.getVmPoolId()));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveVmPool, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.
the class RemoveVmPoolCommandCallback method childCommandsExecutionEnded.
@Override
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) {
if (anyFailed) {
setCommandEndStatus(command, true, status, childCmdIds);
} else {
RemoveVmPoolCommand<? extends VmPoolParametersBase> removeVmPoolCommand = (RemoveVmPoolCommand<? extends VmPoolParametersBase>) command;
VmPool pool = DbFacade.getInstance().getVmPoolDao().get(removeVmPoolCommand.getVmPoolId());
if (pool == null || pool.getRunningVmsCount() == 0) {
setCommandEndStatus(command, false, status, childCmdIds);
}
}
}
use of org.ovirt.engine.core.common.action.VmPoolParametersBase in project ovirt-engine by oVirt.
the class RemoveVmFromPoolRunner method removePoolIfNeeded.
/**
* If there is no VMs left in the pool, removes the pool itself
*/
private void removePoolIfNeeded() {
if (!isPoolRemovalEnabled()) {
return;
}
Guid poolId = getPoolId();
if (poolId == null) {
return;
}
boolean allVmsRemoved = vmPoolDao.getVmPoolsMapByVmPoolId(poolId).size() == 0;
if (!allVmsRemoved) {
return;
}
VmPoolParametersBase removePoolParam = new VmPoolParametersBase(poolId);
removePoolParam.setSessionId(getSessionId());
Backend.getInstance().runInternalAction(ActionType.RemoveVmPool, removePoolParam, commandContext);
}
Aggregations