Search in sources :

Example 1 with GlusterVolumeParameters

use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters in project ovirt-engine by oVirt.

the class VolumeListModel method startVolumeProfiling.

private void startVolumeProfiling() {
    if (getSelectedItems() == null) {
        return;
    }
    List<GlusterVolumeEntity> selectedVolumesList = getSelectedItems();
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (GlusterVolumeEntity currentSelectedVolume : selectedVolumesList) {
        GlusterVolumeParameters parameter = new GlusterVolumeParameters(currentSelectedVolume.getId());
        parameters.add(parameter);
    }
    Frontend.getInstance().runMultipleAction(ActionType.StartGlusterVolumeProfile, parameters);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)

Example 2 with GlusterVolumeParameters

use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters in project ovirt-engine by oVirt.

the class VolumeListModel method stopVolumeProfiling.

private void stopVolumeProfiling() {
    if (getSelectedItems() == null) {
        return;
    }
    List<GlusterVolumeEntity> selectedVolumesList = getSelectedItems();
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (GlusterVolumeEntity currentSelectedVolume : selectedVolumesList) {
        GlusterVolumeParameters parameter = new GlusterVolumeParameters(currentSelectedVolume.getId());
        parameters.add(parameter);
    }
    Frontend.getInstance().runMultipleAction(ActionType.StopGlusterVolumeProfile, parameters);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)

Example 3 with GlusterVolumeParameters

use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters in project ovirt-engine by oVirt.

the class GlusterBrickEventSubscriber method processEvent.

@Override
public void processEvent(GlusterEvent event) {
    if (event == null) {
        log.debug("No event to process!");
        return;
    }
    GlusterServer glusterServer = glusterServerDao.getByGlusterServerUuid(Guid.createGuidFromString(event.getNodeId()));
    if (glusterServer == null) {
        log.debug("Could not determine gluster server from event '{}'", event);
        return;
    }
    VdsStatic host = vdsStaticDao.get(glusterServer.getId());
    if (host == null) {
        log.debug("No host corresponding to gluster server in '{}'", event);
        return;
    }
    GlusterVolumeEntity vol = glusterVolumeDao.getByName(host.getClusterId(), (String) event.getMessage().get("volume"));
    if (vol == null) {
        return;
    }
    if (event.getEvent().equalsIgnoreCase(EVENT_BRICK_DISCONNECTED) || event.getEvent().equalsIgnoreCase(EVENT_BRICK_CONNECTED)) {
        // get brick
        GlusterStatus status = event.getEvent().equalsIgnoreCase(EVENT_BRICK_DISCONNECTED) ? GlusterStatus.DOWN : GlusterStatus.UP;
        String path = (String) event.getMessage().get(BRICK);
        String peer = (String) event.getMessage().get(PEER);
        List<VdsStatic> vdsList = vdsStaticDao.getAllForCluster(host.getClusterId());
        VdsStatic vds = vdsList.stream().filter(v -> v.getName().equals(peer) || interfaceDao.getAllInterfacesForVds(v.getId()).stream().anyMatch(iface -> iface.getIpv4Address().equals(peer))).findFirst().orElse(null);
        GlusterBrickEntity brick = vds != null ? glusterBrickDao.getBrickByServerIdAndDirectory(vds.getId(), path) : null;
        if (brick != null) {
            glusterBrickDao.updateBrickStatus(brick.getId(), status);
            logBrickStatusChange(vol, status, brick);
        } else {
            // call sync to force updation
            log.debug("Forcing sync as brick event '{}' received that could not be resolved to brick", event);
            backend.runInternalAction(ActionType.RefreshGlusterVolumeDetails, new GlusterVolumeParameters(vol.getId()));
        }
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterServer(org.ovirt.engine.core.common.businessentities.gluster.GlusterServer) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)

Aggregations

GlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)3 ArrayList (java.util.ArrayList)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)2 VdsStatic (org.ovirt.engine.core.common.businessentities.VdsStatic)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 GlusterServer (org.ovirt.engine.core.common.businessentities.gluster.GlusterServer)1 GlusterStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus)1