Search in sources :

Example 1 with RemoveAllVmCinderDisksParameters

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

the class RemoveDiskSnapshotsCommand method buildRemoveCinderSnapshotDiskParameters.

private RemoveAllVmCinderDisksParameters buildRemoveCinderSnapshotDiskParameters(List<CinderDisk> cinderDisks) {
    RemoveAllVmCinderDisksParameters params = new RemoveAllVmCinderDisksParameters();
    params.setCinderDisks(cinderDisks);
    params.setParentCommand(getActionType());
    params.setParentParameters(getParameters());
    params.setSessionId(getParameters().getSessionId());
    params.setInvokeEndActionOnParent(false);
    params.setEndProcedure(EndProcedure.COMMAND_MANAGED);
    return params;
}
Also used : RemoveAllVmCinderDisksParameters(org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters)

Example 2 with RemoveAllVmCinderDisksParameters

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

the class RemoveVmCommand method removeCinderDisks.

/**
 * The following method will perform a removing of all cinder disks from vm. These is only DB operation
 */
private Collection<CinderDisk> removeCinderDisks() {
    Collection<CinderDisk> failedRemoveCinderDisks = null;
    if (getParameters().isRemoveDisks()) {
        List<CinderDisk> cinderDisks = getCinderDisks();
        if (cinderDisks.isEmpty()) {
            return Collections.emptyList();
        }
        RemoveAllVmCinderDisksParameters param = new RemoveAllVmCinderDisksParameters(getVmId(), cinderDisks);
        param.setEndProcedure(EndProcedure.COMMAND_MANAGED);
        Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.RemoveAllVmCinderDisks, withRootCommandInfo(param), cloneContextAndDetachFromParent());
        try {
            failedRemoveCinderDisks = future.get().getActionReturnValue();
        } catch (InterruptedException | ExecutionException e) {
            failedRemoveCinderDisks = cinderDisks;
            log.error("Exception", e);
        }
    }
    return failedRemoveCinderDisks;
}
Also used : RemoveAllVmCinderDisksParameters(org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) ExecutionException(java.util.concurrent.ExecutionException)

Example 3 with RemoveAllVmCinderDisksParameters

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

the class RemoveVmTemplateCommand method removeCinderDisks.

/**
 * The following method performs a removing of all cinder disks from vm. These is only DB operation
 */
private void removeCinderDisks(List<CinderDisk> cinderDisks) {
    RemoveAllVmCinderDisksParameters removeParam = new RemoveAllVmCinderDisksParameters(getVmTemplateId(), cinderDisks);
    Future<ActionReturnValue> future = commandCoordinatorUtil.executeAsyncCommand(ActionType.RemoveAllVmCinderDisks, withRootCommandInfo(removeParam), cloneContextAndDetachFromParent());
    try {
        future.get().getActionReturnValue();
    } catch (InterruptedException | ExecutionException e) {
        log.error("Exception", e);
    }
}
Also used : RemoveAllVmCinderDisksParameters(org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

RemoveAllVmCinderDisksParameters (org.ovirt.engine.core.common.action.RemoveAllVmCinderDisksParameters)3 ExecutionException (java.util.concurrent.ExecutionException)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1