use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method addParents.
@Override
protected GlusterBrick addParents(GlusterBrick glusterBrick) {
GlusterVolume volume = new GlusterVolume();
parent.addParents(volume);
glusterBrick.setGlusterVolume(volume);
return glusterBrick;
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class BackendGlusterVolumesResource method add.
@Override
public Response add(GlusterVolume volume) {
validateParameters(volume, "name", "volumeType", "bricks");
GlusterVolumeEntity volumeEntity = getMapper(GlusterVolume.class, GlusterVolumeEntity.class).map(volume, null);
volumeEntity.setClusterId(asGuid(parent.get().getId()));
mapBricks(volume, volumeEntity);
return performCreate(ActionType.CreateGlusterVolume, new CreateGlusterVolumeParameters(volumeEntity, isForce()), new QueryIdResolver<Guid>(QueryType.GetGlusterVolumeById, IdQueryParameters.class), true);
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class V3GlusterVolumeInAdapter method adapt.
@Override
public GlusterVolume adapt(V3GlusterVolume from) {
GlusterVolume to = new GlusterVolume();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetBricks()) {
to.setBricks(new GlusterBricks());
to.getBricks().getGlusterBricks().addAll(adaptIn(from.getBricks().getGlusterBricks()));
}
if (from.isSetCluster()) {
to.setCluster(adaptIn(from.getCluster()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisperseCount()) {
to.setDisperseCount(from.getDisperseCount());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOptions()) {
to.setOptions(new Options());
to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
}
if (from.isSetRedundancyCount()) {
to.setRedundancyCount(from.getRedundancyCount());
}
if (from.isSetReplicaCount()) {
to.setReplicaCount(from.getReplicaCount());
}
if (from.isSetStatus() && from.getStatus().isSetState()) {
to.setStatus(GlusterVolumeStatus.fromValue(from.getStatus().getState()));
}
if (from.isSetStripeCount()) {
to.setStripeCount(from.getStripeCount());
}
if (from.isSetTransportTypes()) {
to.setTransportTypes(new GlusterVolume.TransportTypesList());
to.getTransportTypes().getTransportTypes().addAll(adaptTransportTypes(from));
}
if (from.isSetVolumeType()) {
to.setVolumeType(GlusterVolumeType.fromValue(from.getVolumeType()));
}
return to;
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class GlusterBrickMapper method map.
@Mapping(from = GlusterBrickEntity.class, to = GlusterBrick.class)
public static GlusterBrick map(GlusterBrickEntity fromBrick, GlusterBrick toBrick) {
GlusterBrick brick = (toBrick == null) ? new GlusterBrick() : toBrick;
if (fromBrick.getId() != null) {
brick.setId(fromBrick.getId().toString());
}
if (fromBrick.getServerId() != null) {
brick.setServerId(fromBrick.getServerId().toString());
}
if (StringUtils.isNotEmpty(fromBrick.getQualifiedName())) {
brick.setName(fromBrick.getQualifiedName());
}
if (fromBrick.getBrickDirectory() != null) {
brick.setBrickDir(fromBrick.getBrickDirectory());
}
if (fromBrick.getStatus() != null) {
brick.setStatus(mapBrickStatus(fromBrick.getStatus()));
}
if (fromBrick.getVolumeId() != null) {
brick.setGlusterVolume(new GlusterVolume());
brick.getGlusterVolume().setId(fromBrick.getVolumeId().toString());
}
return brick;
}
use of org.ovirt.engine.api.model.GlusterVolume in project ovirt-engine by oVirt.
the class GlusterVolumeMapper method map.
@Mapping(from = GlusterVolumeEntity.class, to = GlusterVolume.class)
public static GlusterVolume map(GlusterVolumeEntity fromVolume, GlusterVolume toVolume) {
GlusterVolume volume = toVolume != null ? toVolume : new GlusterVolume();
if (fromVolume.getId() != null) {
volume.setId(fromVolume.getId().toString());
}
if (fromVolume.getName() != null) {
volume.setName(fromVolume.getName());
}
if (fromVolume.getVolumeType() != null) {
volume.setVolumeType(map(fromVolume.getVolumeType(), null));
}
if (fromVolume.getTransportTypes() != null) {
ArrayList<TransportType> transportTypeList = new ArrayList<>();
for (org.ovirt.engine.core.common.businessentities.gluster.TransportType transportType : fromVolume.getTransportTypes()) {
transportTypeList.add(map(transportType, null));
}
volume.setTransportTypes(new GlusterVolume.TransportTypesList());
volume.getTransportTypes().getTransportTypes().addAll(transportTypeList);
}
volume.setReplicaCount(fromVolume.getReplicaCount());
volume.setStripeCount(fromVolume.getStripeCount());
volume.setDisperseCount(fromVolume.getDisperseCount());
volume.setRedundancyCount(fromVolume.getRedundancyCount());
if (fromVolume.getStatus() != null) {
volume.setStatus(mapVolumeStatus(fromVolume.getStatus()));
}
if (fromVolume.getOptions() != null) {
Options glusterOptions = new Options();
List<Option> options = glusterOptions.getOptions();
for (GlusterVolumeOptionEntity option : fromVolume.getOptions()) {
options.add(mapOption(option));
}
volume.setOptions(glusterOptions);
}
return volume;
}
Aggregations