use of org.ovirt.engine.api.model.GlusterVolumeProfileDetails in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResource method getProfileStatistics.
@Override
public Response getProfileStatistics(Action action) {
boolean nfsStats = isNfsStatistics();
QueryReturnValue result = runQuery(QueryType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileParameters(Guid.createGuidFromString(parent.getParent().get().getId()), guid, nfsStats));
if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
GlusterVolumeProfileInfo info = result.getReturnValue();
GlusterVolumeProfileDetails statistics = GlusterVolumeProfileInfoMapper.map(info, null);
statistics = LinkHelper.addLinks(statistics);
return Response.ok(statistics).build();
} else {
// throw exception
throw new WebFaultException(null, localize(Messages.BACKEND_FAILED), Response.Status.INTERNAL_SERVER_ERROR);
}
}
use of org.ovirt.engine.api.model.GlusterVolumeProfileDetails in project ovirt-engine by oVirt.
the class V3GlusterVolumeProfileDetailsInAdapter method adapt.
@Override
public GlusterVolumeProfileDetails adapt(V3GlusterVolumeProfileDetails from) {
GlusterVolumeProfileDetails to = new GlusterVolumeProfileDetails();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetBrickProfileDetails()) {
to.setBrickProfileDetails(new BrickProfileDetails());
to.getBrickProfileDetails().getBrickProfileDetails().addAll(adaptIn(from.getBrickProfileDetails().getBrickProfileDetail()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetNfsProfileDetails()) {
to.setNfsProfileDetails(new NfsProfileDetails());
to.getNfsProfileDetails().getNfsProfileDetails().addAll(adaptIn(from.getNfsProfileDetails().getNfsProfileDetail()));
}
return to;
}
use of org.ovirt.engine.api.model.GlusterVolumeProfileDetails in project ovirt-engine by oVirt.
the class GlusterVolumeProfileInfoMapper method map.
@Mapping(from = GlusterVolumeProfileInfo.class, to = GlusterVolumeProfileDetails.class)
public static GlusterVolumeProfileDetails map(GlusterVolumeProfileInfo fromEntity, GlusterVolumeProfileDetails toModel) {
GlusterVolumeProfileDetails model = new GlusterVolumeProfileDetails();
BrickProfileDetails brickprofileDetails = new BrickProfileDetails();
if (fromEntity.getBrickProfileDetails() != null) {
for (org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails brickDetailEntity : fromEntity.getBrickProfileDetails()) {
BrickProfileDetail brickprofileDetail = new BrickProfileDetail();
brickprofileDetail.setBrick(new GlusterBrick());
brickprofileDetail.getBrick().setBrickDir(brickDetailEntity.getName());
mapProfileDetails(brickDetailEntity.getProfileStats(), brickprofileDetail);
brickprofileDetails.getBrickProfileDetails().add(brickprofileDetail);
}
}
model.setBrickProfileDetails(brickprofileDetails);
NfsProfileDetails nfsprofileDetails = new NfsProfileDetails();
if (fromEntity.getNfsProfileDetails() != null) {
for (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats nfsDetailEntity : fromEntity.getNfsProfileDetails()) {
NfsProfileDetail nfsprofileDetail = new NfsProfileDetail();
nfsprofileDetail.setNfsServerIp(nfsDetailEntity.getName());
mapProfileDetails(nfsDetailEntity.getProfileStats(), nfsprofileDetail);
nfsprofileDetails.getNfsProfileDetails().add(nfsprofileDetail);
}
}
model.setNfsProfileDetails(nfsprofileDetails);
return model;
}
Aggregations