@Override public PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) { List<PhysicalNetworkVO> networkList = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType); DataCenter dc = ApiDBUtils.findZoneById(zoneId); String dcUuid = String.valueOf(zoneId); if (dc != null) { dcUuid = dc.getUuid(); } if (networkList.isEmpty()) { InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the default physical network with traffic=" + trafficType + " in the specified zone id"); ex.addProxyObject(dcUuid, "zoneId"); throw ex; } if (networkList.size() > 1) { InvalidParameterValueException ex = new InvalidParameterValueException("More than one physical networks exist in zone id=" + zoneId + " with traffic type=" + trafficType); ex.addProxyObject(dcUuid, "zoneId"); throw ex; } return networkList.get(0); }
ex.addProxyObject(zone.getUuid(), "zoneId"); throw ex;
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { final DataCenter dataCenter = _resourceService.getZone(getZoneId()); if (dataCenter == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find zone by ID: " + getZoneId()); } final boolean result = haConfigManager.enableHA(dataCenter); CallContext.current().setEventDetails("Zone Id:" + dataCenter.getId() + " HA enabled: true"); CallContext.current().putContextParameter(DataCenter.class, dataCenter.getUuid()); setupResponse(result); }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { final DataCenter dataCenter = _resourceService.getZone(getZoneId()); if (dataCenter == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find zone by ID: " + getZoneId()); } final boolean result = haConfigManager.disableHA(dataCenter); CallContext.current().setEventDetails("Zone Id:" + dataCenter.getId() + " HA enabled: false"); CallContext.current().putContextParameter(DataCenter.class, dataCenter.getUuid()); setupResponse(result); }
DataCenter zone = ApiDBUtils.findZoneById(pod.getDataCenterId()); if (zone != null) { podResponse.setZoneId(zone.getUuid()); podResponse.setZoneName(zone.getName());
@Override final public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { final DataCenter zone = _resourceService.getZone(getZoneId()); if (zone == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find zone by ID: " + getZoneId()); } OutOfBandManagementResponse response = outOfBandManagementService.disableOutOfBandManagement(zone); CallContext.current().setEventDetails("Zone Id:" + zone.getId() + " out-of-band management enabled: false"); CallContext.current().putContextParameter(DataCenter.class, zone.getUuid()); response.setResponseName(getCommandName()); setResponseObject(response); }
@Override final public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { final DataCenter zone = _resourceService.getZone(getZoneId()); if (zone == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find zone by ID: " + getZoneId()); } OutOfBandManagementResponse response = outOfBandManagementService.enableOutOfBandManagement(zone); CallContext.current().setEventDetails("Zone Id:" + zone.getId() + " out-of-band management enabled: true"); CallContext.current().putContextParameter(DataCenter.class, zone.getUuid()); response.setResponseName(getCommandName()); setResponseObject(response); }
@Override public ExtractResponse createExtractResponse(Long id, Long zoneId, Long accountId, String mode, String url) { ExtractResponse response = new ExtractResponse(); response.setObjectName("template"); VMTemplateVO template = ApiDBUtils.findTemplateById(id); response.setId(template.getUuid()); response.setName(template.getName()); if (zoneId != null) { DataCenter zone = ApiDBUtils.findZoneById(zoneId); response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName()); } response.setMode(mode); response.setUrl(url); response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString()); Account account = ApiDBUtils.findAccountById(accountId); response.setAccountId(account.getUuid()); return response; }
clusterResponse.setZoneId(dc.getUuid()); clusterResponse.setZoneName(dc.getName());
ex.addProxyObject(zone.getUuid(), "zoneId"); throw ex;
DataCenter zone = ApiDBUtils.findZoneById(publicIp.getDataCenterId()); if (zone != null) { lbResponse.setZoneId(zone.getUuid()); lbResponse.setZoneName(zone.getName());
@Override public ExtractResponse createExtractResponse(Long uploadId, Long id, Long zoneId, Long accountId, String mode, String url) { ExtractResponse response = new ExtractResponse(); response.setObjectName("template"); VMTemplateVO template = ApiDBUtils.findTemplateById(id); response.setId(template.getUuid()); response.setName(template.getName()); if (zoneId != null) { DataCenter zone = ApiDBUtils.findZoneById(zoneId); response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName()); } response.setMode(mode); if (uploadId == null) { // region-wide image store response.setUrl(url); response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString()); } else { UploadVO uploadInfo = ApiDBUtils.findUploadById(uploadId); response.setUploadId(uploadInfo.getUuid()); response.setState(uploadInfo.getUploadState().toString()); response.setUrl(uploadInfo.getUploadUrl()); } Account account = ApiDBUtils.findAccountById(accountId); response.setAccountId(account.getUuid()); return response; }
@Override public void execute() { CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId())); String uploadUrl = _volumeService.extractVolume(this); if (uploadUrl != null) { ExtractResponse response = new ExtractResponse(); response.setResponseName(getCommandName()); response.setObjectName("volume"); Volume vol = _entityMgr.findById(Volume.class, id); response.setId(vol.getUuid()); response.setName(vol.getName()); DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId); response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName()); response.setMode(mode); response.setState(Upload.Status.DOWNLOAD_URL_CREATED.toString()); Account account = _entityMgr.findById(Account.class, getEntityOwnerId()); response.setAccountId(account.getUuid()); response.setUrl(uploadUrl); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume"); } } }
DataCenter zone = ApiDBUtils.findZoneById(profile.getZoneId()); if (zone != null) { response.setZoneId(zone.getUuid());
@Override public PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result) { PhysicalNetworkResponse response = new PhysicalNetworkResponse(); DataCenter zone = ApiDBUtils.findZoneById(result.getDataCenterId()); if (zone != null) { response.setZoneId(zone.getUuid()); } response.setNetworkSpeed(result.getSpeed()); response.setVlan(result.getVnetString()); if (result.getDomainId() != null) { Domain domain = ApiDBUtils.findDomainById(result.getDomainId()); if (domain != null) { response.setDomainId(domain.getUuid()); } } response.setId(result.getUuid()); if (result.getBroadcastDomainRange() != null) { response.setBroadcastDomainRange(result.getBroadcastDomainRange().toString()); } response.setIsolationMethods(result.getIsolationMethods()); response.setTags(result.getTags()); if (result.getState() != null) { response.setState(result.getState().toString()); } response.setName(result.getName()); response.setObjectName("physicalnetwork"); return response; }
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId()); if (zone != null) { snapshotResponse.setZoneId(zone.getUuid());
Account caller = CallContext.current().getCallingAccount(); if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getId())) { ResourceAllocationException ex = new ResourceAllocationException("Cannot perform this operation, " + "Zone is currently disabled" + "zoneId=" + zone.getUuid(), ResourceType.network); throw ex;
DataCenter zone = ApiDBUtils.findZoneById(portableIp.getAssociatedDataCenterId()); if (zone != null) { response.setAssociatedDataCenterId(zone.getUuid());
response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName());
vmResponse.setZoneId(zone.getUuid()); vmResponse.setZoneName(zone.getName()); vmResponse.setDns1(zone.getDns1());