Search in sources :

Example 1 with RemoveDiskParameters

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

the class ImportHostedEngineStorageDomainCommand method removeHostedEngineLunDisk.

private void removeHostedEngineLunDisk() {
    List<BaseDisk> disks = baseDiskDao.getDisksByAlias(StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS);
    if (disks != null && !disks.isEmpty()) {
        BaseDisk heDirectLun = disks.get(0);
        ActionReturnValue removeDisk = backend.runInternalAction(ActionType.RemoveDisk, new RemoveDiskParameters(heDirectLun.getId()));
        if (!removeDisk.getSucceeded()) {
            setSucceeded(false);
            log.error("Failed to remove the hosted engine direct lun disk");
            return;
        }
    }
    setSucceeded(true);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) BaseDisk(org.ovirt.engine.core.common.businessentities.storage.BaseDisk) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 2 with RemoveDiskParameters

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

the class DiskListModel method onRemove.

private void onRemove() {
    RemoveDiskModel model = (RemoveDiskModel) getWindow();
    ArrayList<ActionParametersBase> parameterList = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        Disk disk = (Disk) item;
        ActionParametersBase parameters = new RemoveDiskParameters(disk.getId());
        parameterList.add(parameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, parameterList, result -> {
        DiskListModel localModel = (DiskListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, this);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) ArrayList(java.util.ArrayList) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 3 with RemoveDiskParameters

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

the class RemoveMemoryVolumesCommand method executeCommand.

@Override
protected void executeCommand() {
    if (getParameters().getSnapshot().containsMemory() && isMemoryRemovable()) {
        RemoveDiskParameters removeMemoryDumpDiskParameters = new RemoveDiskParameters(getParameters().getSnapshot().getMemoryDiskId());
        removeMemoryDumpDiskParameters.setShouldBeLogged(false);
        runInternalAction(ActionType.RemoveDisk, removeMemoryDumpDiskParameters);
        RemoveDiskParameters removeMemoryMetadataDiskParameters = new RemoveDiskParameters(getParameters().getSnapshot().getMetadataDiskId());
        removeMemoryMetadataDiskParameters.setShouldBeLogged(false);
        runInternalAction(ActionType.RemoveDisk, removeMemoryMetadataDiskParameters);
    }
    setSucceeded(true);
}
Also used : RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 4 with RemoveDiskParameters

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

the class VmCommand method removeMemoryDisks.

protected boolean removeMemoryDisks(Snapshot snapshot) {
    RemoveDiskParameters removeMemoryDumpDiskParameters = new RemoveDiskParameters(snapshot.getMemoryDiskId());
    removeMemoryDumpDiskParameters.setShouldBeLogged(false);
    ActionReturnValue retVal = runInternalAction(ActionType.RemoveDisk, removeMemoryDumpDiskParameters);
    if (!retVal.getSucceeded()) {
        return false;
    }
    RemoveDiskParameters removeMemoryMetadataDiskParameters = new RemoveDiskParameters(snapshot.getMetadataDiskId());
    removeMemoryMetadataDiskParameters.setShouldBeLogged(false);
    retVal = runInternalAction(ActionType.RemoveDisk, removeMemoryMetadataDiskParameters);
    if (!retVal.getSucceeded()) {
        return false;
    }
    return true;
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 5 with RemoveDiskParameters

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

the class BackendTemplateDiskResource method remove.

@Override
public Response remove() {
    // will throw 404 if entity not found.
    get();
    RemoveDiskParameters params = new RemoveDiskParameters(asGuid(id));
    boolean force = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FORCE, true, false);
    if (force) {
        params.setForceDelete(force);
    }
    String storageDomain = ParametersHelper.getParameter(httpHeaders, uriInfo, STORAGE_DOMAIN);
    if (storageDomain != null) {
        params.setStorageDomainId(asGuid(storageDomain));
    }
    return performAction(ActionType.RemoveDisk, params);
}
Also used : RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Aggregations

RemoveDiskParameters (org.ovirt.engine.core.common.action.RemoveDiskParameters)8 ArrayList (java.util.ArrayList)4 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 RemoveDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel)2 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 AttachDetachVmDiskParameters (org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 BaseDisk (org.ovirt.engine.core.common.businessentities.storage.BaseDisk)1 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 DiskVmElement (org.ovirt.engine.core.common.businessentities.storage.DiskVmElement)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