use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class UpdateNetworkOfferingCmd method execute.
@Override
public void execute() {
NetworkOffering result = _configService.updateNetworkOffering(this);
if (result != null) {
NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class MigrateVolumeCmd method execute.
@Override
public void execute() {
Volume result;
try {
result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId());
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
} catch (ConcurrentOperationException e) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class PreparePrimaryStorageForMaintenanceCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
StoragePool result = _storageService.preparePrimaryStorageForMaintenance(getId());
if (result != null) {
StoragePoolResponse response = _responseGenerator.createStoragePoolResponse(result);
response.setResponseName("storagepool");
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class RebootSystemVmCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Vm Id: " + getId());
VirtualMachine result = _mgr.rebootSystemVM(this);
if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
}
}
use of com.cloud.api.ServerApiException in project CloudStack-archive by CloudStack-extras.
the class RebootVMCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException {
UserContext.current().setEventDetails("Vm Id: " + getId());
UserVm result;
if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) {
result = _bareMetalVmService.rebootVirtualMachine(this);
} else {
result = _userVmService.rebootVirtualMachine(this);
}
if (result != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot vm instance");
}
}
Aggregations