Search in sources :

Example 1 with HostStorage

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

the class V3StorageInAdapter method adapt.

@Override
public HostStorage adapt(V3Storage from) {
    HostStorage to = new HostStorage();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAddress()) {
        to.setAddress(from.getAddress());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLogicalUnits()) {
        to.setLogicalUnits(new LogicalUnits());
        to.getLogicalUnits().getLogicalUnits().addAll(adaptIn(from.getLogicalUnits()));
    }
    if (from.isSetMountOptions()) {
        to.setMountOptions(from.getMountOptions());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNfsRetrans()) {
        to.setNfsRetrans(from.getNfsRetrans());
    }
    if (from.isSetNfsTimeo()) {
        to.setNfsTimeo(from.getNfsTimeo());
    }
    if (from.isSetNfsVersion()) {
        to.setNfsVersion(NfsVersion.fromValue(from.getNfsVersion()));
    }
    if (from.isSetOverrideLuns()) {
        to.setOverrideLuns(from.isOverrideLuns());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPath()) {
        to.setPath(from.getPath());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    if (from.isSetPortal()) {
        to.setPortal(from.getPortal());
    }
    if (from.isSetTarget()) {
        to.setTarget(from.getTarget());
    }
    if (from.isSetType()) {
        to.setType(StorageType.fromValue(from.getType()));
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    if (from.isSetVfsType()) {
        to.setVfsType(from.getVfsType());
    }
    if (from.isSetVolumeGroup()) {
        to.setVolumeGroup(adaptIn(from.getVolumeGroup()));
    }
    return to;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) HostStorage(org.ovirt.engine.api.model.HostStorage)

Example 2 with HostStorage

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

the class BackendVmDisksResourceTest method createIscsiLunDisk.

private Disk createIscsiLunDisk() {
    Disk model = getModel();
    model.setLunStorage(new HostStorage());
    model.getLunStorage().setType(StorageType.ISCSI);
    model.getLunStorage().setLogicalUnits(new LogicalUnits());
    model.getLunStorage().getLogicalUnits().getLogicalUnits().add(new LogicalUnit());
    model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setId(GUIDS[0].toString());
    model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setAddress(ISCSI_SERVER_ADDRESS);
    model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setTarget(ISCSI_SERVER_TARGET);
    model.getLunStorage().getLogicalUnits().getLogicalUnits().get(0).setPort(ISCSI_SERVER_CONNECTION_PORT);
    model.setProvisionedSize(null);
    return model;
}
Also used : LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) HostStorage(org.ovirt.engine.api.model.HostStorage) Disk(org.ovirt.engine.api.model.Disk)

Example 3 with HostStorage

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

the class LinkHelperTest method testStorageDomainLinks.

@Test
public void testStorageDomainLinks() throws Exception {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(STORAGE_DOMAIN_ID);
    storageDomain.setStorage(new HostStorage());
    storageDomain.getStorage().setPath("foo");
    LinkHelper.addLinks(storageDomain);
    assertEquals(STORAGE_DOMAIN_HREF, storageDomain.getHref());
    assertNull(storageDomain.getStorage().getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) HostStorage(org.ovirt.engine.api.model.HostStorage) Test(org.junit.Test)

Example 4 with HostStorage

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

the class LinkHelperTest method testStorageLinks.

@Test
public void testStorageLinks() throws Exception {
    HostStorage storage = new HostStorage();
    storage.setId(STORAGE_ID);
    storage.setHost(new Host());
    storage.getHost().setId(HOST_ID);
    LinkHelper.addLinks(storage);
    assertEquals(STORAGE_HREF, storage.getHref());
    assertEquals(HOST_HREF, storage.getHost().getHref());
}
Also used : HostStorage(org.ovirt.engine.api.model.HostStorage) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 5 with HostStorage

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

the class DiskMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.Disk.class, to = Disk.class)
public static Disk map(org.ovirt.engine.core.common.businessentities.storage.Disk entity, Disk template) {
    Disk model = template != null ? template : new Disk();
    // name is depreciated, use alias instead.
    model.setName(entity.getDiskAlias());
    model.setAlias(entity.getDiskAlias());
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    model.setPropagateErrors(PropagateErrors.On == entity.getPropagateErrors());
    model.setWipeAfterDelete(entity.isWipeAfterDelete());
    model.setShareable(entity.isShareable());
    model.setDescription(entity.getDiskDescription());
    model.setLogicalName(entity.getLogicalName());
    model.setStorageType(map(entity.getDiskStorageType()));
    if (entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.IMAGE || entity.getDiskStorageType() == org.ovirt.engine.core.common.businessentities.storage.DiskStorageType.CINDER) {
        mapDiskImageToDiskFields((DiskImage) entity, model);
    } else {
        model.setLunStorage(StorageLogicalUnitMapper.map(((LunDisk) entity).getLun(), new HostStorage()));
        if (entity.getSgio() != null) {
            model.setSgio(map(entity.getSgio(), null));
        }
    }
    model.setContentType(mapDiskContentType(entity.getContentType()));
    return model;
}
Also used : HostStorage(org.ovirt.engine.api.model.HostStorage) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.api.model.Disk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk)

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