Search in sources :

Example 6 with RemoveStorageDomainParameters

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

the class BackendStorageDomainResource method remove.

@Override
public Response remove() {
    boolean destroy = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, DESTROY, true, false);
    get();
    if (destroy) {
        StorageDomainParametersBase parameters = new StorageDomainParametersBase(guid);
        return performAction(ActionType.ForceRemoveStorageDomain, parameters);
    } else {
        String host = ParametersHelper.getParameter(httpHeaders, uriInfo, HOST);
        if (host == null) {
            Fault fault = new Fault();
            fault.setReason("host parameter is missing");
            throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(fault).build());
        }
        boolean format = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, FORMAT, true, false);
        Guid hostId = getHostId(host);
        RemoveStorageDomainParameters parameters = new RemoveStorageDomainParameters(guid);
        parameters.setVdsId(hostId);
        parameters.setDoFormat(format);
        return performAction(ActionType.RemoveStorageDomain, parameters);
    }
}
Also used : RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) WebApplicationException(javax.ws.rs.WebApplicationException) Fault(org.ovirt.engine.api.model.Fault) StorageDomainParametersBase(org.ovirt.engine.core.common.action.StorageDomainParametersBase) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

RemoveStorageDomainParameters (org.ovirt.engine.core.common.action.RemoveStorageDomainParameters)6 DetachStorageDomainFromPoolParameters (org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters)4 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ActionUtils (org.ovirt.engine.core.common.ActionUtils)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)2 DeactivateStorageDomainWithOvfUpdateParameters (org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters)2 StorageDomainPoolParametersBase (org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase)2 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 QueryType (org.ovirt.engine.core.common.queries.QueryType)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2