protected void sendPortForwardingRules(List<PortForwardingRuleTO> portForwardingRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!portForwardingRules.isEmpty()) { SetPortForwardingRulesCommand cmd = new SetPortForwardingRulesCommand(portForwardingRules); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply port forwarding rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
protected void sendFirewallRules(List<FirewallRuleTO> firewallRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!firewallRules.isEmpty()) { SetFirewallRulesCommand cmd = new SetFirewallRulesCommand(firewallRules); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply static nat rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
protected void sendStaticNatRules(List<StaticNatRuleTO> staticNatRules, DataCenter zone, long externalFirewallId) throws ResourceUnavailableException { if (!staticNatRules.isEmpty()) { SetStaticNatRulesCommand cmd = new SetStaticNatRulesCommand(staticNatRules, null); Answer answer = _agentMgr.easySend(externalFirewallId, cmd); if (answer == null || !answer.getResult()) { String details = (answer != null) ? answer.getDetails() : "details unavailable"; String msg = "External firewall was unable to apply static nat rules to the SRX appliance in zone " + zone.getName() + " due to: " + details + "."; s_logger.error(msg); throw new ResourceUnavailableException(msg, DataCenter.class, zone.getId()); } } }
s_logger.debug("No pods found in zone " + zone.getName()); return null; s_logger.debug("There are no pods with enough memory/CPU capacity in zone " + zone.getName()); return null; } else { s_logger.debug("Found pod " + selectedPod.getName() + " in zone " + zone.getName()); return new Pair<Pod, Long>(selectedPod, podHostCandidates.get(selectedPod.getId()));
@Override public String getCanonicalName(Network net) { String netname; if (net.getTrafficType() == TrafficType.Guest) { return net.getName(); } else if (net.getTrafficType() == TrafficType.Management || net.getTrafficType() == TrafficType.Storage) { return managementNetworkName; } else if (net.getTrafficType() == TrafficType.Control) { return "__link_local__"; } else { DataCenter zone = _dcDao.findById(net.getDataCenterId()); String zonename = zone.getName(); zonename = zonename.replaceAll("\\s", ""); zonename = zonename.replace("-", "_"); netname = "__" + zonename + "_" + net.getTrafficType().toString() + "__"; } return netname; }
+ _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName()); if (privateIp != null) { throw new InvalidParameterValueException( "Private ip address " + startIp + " already used for private gateway" + " in zone " + _entityMgr.findById(DataCenter.class, pNtwk.getDataCenterId()).getName());
if (zone != null) { podResponse.setZoneId(zone.getUuid()); podResponse.setZoneName(zone.getName());
String domain = _domainService.getDomain(getDomainId()).getName(); throw new InvalidParameterValueException("Account name=" + getAccountName() + " domain=" + domain + " doesn't have virtual networks in zone=" + zone.getName());
String domain = _domainService.getDomain(getDomainId()).getName(); throw new InvalidParameterValueException("Account name=" + getAccountName() + " domain=" + domain + " doesn't have virtual networks in zone=" + zone.getName());
if (zone != null) { response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName());
if (privateIp != null) { throw new InvalidParameterValueException("Private ip address " + ipAddress + " already used for private gateway" + " in zone " + _entityMgr.findById(DataCenter.class, dcId).getName());
@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; }
if (dc != null) { clusterResponse.setZoneId(dc.getUuid()); clusterResponse.setZoneName(dc.getName());
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"); } } }
throw new PermissionDeniedException("Cannot perform this operation, Zone is currently disabled: " + zone.getName());
throw new PermissionDeniedException("Cannot perform this operation, Zone is currently disabled: " + zone.getName());
if (zone != null) { response.setZoneId(zone.getUuid()); response.setZoneName(zone.getName());