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