Search in sources :

Example 1 with BrickProperties

use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.

the class SubTabVolumeBrickView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    BrickStatusColumn brickStatusColumn = new BrickStatusColumn();
    brickStatusColumn.setContextMenuTitle(constants.statusVolumeBrick());
    brickStatusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(brickStatusColumn, constants.empty(), "30px");
    AbstractTextColumn<GlusterBrickEntity> serverColumn = new AbstractTextColumn<GlusterBrickEntity>() {

        @Override
        public String getValue(GlusterBrickEntity brick) {
            return brick.getServerName();
        }
    };
    serverColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(serverColumn, constants.serverVolumeBrick(), "300px");
    AbstractTextColumn<GlusterBrickEntity> directoryColumn = new AbstractTextColumn<GlusterBrickEntity>() {

        @Override
        public String getValue(GlusterBrickEntity brick) {
            String qualifiedName = brick.getQualifiedName();
            if (brick.getIsArbiter()) {
                // $NON-NLS-1$ //$NON-NLS-2$
                qualifiedName += " (" + constants.arbiter() + ")";
            }
            return qualifiedName;
        }
    };
    directoryColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(directoryColumn, constants.brickDirectoryVolumeBrick(), "400px");
    getTable().addColumn(new Column<GlusterBrickEntity, BrickProperties>(new BrickCapacityCell()) {

        @Override
        public BrickProperties getValue(GlusterBrickEntity object) {
            return object.getBrickProperties();
        }
    }, constants.volumeCapacity(), // $NON-NLS-1$
    "100px");
    BrickHealInfoColumn healInfoColumn = new BrickHealInfoColumn();
    // $NON-NLS-1$
    getTable().addColumn(healInfoColumn, constants.healInfo(), "110px");
    getTable().addColumn(new VolumeActivityColumn<GlusterBrickEntity>(getActivityCell()), constants.activitiesOnVolume(), // $NON-NLS-1$
    "100px");
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) BrickCapacityCell(org.ovirt.engine.ui.webadmin.widget.table.column.BrickCapacityCell) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) BrickStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.BrickStatusColumn) BrickHealInfoColumn(org.ovirt.engine.ui.webadmin.widget.table.column.BrickHealInfoColumn) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 2 with BrickProperties

use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.

the class GlusterBrickDetailMapper method mapBrickProperties.

private static GlusterBrick mapBrickProperties(BrickDetails detail, GlusterBrick model) {
    if (detail.getBrickProperties() != null) {
        BrickProperties props = detail.getBrickProperties();
        if (StringUtils.isNotEmpty(props.getDevice())) {
            model.setDevice(props.getDevice());
        }
        if (StringUtils.isNotEmpty(props.getFsName())) {
            model.setFsName(props.getFsName());
        }
        if (StringUtils.isNotEmpty(props.getMntOptions())) {
            model.setMntOptions(props.getMntOptions());
        }
        model.setPid(props.getPid());
        model.setPort(props.getPort());
    }
    return model;
}
Also used : BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 3 with BrickProperties

use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.

the class GlusterSyncJob method refreshVolumeDetails.

