use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method getIscsi.
protected StorageDomain getIscsi() {
StorageDomain model = getModel(0);
model.getStorage().setType(StorageType.ISCSI);
model.getStorage().setAddress(null);
model.getStorage().setPath(null);
model.getStorage().setVolumeGroup(new VolumeGroup());
model.getStorage().getVolumeGroup().setLogicalUnits(new LogicalUnits());
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().add(new LogicalUnit());
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setId(LUN);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setTarget(TARGET);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setAddress(ADDRESSES[0]);
model.getStorage().getVolumeGroup().getLogicalUnits().getLogicalUnits().get(0).setPort(PORT);
model.getStorage().setOverrideLuns(false);
return model;
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddPosixStorageDomain.
@Test
public void testAddPosixStorageDomain() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.AddStorageServerConnection, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "StorageServerConnection.StorageType", "StorageServerConnection.MountOptions", "StorageServerConnection.VfsType", "VdsId" }, new Object[] { ADDRESSES[POSIX_IDX] + ":" + PATHS[POSIX_IDX], STORAGE_TYPES_MAPPED[POSIX_IDX], MOUNT_OPTIONS[POSIX_IDX], VFS_TYPES[POSIX_IDX], GUIDS[0] }, true, true, GUIDS[POSIX_IDX].toString()));
setUpGetEntityExpectations(QueryType.GetStorageServerConnectionById, StorageServerConnectionQueryParametersBase.class, new String[] { "ServerConnectionId" }, new Object[] { GUIDS[POSIX_IDX].toString() }, setUpPosixStorageServerConnection(POSIX_IDX));
setUpGetEntityExpectations(QueryType.GetExistingStorageDomainList, GetExistingStorageDomainListParameters.class, new String[] { "Id", "StorageType", "StorageDomainType", "Path" }, new Object[] { GUIDS[0], STORAGE_TYPES_MAPPED[POSIX_IDX], TYPES_MAPPED[0], ADDRESSES[POSIX_IDX] + ":" + PATHS[POSIX_IDX] }, new ArrayList<>());
setUpCreationExpectations(ActionType.AddPosixFsStorageDomain, StorageDomainManagementParameter.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[POSIX_IDX], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[POSIX_IDX] }, getEntity(POSIX_IDX));
StorageDomain model = getModel(POSIX_IDX);
model.setHost(new Host());
model.getHost().setId(GUIDS[0].toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyModel((StorageDomain) response.getEntity(), POSIX_IDX);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddIscsiStorageDomain.
@Test
public void testAddIscsiStorageDomain() throws Exception {
StorageDomain model = getIscsi();
Host host = new Host();
host.setId(GUIDS[0].toString());
model.setHost(host);
setUriInfo(setUpActionExpectations(ActionType.ConnectStorageToVds, StorageServerConnectionParametersBase.class, new String[] { "StorageServerConnection.Connection", "VdsId" }, new Object[] { ADDRESSES[0], GUIDS[0] }, true, true, GUIDS[0].toString()));
setUpGetEntityExpectations(QueryType.GetDeviceList, GetDeviceListQueryParameters.class, new String[] { "Id", "StorageType" }, new Object[] { GUIDS[0], org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI }, "this return value isn't used");
setUpGetEntityExpectations(QueryType.GetLunsByVgId, GetLunsByVgIdParameters.class, new String[] { "VgId" }, new Object[] { GUIDS[GUIDS.length - 1].toString() }, setUpLuns());
setUpCreationExpectations(ActionType.AddSANStorageDomain, AddSANStorageDomainParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[0], QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getIscsiEntity());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof StorageDomain);
verifyIscsi((StorageDomain) response.getEntity());
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainImageResourceTest method testImport.
@Test
public void testImport() throws Exception {
setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DESTINATION_DOMAIN_ID }, getStoragePoolList());
setUriInfo(setUpActionExpectations(ActionType.ImportRepoImage, ImportRepoImageParameters.class, new String[] { "SourceRepoImageId", "SourceStorageDomainId", "StoragePoolId", "StorageDomainId" }, new Object[] { IMAGE_ID.toString(), DOMAIN_ID, STORAGE_POOL_ID, DESTINATION_DOMAIN_ID }, true, true, null, null, true));
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(DESTINATION_DOMAIN_ID.toString());
verifyActionResponse(resource.doImport(action), "storagedomains/" + DOMAIN_ID + "/images/" + IMAGE_ID, false);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainResourceTest method testConflictedUpdate.
@Test
public void testConflictedUpdate() throws Exception {
setUpGetEntityExpectations(1, getEntity(0));
setUpGetStorageServerConnectionExpectations(1);
setUriInfo(setUpBasicUriExpectations());
StorageDomain model = getModel(1);
model.setId(GUIDS[1].toString());
try {
resource.update(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyImmutabilityConstraint(wae);
}
}
Aggregations