use of org.apache.cloudstack.api.response.VolumeResponse in project cloudstack by apache.
the class UploadVolumeCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
Volume volume = _volumeService.uploadVolume(this);
if (volume != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, volume);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
}
}
use of org.apache.cloudstack.api.response.VolumeResponse in project cloudstack by apache.
the class DetachVolumeCmd method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Volume Id: " + getId() + " VmId: " + getVirtualMachineId());
Volume result = _volumeService.detachVolumeFromVM(this);
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Restricted, result);
response.setResponseName("volume");
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
}
}
use of org.apache.cloudstack.api.response.VolumeResponse in project cloudstack by apache.
the class UploadVolumeCmdByAdmin method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
Volume volume = _volumeService.uploadVolume(this);
if (volume != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, volume);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
}
}
use of org.apache.cloudstack.api.response.VolumeResponse in project cloudstack by apache.
the class AttachVolumeCmdByAdmin method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Volume Id: " + getId() + " VmId: " + getVirtualMachineId());
Volume result = _volumeService.attachVolumeToVM(this);
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
}
}
use of org.apache.cloudstack.api.response.VolumeResponse in project cloudstack by apache.
the class DetachVolumeCmdByAdmin method execute.
@Override
public void execute() {
CallContext.current().setEventDetails("Volume Id: " + getId() + " VmId: " + getVirtualMachineId());
Volume result = _volumeService.detachVolumeFromVM(this);
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(ResponseView.Full, result);
response.setResponseName("volume");
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
}
}
Aggregations