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);
}
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);
}
Aggregations