Search in sources :

Example 6 with AttachDetachVmDiskParameters

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

the class RemoveDiskModel method onRemove.

public void onRemove(final ICommandTarget target) {
    boolean removeDisk = getLatch().getEntity();
    ActionType actionType = removeDisk ? ActionType.RemoveDisk : ActionType.DetachDiskFromVm;
    List<ActionParametersBase> parameterList = disksToRemove.stream().map(disk -> removeDisk ? new RemoveDiskParameters(disk.getId()) : new AttachDetachVmDiskParameters(new DiskVmElement(disk.getId(), vm.getId()))).collect(Collectors.toList());
    startProgress();
    Frontend.getInstance().runMultipleAction(actionType, parameterList, result -> {
        stopProgress();
        target.executeCommand(cancelCommand);
    }, this);
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) Collectors(java.util.stream.Collectors) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AttachDetachVmDiskParameters(org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) AttachDetachVmDiskParameters(org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Aggregations

AttachDetachVmDiskParameters (org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters)6 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)6 ArrayList (java.util.ArrayList)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Disk (org.ovirt.engine.api.model.Disk)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 RemoveDiskParameters (org.ovirt.engine.core.common.action.RemoveDiskParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 Guid (org.ovirt.engine.core.compat.Guid)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 ICommandTarget (org.ovirt.engine.ui.uicommonweb.ICommandTarget)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1