Search in sources :

Example 21 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendTemplateDiskResourceTest method setUpCopyParams.

private Action setUpCopyParams(boolean byName) {
    Action action = new Action();
    StorageDomain sd = new StorageDomain();
    if (byName) {
        sd.setName(NAMES[2]);
    } else {
        sd.setId(GUIDS[3].toString());
    }
    action.setStorageDomain(sd);
    return action;
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain)

Example 22 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendAttachedStorageDomainResource method remove.

@Override
public Response remove() {
    StorageDomain storageDomain = get();
    if (storageDomain.getStorage().getType().equals(StorageType.LOCALFS)) {
        RemoveStorageDomainParameters params = new RemoveStorageDomainParameters(guid);
        params.setDoFormat(true);
        return performAction(ActionType.RemoveStorageDomain, params);
    } else {
        DetachStorageDomainFromPoolParameters params = new DetachStorageDomainFromPoolParameters(guid, dataCenterId);
        return performAction(ActionType.DetachStorageDomainFromPool, params);
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters)

Example 23 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendFilesResource method addParents.

@Override
protected File addParents(File file) {
    file.setStorageDomain(new StorageDomain());
    file.getStorageDomain().setId(storageDomainId);
    return file;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain)

Example 24 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class V3StorageDomainInAdapter method adapt.

@Override
public StorageDomain adapt(V3StorageDomain from) {
    StorageDomain to = new StorageDomain();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAvailable()) {
        to.setAvailable(from.getAvailable());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCommitted()) {
        to.setCommitted(from.getCommitted());
    }
    if (from.isSetCriticalSpaceActionBlocker()) {
        to.setCriticalSpaceActionBlocker(from.getCriticalSpaceActionBlocker());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptIn(from.getDataCenter()));
    }
    if (from.isSetDataCenters()) {
        to.setDataCenters(new DataCenters());
        to.getDataCenters().getDataCenters().addAll(adaptIn(from.getDataCenters().getDataCenters()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetExternalStatus() && from.getExternalStatus().isSetState()) {
        to.setExternalStatus(ExternalStatus.fromValue(from.getExternalStatus().getState()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetImport()) {
        to.setImport(from.isImport());
    }
    if (from.isSetMaster()) {
        to.setMaster(from.isMaster());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(StorageDomainStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStorage()) {
        to.setStorage(adaptIn(from.getStorage()));
    }
    if (from.isSetStorageFormat()) {
        to.setStorageFormat(StorageFormat.fromValue(from.getStorageFormat()));
    }
    if (from.isSetType()) {
        to.setType(StorageDomainType.fromValue(from.getType()));
    }
    if (from.isSetUsed()) {
        to.setUsed(from.getUsed());
    }
    if (from.isSetWarningLowSpaceIndicator()) {
        to.setWarningLowSpaceIndicator(from.getWarningLowSpaceIndicator());
    }
    if (from.isSetWipeAfterDelete()) {
        to.setWipeAfterDelete(from.isWipeAfterDelete());
    }
    return to;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) V3StorageDomain(org.ovirt.engine.api.v3.types.V3StorageDomain) DataCenters(org.ovirt.engine.api.model.DataCenters)

Example 25 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendStorageDomainDiskResource method addParents.

@Override
protected Disk addParents(Disk disk) {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(storageDomainId.toString());
    StorageDomains storageDomains = new StorageDomains();
    storageDomains.getStorageDomains().add(storageDomain);
    disk.setStorageDomain(storageDomain);
    disk.setStorageDomains(storageDomains);
    return disk;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Aggregations

StorageDomain (org.ovirt.engine.api.model.StorageDomain)88 Test (org.junit.Test)41 WebApplicationException (javax.ws.rs.WebApplicationException)14 Action (org.ovirt.engine.api.model.Action)14 Response (javax.ws.rs.core.Response)13 Host (org.ovirt.engine.api.model.Host)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 Disk (org.ovirt.engine.api.model.Disk)9 StorageDomains (org.ovirt.engine.api.model.StorageDomains)9 BackendStorageDomainVmsResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain)8 HostStorage (org.ovirt.engine.api.model.HostStorage)6 BackendStorageDomainTemplatesResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain)6 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)6 DataCenter (org.ovirt.engine.api.model.DataCenter)5 Vm (org.ovirt.engine.api.model.Vm)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 DiskProfile (org.ovirt.engine.api.model.DiskProfile)4 ExportRepoImageParameters (org.ovirt.engine.core.common.action.ExportRepoImageParameters)4 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)4