Search in sources :

Example 1 with CreateGlusterVolumeParameters

use of org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters 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 2 with CreateGlusterVolumeParameters

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

the class VolumeListModel method onCreateVolume.

private void onCreateVolume() {
    VolumeModel volumeModel = (VolumeModel) getWindow();
    if (!volumeModel.validate()) {
        return;
    }
    Guid clusterId = volumeModel.getCluster().getSelectedItem().getId();
    final GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setClusterId(clusterId);
    volume.setName(volumeModel.getName().getEntity());
    GlusterVolumeType type = volumeModel.getTypeList().getSelectedItem();
    if (type.isStripedType()) {
        volume.setStripeCount(volumeModel.getStripeCountValue());
    }
    if (type.isReplicatedType()) {
        volume.setReplicaCount(volumeModel.getReplicaCountValue());
        volume.setIsArbiter(volumeModel.getArbiterVolume().getEntity());
    }
    volume.setVolumeType(type);
    if (volumeModel.getTcpTransportType().getEntity()) {
        volume.getTransportTypes().add(TransportType.TCP);
    }
    if (volumeModel.getRdmaTransportType().getEntity()) {
        volume.getTransportTypes().add(TransportType.RDMA);
    }
    ArrayList<GlusterBrickEntity> brickList = new ArrayList<>();
    for (Object model : volumeModel.getBricks().getItems()) {
        brickList.add((GlusterBrickEntity) ((EntityModel) model).getEntity());
    }
    volume.setBricks(brickList);
    if (volumeModel.getNfs_accecssProtocol().getEntity()) {
        volume.enableNFS();
    } else {
        volume.disableNFS();
    }
    if (volumeModel.getCifs_accecssProtocol().getEntity()) {
        volume.enableCifs();
    } else {
        volume.disableCifs();
    }
    volume.setAccessControlList(volumeModel.getAllowAccess().getEntity());
    volumeModel.startProgress();
    CreateGlusterVolumeParameters parameter = new CreateGlusterVolumeParameters(volume, volumeModel.isForceAddBricks());
    Frontend.getInstance().runAction(ActionType.CreateGlusterVolume, parameter, result -> {
        VolumeListModel localModel = (VolumeListModel) result.getState();
        localModel.postOnCreateVolume(result.getReturnValue(), volume);
    }, this);
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1 VolumeModel (org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel)1