Search in sources :

Example 16 with HostStorage

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");
    }
}
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 17 with HostStorage

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");
    }
}
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 18 with HostStorage

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) HostStorage(org.ovirt.engine.api.model.HostStorage)

Example 19 with HostStorage

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;
}
Also used : HostStorages(org.ovirt.engine.api.model.HostStorages) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) HostStorage(org.ovirt.engine.api.model.HostStorage) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 20 with HostStorage

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());
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) HostStorage(org.ovirt.engine.api.model.HostStorage) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) Test(org.junit.Test)

Aggregations

HostStorage (org.ovirt.engine.api.model.HostStorage)20 Test (org.junit.Test)8 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)7 StorageDomain (org.ovirt.engine.api.model.StorageDomain)6 Host (org.ovirt.engine.api.model.Host)4 Guid (org.ovirt.engine.core.compat.Guid)4 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)3 LogicalUnits (org.ovirt.engine.api.model.LogicalUnits)3 StorageConnection (org.ovirt.engine.api.model.StorageConnection)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 Response (javax.ws.rs.core.Response)2 Disk (org.ovirt.engine.api.model.Disk)2 VolumeGroup (org.ovirt.engine.api.model.VolumeGroup)2 DiskFormat (org.ovirt.engine.api.model.DiskFormat)1 DiskStatus (org.ovirt.engine.api.model.DiskStatus)1 HostStorages (org.ovirt.engine.api.model.HostStorages)1 StorageType (org.ovirt.engine.api.model.StorageType)1 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)1 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)1