use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBrickResource method remove.
@Override
public Response remove() {
get();
GlusterBrick brick = new GlusterBrick();
brick.setId(id);
GlusterBricks bricks = new GlusterBricks();
bricks.getGlusterBricks().add(brick);
Action action = new Action();
action.setBricks(bricks);
return parent.remove(action);
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method performCreationMultiple.
protected Response performCreationMultiple(ActionType task, ActionParametersBase taskParams, EntityIdResolver<Guid> entityResolver) {
ActionReturnValue createResult;
try {
createResult = doAction(task, taskParams);
} catch (Exception e) {
return handleError(e, false);
}
GlusterBricks model = resolveCreatedList(createResult, entityResolver);
Response response = null;
if (model == null) {
response = Response.status(ACCEPTED_STATUS).build();
} else {
response = Response.created(URI.create(getUriInfo().getPath())).entity(model).build();
}
return response;
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method remove.
@Override
public Response remove(Action action) {
GlusterBricks bricks = action.getBricks();
if (bricks.getGlusterBricks().size() > 0) {
for (GlusterBrick brick : bricks.getGlusterBricks()) {
validateParameters(brick, "id|name");
}
}
int replicaCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, REPLICA_COUNT, 0, 0);
GlusterVolumeRemoveBricksParameters params = toParameters(bricks);
params.setReplicaCount(replicaCount);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return performAction(ActionType.CommitRemoveGlusterVolumeBricks, params);
} else {
return performAction(ActionType.GlusterVolumeRemoveBricks, params);
}
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class V3GlusterVolumeInAdapter method adapt.
@Override
public GlusterVolume adapt(V3GlusterVolume from) {
GlusterVolume to = new GlusterVolume();
if (from.isSetLinks()) {
to.getLinks().addAll(adaptIn(from.getLinks()));
}
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetBricks()) {
to.setBricks(new GlusterBricks());
to.getBricks().getGlusterBricks().addAll(adaptIn(from.getBricks().getGlusterBricks()));
}
if (from.isSetCluster()) {
to.setCluster(adaptIn(from.getCluster()));
}
if (from.isSetComment()) {
to.setComment(from.getComment());
}
if (from.isSetDescription()) {
to.setDescription(from.getDescription());
}
if (from.isSetDisperseCount()) {
to.setDisperseCount(from.getDisperseCount());
}
if (from.isSetId()) {
to.setId(from.getId());
}
if (from.isSetHref()) {
to.setHref(from.getHref());
}
if (from.isSetName()) {
to.setName(from.getName());
}
if (from.isSetOptions()) {
to.setOptions(new Options());
to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
}
if (from.isSetRedundancyCount()) {
to.setRedundancyCount(from.getRedundancyCount());
}
if (from.isSetReplicaCount()) {
to.setReplicaCount(from.getReplicaCount());
}
if (from.isSetStatus() && from.getStatus().isSetState()) {
to.setStatus(GlusterVolumeStatus.fromValue(from.getStatus().getState()));
}
if (from.isSetStripeCount()) {
to.setStripeCount(from.getStripeCount());
}
if (from.isSetTransportTypes()) {
to.setTransportTypes(new GlusterVolume.TransportTypesList());
to.getTransportTypes().getTransportTypes().addAll(adaptTransportTypes(from));
}
if (from.isSetVolumeType()) {
to.setVolumeType(GlusterVolumeType.fromValue(from.getVolumeType()));
}
return to;
}
use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.
the class V3GlusterBricksInAdapter method adapt.
@Override
public GlusterBricks adapt(V3GlusterBricks from) {
GlusterBricks to = new GlusterBricks();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getGlusterBricks().addAll(adaptIn(from.getGlusterBricks()));
return to;
}
Aggregations