Search in sources :

Example 6 with CreateSnapshotForVmParameters

use of org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters in project ovirt-engine by oVirt.

the class SnapshotModel method onSave.

public void onSave() {
    if (getProgress() != null || !validate()) {
        return;
    }
    startProgress();
    VM vm = getVm();
    ArrayList<ActionParametersBase> params = new ArrayList<>();
    Set<Guid> snapshotDisksIds = null;
    if (getSnapshotDisks().getSelectedItems() != null) {
        snapshotDisksIds = getSnapshotDisks().getSelectedItems().stream().map(BaseDisk::getId).collect(Collectors.toSet());
    }
    CreateSnapshotForVmParameters param = new CreateSnapshotForVmParameters(vm.getId(), getDescription().getEntity(), getMemory().getEntity(), snapshotDisksIds);
    param.setQuotaId(vm.getQuotaId());
    params.add(param);
    Frontend.getInstance().runMultipleAction(ActionType.CreateSnapshotForVm, params, result -> {
        SnapshotModel localModel = (SnapshotModel) result.getState();
        localModel.stopProgress();
        getCancelCommand().execute();
    }, this);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) BaseDisk(org.ovirt.engine.core.common.businessentities.storage.BaseDisk) Guid(org.ovirt.engine.core.compat.Guid) CreateSnapshotForVmParameters(org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

CreateSnapshotForVmParameters (org.ovirt.engine.core.common.action.CreateSnapshotForVmParameters)6 Guid (org.ovirt.engine.core.compat.Guid)3 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 BaseDisk (org.ovirt.engine.core.common.businessentities.storage.BaseDisk)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1