Search in sources :

Example 76 with StorageDomain

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

the class BackendStorageDomainsResourceTest method testAddIncompleteNfsStorageParameters.

@Test
public void testAddIncompleteNfsStorageParameters() throws Exception {
    StorageDomain model = getModel(0);
    model.setName(NAMES[0]);
    model.setHost(new Host());
    model.getHost().setId(GUIDS[0].toString());
    model.setStorage(new HostStorage());
    model.getStorage().setType(StorageType.NFS);
    model.getStorage().setPath(PATHS[0]);
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "HostStorage", "add", "address");
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) WebApplicationException(javax.ws.rs.WebApplicationException) Host(org.ovirt.engine.api.model.Host) HostStorage(org.ovirt.engine.api.model.HostStorage) Test(org.junit.Test)

Example 77 with StorageDomain

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

the class BackendStorageDomainsResourceTest method getModel.

static StorageDomain getModel(int index) {
    StorageDomain model = new StorageDomain();
    model.setName(getSafeEntry(index, NAMES));
    model.setDescription(getSafeEntry(index, DESCRIPTIONS));
    model.setType(getSafeEntry(index, TYPES));
    model.setStorage(new HostStorage());
    model.getStorage().setType(getSafeEntry(index, STORAGE_TYPES));
    model.getStorage().setAddress(getSafeEntry(index, ADDRESSES));
    model.getStorage().setPath(getSafeEntry(index, PATHS));
    model.getStorage().setMountOptions(getSafeEntry(index, MOUNT_OPTIONS));
    model.getStorage().setVfsType(getSafeEntry(index, VFS_TYPES));
    return model;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) HostStorage(org.ovirt.engine.api.model.HostStorage)

Example 78 with StorageDomain

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

the class BackendStorageDomainsResourceTest method doTestBadCnxAdd.

private void doTestBadCnxAdd(boolean valid, boolean success, String detail) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "VdsId" }, new Object[] { ADDRESSES[0] + ":" + PATHS[0], STORAGE_TYPES_MAPPED[0], GUIDS[0] }, valid, success, GUIDS[0].toString(), true));
    StorageDomain model = getModel(0);
    model.setHost(new Host());
    model.getHost().setId(GUIDS[0].toString());
    try {
        collection.add(model);
    } catch (WebApplicationException wae) {
        verifyFault(wae, detail);
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) WebApplicationException(javax.ws.rs.WebApplicationException) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) Host(org.ovirt.engine.api.model.Host)

Example 79 with StorageDomain

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

the class BackendVmDiskResourceTest method setUpMoveParams.

private Action setUpMoveParams(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 80 with StorageDomain

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

the class BackendStorageDomainDiskResourceTest method testExport.

@Test
public void testExport() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { DISK_ID, GUIDS[3] }, true, true, null, null, true));
    Action action = new Action();
    action.setStorageDomain(new StorageDomain());
    action.getStorageDomain().setId(GUIDS[3].toString());
    verifyActionResponse(resource.export(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain) ExportRepoImageParameters(org.ovirt.engine.core.common.action.ExportRepoImageParameters) Test(org.junit.Test)

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