use of org.ovirt.engine.api.model.HostStorage in project ovirt-engine by oVirt.
the class BackendStorageDomainsResourceTest method testAddIncompleteDomainParameters.
@Test
public void testAddIncompleteDomainParameters() 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().setAddress(ADDRESSES[0]);
model.getStorage().setPath(PATHS[0]);
setUriInfo(setUpBasicUriExpectations());
try {
collection.add(model);
fail("expected WebApplicationException on incomplete parameters");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "StorageDomain", "add", "storage.type");
}
}
use of org.ovirt.engine.api.model.HostStorage 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");
}
}
use of org.ovirt.engine.api.model.HostStorage 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;
}
use of org.ovirt.engine.api.model.HostStorage in project ovirt-engine by oVirt.
the class BackendHostStorageResource method list.
public HostStorages list() {
HostStorages ret = new HostStorages();
for (LUNs lun : getLogicalUnits()) {
HostStorage storage = map(lun);
ArrayList<StorageServerConnections> lunConnections = lun.getLunConnections();
if (lunConnections != null && !lunConnections.isEmpty()) {
getMapper(StorageServerConnections.class, LogicalUnit.class).map(lunConnections.get(0), storage.getLogicalUnits().getLogicalUnits().get(0));
}
ret.getHostStorages().add(addLinks(storage));
}
return ret;
}
use of org.ovirt.engine.api.model.HostStorage in project ovirt-engine by oVirt.
the class StorageDomainMapperTest method checkNFSStorageConnectionsMappings.
@Test
public void checkNFSStorageConnectionsMappings() {
StorageServerConnections connection = new StorageServerConnections();
Guid connId = Guid.newGuid();
connection.setId(connId.toString());
connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS);
connection.setConnection("1.2.135.255:/myshare/data");
connection.setNfsRetrans((short) 200);
connection.setNfsTimeo((short) 400);
connection.setNfsVersion(org.ovirt.engine.core.common.businessentities.NfsVersion.V3);
connection.setMountOptions("tcp");
HostStorage RESTConnection = new HostStorage();
RESTConnection.setId(connId.toString());
RESTConnection.setType(StorageType.NFS);
RESTConnection.setAddress("1.2.135.255");
RESTConnection.setPath("/myshare/data");
RESTConnection.setNfsRetrans(200);
RESTConnection.setNfsTimeo(400);
RESTConnection.setNfsVersion(NfsVersion.V3);
RESTConnection.setMountOptions("tcp");
StorageConnection mappedResult = StorageDomainMapper.map(connection, null);
assertEquals(RESTConnection.getId(), mappedResult.getId());
assertEquals(RESTConnection.getType(), mappedResult.getType());
assertEquals(RESTConnection.getAddress(), mappedResult.getAddress());
assertEquals(RESTConnection.getPath(), mappedResult.getPath());
assertEquals(RESTConnection.getNfsRetrans(), mappedResult.getNfsRetrans());
assertEquals(RESTConnection.getNfsTimeo(), mappedResult.getNfsTimeo());
assertEquals(RESTConnection.getNfsVersion(), mappedResult.getNfsVersion());
assertEquals(RESTConnection.getMountOptions(), mappedResult.getMountOptions());
}
Aggregations