public void refreshVolumeDetails(VDS upServer, GlusterVolumeEntity volume) {
    List<GlusterBrickEntity> bricksToUpdate = new ArrayList<>();
    List<GlusterBrickEntity> brickPropertiesToUpdate = new ArrayList<>();
    List<GlusterBrickEntity> brickPropertiesToAdd = new ArrayList<>();
    GlusterVolumeAdvancedDetails volumeAdvancedDetails = getVolumeAdvancedDetails(upServer, volume.getClusterId(), volume.getName());
    if (volumeAdvancedDetails == null) {
        log.error("Error while refreshing brick statuses for volume '{}'. Failed to get volume advanced details ", volume.getName());
        return;
    }
    if (volumeAdvancedDetails.getCapacityInfo() != null) {
        if (volume.getAdvancedDetails().getCapacityInfo() == null) {
            volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo());
        } else {
            volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo());
        }
    }
    Map<Guid, BrickProperties> brickPropertiesMap = getBrickPropertiesMap(volumeAdvancedDetails);
    for (GlusterBrickEntity brick : volume.getBricks()) {
        BrickProperties brickProperties = brickPropertiesMap.get(brick.getId());
        if (brickProperties != null) {
            if (brickProperties.getStatus() != brick.getStatus()) {
                logBrickStatusChange(volume, brick, brickProperties.getStatus());
                brick.setStatus(brickProperties.getStatus());
                bricksToUpdate.add(brick);
            }
            if (brick.getBrickProperties() == null) {
                BrickDetails brickDetails = new BrickDetails();
                brickDetails.setBrickProperties(brickProperties);
                brick.setBrickDetails(brickDetails);
                brickPropertiesToAdd.add(brick);
            } else if (brickProperties.getTotalSize() != brick.getBrickProperties().getTotalSize() || brickProperties.getFreeSize() != brick.getBrickProperties().getFreeSize()) {
                brick.getBrickDetails().setBrickProperties(brickProperties);
                brickPropertiesToUpdate.add(brick);
            }
        }
    }
    if (!brickPropertiesToAdd.isEmpty()) {
        brickDao.addBrickProperties(brickPropertiesToAdd);
    }
    if (!brickPropertiesToUpdate.isEmpty()) {
        brickDao.updateBrickProperties(brickPropertiesToUpdate);
    }
    if (!bricksToUpdate.isEmpty()) {
        brickDao.updateBrickStatuses(bricksToUpdate);
    }
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ArrayList(java.util.ArrayList) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) Guid(org.ovirt.engine.core.compat.Guid) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 4 with BrickProperties

use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.

the class GlusterSyncJobTest method getVolumeAdvancedDetails.

private GlusterVolumeAdvancedDetails getVolumeAdvancedDetails(GlusterVolumeEntity volume) {
    GlusterVolumeAdvancedDetails volDetails = new GlusterVolumeAdvancedDetails();
    GlusterVolumeSizeInfo capacityInfo = new GlusterVolumeSizeInfo();
    capacityInfo.setVolumeId(volume.getId());
    capacityInfo.setTotalSize(600000L);
    capacityInfo.setFreeSize(200000L);
    capacityInfo.setUsedSize(400000L);
    volDetails.setCapacityInfo(capacityInfo);
    List<BrickDetails> brickDetailsList = new ArrayList<>();
    for (GlusterBrickEntity brick : volume.getBricks()) {
        BrickDetails brickDetails = new BrickDetails();
        BrickProperties properties = new BrickProperties();
        properties.setBrickId(brick.getId());
        brickDetails.setBrickProperties(properties);
        properties.setStatus(brick.getStatus());
        if (volume == existingReplVol) {
            if (brick.getServerId().equals(SERVER_ID_1) && (brick.getBrickDirectory().equals(REPL_BRICK_R1D1) || brick.getBrickDirectory().equals(REPL_BRICK_R2D1))) {
                properties.setStatus(GlusterStatus.DOWN);
                bricksWithChangedStatus.add(brick);
            }
        }
        brickDetailsList.add(brickDetails);
    }
    volDetails.setBrickDetails(brickDetailsList);
    return volDetails;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeSizeInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 5 with BrickProperties

use of org.ovirt.engine.core.common.businessentities.gluster.BrickProperties in project ovirt-engine by oVirt.

the class GetGlusterVolumeAdvancedDetailsQueryTest method getBrickProperties.

private BrickProperties getBrickProperties() {
    BrickProperties brickProperties = new BrickProperties();
    brickProperties.setBrickId(Guid.newGuid());
    brickProperties.setPort(24009);
    brickProperties.setStatus(GlusterStatus.UP);
    brickProperties.setPid(1459);
    return brickProperties;
}
Also used : BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Aggregations

BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)14 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)9 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)7 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)4 Guid (org.ovirt.engine.core.compat.Guid)4 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)3 GlusterVolumeSizeInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)1 MallInfo (org.ovirt.engine.core.common.businessentities.gluster.MallInfo)1 MemoryStatus (org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 BrickCapacityCell (org.ovirt.engine.ui.webadmin.widget.table.column.BrickCapacityCell)1 BrickHealInfoColumn (org.ovirt.engine.ui.webadmin.widget.table.column.BrickHealInfoColumn)1 BrickStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.BrickStatusColumn)1