Search in sources :

Example 41 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity 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);
}
Also used : GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 42 with GlusterVolumeEntity

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

the class AsyncDataProvider method getVolumeList.

public void getVolumeList(AsyncQuery<List<GlusterVolumeEntity>> aQuery, String clusterName, boolean doRefresh) {
    if ((ApplicationModeHelper.getUiMode().getValue() & ApplicationMode.GlusterOnly.getValue()) == 0) {
        aQuery.getAsyncCallback().onSuccess(new ArrayList<GlusterVolumeEntity>());
        return;
    }
    aQuery.converterCallback = new ListConverter<>();
    SearchParameters searchParameters;
    searchParameters = // $NON-NLS-1$
    clusterName == null ? // $NON-NLS-1$
    new SearchParameters("Volumes:", SearchType.GlusterVolume) : // $NON-NLS-1$
    new SearchParameters("Volumes: cluster.name=" + clusterName, SearchType.GlusterVolume);
    searchParameters.setMaxCount(9999);
    if (!doRefresh) {
        searchParameters.withoutRefresh();
    }
    Frontend.getInstance().runQuery(QueryType.Search, searchParameters, aQuery);
}
Also used : SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 43 with GlusterVolumeEntity

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

the class GlusterStorageView method initEditors.

void initEditors() {
    linkGlusterVolumeEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    glusterVolumesEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<GlusterVolumeEntity>() {

        @Override
        protected String renderNullSafe(GlusterVolumeEntity glusterVolume) {
            if (glusterVolume == null) {
                // $NON-NLS-1$
                return "";
            } else {
                if (glusterVolume.getBricks().isEmpty()) {
                    return glusterVolume.getName();
                }
                GlusterBrickEntity brick = glusterVolume.getBricks().get(0);
                if (brick == null) {
                    return glusterVolume.getName();
                }
                String server = brick.getNetworkId() != null && StringHelper.isNotNullOrEmpty(brick.getNetworkAddress()) ? brick.getNetworkAddress() : brick.getServerName();
                // $NON-NLS-1$
                return server + ":/" + glusterVolume.getName();
            }
        }
    });
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)

Example 44 with GlusterVolumeEntity

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

the class SetGlusterVolumeSnapshotConfigVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    GlusterVolumeSnapshotConfig cfgParam = getParameters().getConfgParam();
    String paramValue = StringUtils.removeEnd(cfgParam.getParamValue(), "%");
    if (cfgParam.getVolumeId() != null) {
        GlusterVolumeEntity volume = DbFacade.getInstance().getGlusterVolumeDao().getById(cfgParam.getVolumeId());
        status = getBroker().glusterVolumeSnapshotConfigSet(volume.getName(), cfgParam.getParamName(), paramValue);
    } else {
        status = getBroker().glusterSnapshotConfigSet(cfgParam.getParamName(), paramValue);
    }
    proceedProxyReturnValue();
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Example 45 with GlusterVolumeEntity

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

the class CreateGlusterVolumeVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    GlusterVolumeEntity volume = getParameters().getVolume();
    boolean isForce = getParameters().isForce();
    uuidReturn = getBroker().glusterVolumeCreate(volume.getName(), volume.getBrickDirectories().toArray(new String[0]), volume.getReplicaCount(), volume.getStripeCount(), getTransportTypeArr(volume), isForce, volume.getIsArbiter());
    // Handle errors if any
    proceedProxyReturnValue();
    if (getVDSReturnValue().getSucceeded()) {
        // set the volume updated with id as the return value
        volume.setId(Guid.createGuidFromStringDefaultEmpty(uuidReturn.uuid));
        setReturnValue(volume);
    }
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)

Aggregations

GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)220 ArrayList (java.util.ArrayList)57 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)49 Test (org.junit.Test)47 Guid (org.ovirt.engine.core.compat.Guid)30 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)30 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)26 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)20 VDS (org.ovirt.engine.core.common.businessentities.VDS)19 HashMap (java.util.HashMap)16 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)16 List (java.util.List)15 Map (java.util.Map)15 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)15 ActionType (org.ovirt.engine.core.common.action.ActionType)13 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)13 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)13 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)13 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)12 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)12