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;
}
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;
}
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());
}
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());
}
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;
}
Aggregations