use of org.apache.cloudstack.network.contrail.api.response.ServiceInstanceResponse in project cloudstack by apache.
the class CreateServiceInstanceCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
try {
_vrouterService.startServiceInstance(getEntityId());
ServiceInstanceResponse response = _vrouterService.createServiceInstanceResponse(getEntityId());
response.setObjectName("serviceinstance");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (Exception ex) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
use of org.apache.cloudstack.network.contrail.api.response.ServiceInstanceResponse in project cloudstack by apache.
the class ServiceManagerImpl method createServiceInstanceResponse.
@Override
public ServiceInstanceResponse createServiceInstanceResponse(long instanceId) {
s_logger.debug("ServiceInstance response for id: " + instanceId);
UserVmVO vm = _vmDao.findById(instanceId);
ServiceInstanceResponse response = new ServiceInstanceResponse();
response.setId(vm.getUuid());
Account owner = _accountService.getAccount(vm.getAccountId());
if (owner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
Project project = ApiDBUtils.findProjectByProjectAccountIdIncludingRemoved(owner.getAccountId());
response.setProjectId(project.getUuid());
response.setProjectName(project.getName());
} else {
response.setAccountName(owner.getAccountName());
}
return response;
}
Aggregations