Search in sources :

Example 1 with GlusterVolumeProfileDetails

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);
    }
}
Also used : GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)

Example 2 with GlusterVolumeProfileDetails

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;
}
Also used : NfsProfileDetails(org.ovirt.engine.api.model.NfsProfileDetails) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) V3GlusterVolumeProfileDetails(org.ovirt.engine.api.v3.types.V3GlusterVolumeProfileDetails) BrickProfileDetails(org.ovirt.engine.api.model.BrickProfileDetails)

Example 3 with GlusterVolumeProfileDetails

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;
}
Also used : NfsProfileDetails(org.ovirt.engine.api.model.NfsProfileDetails) NfsProfileDetail(org.ovirt.engine.api.model.NfsProfileDetail) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) BrickProfileDetails(org.ovirt.engine.api.model.BrickProfileDetails) BrickProfileDetail(org.ovirt.engine.api.model.BrickProfileDetail) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Aggregations

GlusterVolumeProfileDetails (org.ovirt.engine.api.model.GlusterVolumeProfileDetails)3 BrickProfileDetails (org.ovirt.engine.api.model.BrickProfileDetails)2 NfsProfileDetails (org.ovirt.engine.api.model.NfsProfileDetails)2 BrickProfileDetail (org.ovirt.engine.api.model.BrickProfileDetail)1 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)1 NfsProfileDetail (org.ovirt.engine.api.model.NfsProfileDetail)1 V3GlusterVolumeProfileDetails (org.ovirt.engine.api.v3.types.V3GlusterVolumeProfileDetails)1 GlusterVolumeProfileInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 GlusterVolumeProfileParameters (org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)1