Search in sources :

Example 91 with DiskVmElement

use of org.ovirt.engine.core.common.businessentities.storage.DiskVmElement 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

DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)91 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)30 Test (org.junit.Test)26 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)23 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)22 Guid (org.ovirt.engine.core.compat.Guid)17 ArrayList (java.util.ArrayList)16 VM (org.ovirt.engine.core.common.businessentities.VM)12 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)11 HashMap (java.util.HashMap)8 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)8 Map (java.util.Map)7 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)7 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)7 ActionType (org.ovirt.engine.core.common.action.ActionType)6 AttachDetachVmDiskParameters (org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters)6 List (java.util.List)5 Collectors (java.util.stream.Collectors)5 VmDiskOperationParameterBase (org.ovirt.engine.core.common.action.VmDiskOperationParameterBase)5 Collection (java.util.Collection)4