Package com.cloud.utils.exception

Examples of com.cloud.utils.exception.ExecutionException


        lbPools.add(pool);
      }

      return lbPools;
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here


        members.add(member.getAddress() + "-" + member.getPort());
      }

      return members;
    } catch (RemoteException e) {
      throw new ExecutionException(e.getMessage());
    }
  }
View Full Code Here

          answer.ipBytes.put(virtualServerIp, bytesSentAndReceived);     
        }
      }
    } catch (Exception e) {
      s_logger.error(e);
      throw new ExecutionException(e.getMessage());
    }
   
    return answer;
  }
View Full Code Here

                throw new Exception("Error code : " + statusCode);
            }
            response = method.getResponseBody();
        }catch(Exception e){
            System.out.println(e.getMessage());
            throw new ExecutionException(e.getMessage());
        }
        System.out.println(new String(response));
        return new String(response);
    }
View Full Code Here

            if (errorCode.equals("103")) {
                //tenant already exists
                return true;
            }
            String errorDescr = checked.get("errorDescr");
            throw new ExecutionException(errorDescr);
        }
        return true;
    }
View Full Code Here

        try {
            doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlSource);
           
        } catch (Exception e) {
            s_logger.error(e);
            throw new ExecutionException(e.getMessage());
        }

        if (doc == null) {
            throw new ExecutionException("Failed to parse xml " + xml);
        } else {
            return doc;
        }
    }   
View Full Code Here

        String vlanId = cmd.getContextParam(NetworkElementCommand.GUEST_VLAN_TAG);
        String tenant = "vlan-" + vlanId;
        String policyIdentifier = cmd.getIpAddress().getPublicIp().replace('.', '-');
        try {
            if (!_connection.createTenantVDCNatPolicySet(tenant)) {
                throw new ExecutionException("Failed to create NAT policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCSourceNatPolicy(tenant, policyIdentifier)) {
                throw new ExecutionException("Failed to create source NAT policy in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCSourceNatPolicyRef(tenant, policyIdentifier)) {
                throw new ExecutionException("Failed to associate source NAT policy with NAT policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCSourceNatIpPool(tenant, policyIdentifier, cmd.getIpAddress().getPublicIp())) {
                throw new ExecutionException("Failed to create source NAT ip pool in VNMC for guest network with vlan " + vlanId);
            }

            String[] ipRange = getIpRangeFromCidr(cmd.getContextParam(NetworkElementCommand.GUEST_NETWORK_CIDR));
            if (!_connection.createTenantVDCSourceNatRule(tenant, policyIdentifier, ipRange[0], ipRange[1])) {
                throw new ExecutionException("Failed to create source NAT rule in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.associateNatPolicySet(tenant)) {
                throw new ExecutionException("Failed to associate source NAT policy set with edge security profile in VNMC for guest network with vlan " + vlanId);
            }
        } catch (ExecutionException e) {
            String msg = "SetSourceNatCommand failed due to " + e.getMessage();
            s_logger.error(msg, e);
            return new Answer(cmd, false, msg);
View Full Code Here

            publicIpRulesMap.get(publicIp).add(rule);
        }

        try {
            if (!_connection.createTenantVDCAclPolicySet(tenant, true)) {
                throw new ExecutionException("Failed to create ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
            }
            if (!_connection.createTenantVDCAclPolicySet(tenant, false)) {
                throw new ExecutionException("Failed to create ACL egress policy set in VNMC for guest network with vlan " + vlanId);
            }

            for (String publicIp : publicIpRulesMap.keySet()) {
                String policyIdentifier = publicIp.replace('.', '-');

                if (!_connection.createTenantVDCAclPolicy(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to create ACL policy in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, true)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, false)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL egress policy set in VNMC for guest network with vlan " + vlanId);
                }

                for (FirewallRuleTO rule : publicIpRulesMap.get(publicIp)) {
                    if (rule.revoked()) {
                        if (!_connection.deleteTenantVDCAclRule(tenant, rule.getId(), policyIdentifier)) {
                            throw new ExecutionException("Failed to delete ACL rule in VNMC for guest network with vlan " + vlanId);
                        }
                    } else {
                        String[] externalIpRange = getIpRangeFromCidr(rule.getSourceCidrList().get(0));
                        if (rule.getTrafficType() == TrafficType.Ingress) {
                            if (!rule.getProtocol().equalsIgnoreCase("icmp")
                                    && rule.getSrcPortRange() != null) {
                                if (!_connection.createTenantVDCIngressAclRule(tenant,
                                        rule.getId(), policyIdentifier,
                                        rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1],
                                        Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
                                    throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId);
                                }
                            } else {
                                if (!_connection.createTenantVDCIngressAclRule(tenant,
                                        rule.getId(), policyIdentifier,
                                        rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) {
                                    throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId);
                                }
                            }
                        } else {
                            if ((rule.getProtocol().equalsIgnoreCase("tcp") || rule.getProtocol().equalsIgnoreCase("udp"))
                                    && rule.getSrcPortRange() != null) {
                                if (!_connection.createTenantVDCEgressAclRule(tenant,
                                        rule.getId(), policyIdentifier,
                                        rule.getProtocol().toUpperCase(),
                                        externalIpRange[0], externalIpRange[1],
                                        Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
                                    throw new ExecutionException("Failed to create ACL egress rule in VNMC for guest network with vlan " + vlanId);
                                }
                            } else {
                                if (!_connection.createTenantVDCEgressAclRule(tenant,
                                        rule.getId(), policyIdentifier,
                                        rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) {
                                    throw new ExecutionException("Failed to create ACL egress rule in VNMC for guest network with vlan " + vlanId);
                                }
                            }
                        }
                    }
                }
            }

            if (!_connection.associateAclPolicySet(tenant)) {
                throw new ExecutionException("Failed to associate ACL policy set with edge security profile in VNMC for guest network with vlan " + vlanId);
            }
        } catch (ExecutionException e) {
            String msg = "SetFirewallRulesCommand failed due to " + e.getMessage();
            s_logger.error(msg, e);
            return new Answer(cmd, false, msg);
View Full Code Here

            publicIpRulesMap.get(publicIp).add(rule);
        }

        try {
            if (!_connection.createTenantVDCNatPolicySet(tenant)) {
                throw new ExecutionException("Failed to create NAT policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCAclPolicySet(tenant, true)) {
                throw new ExecutionException("Failed to create ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCAclPolicySet(tenant, false)) {
                throw new ExecutionException("Failed to create ACL egress policy set in VNMC for guest network with vlan " + vlanId);
            }

            for (String publicIp : publicIpRulesMap.keySet()) {
                String policyIdentifier = publicIp.replace('.', '-');

                if (!_connection.createTenantVDCDNatPolicy(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to create DNAT policy in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCDNatPolicyRef(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to associate DNAT policy with NAT policy set in VNMC for guest network with vlan " + vlanId);
                }

                if (!_connection.createTenantVDCAclPolicy(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to create ACL policy in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, true)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, false)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL egress policy set in VNMC for guest network with vlan " + vlanId);
                }

                for (StaticNatRuleTO rule : publicIpRulesMap.get(publicIp)) {
                    if (rule.revoked()) {
                        if (!_connection.deleteTenantVDCDNatRule(tenant, rule.getId(), policyIdentifier)) {
                            throw new ExecutionException("Failed to delete DNAT rule in VNMC for guest network with vlan " + vlanId);
                        }
                    } else {
                        if (!_connection.createTenantVDCDNatIpPool(tenant, Long.toString(rule.getId()), rule.getDstIp())) {
                            throw new ExecutionException("Failed to create DNAT ip pool in VNMC for guest network with vlan " + vlanId);
                        }

                        if (!_connection.createTenantVDCDNatRule(tenant,
                                rule.getId(), policyIdentifier, rule.getSrcIp())) {
                            throw new ExecutionException("Failed to create DNAT rule in VNMC for guest network with vlan " + vlanId);
                        }
                    }
                }
            }

            if (!_connection.associateAclPolicySet(tenant)) {
                throw new ExecutionException("Failed to associate source NAT policy set with edge security profile in VNMC for guest network with vlan " + vlanId);
            }
        } catch (ExecutionException e) {
            String msg = "SetStaticNatRulesCommand failed due to " + e.getMessage();
            s_logger.error(msg, e);
            return new Answer(cmd, false, msg);
View Full Code Here

            publicIpRulesMap.get(publicIp).add(rule);
        }

        try {
            if (!_connection.createTenantVDCNatPolicySet(tenant)) {
                throw new ExecutionException("Failed to create NAT policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCAclPolicySet(tenant, true)) {
                throw new ExecutionException("Failed to create ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
            }

            if (!_connection.createTenantVDCAclPolicySet(tenant, false)) {
                throw new ExecutionException("Failed to create ACL egress policy set in VNMC for guest network with vlan " + vlanId);
            }

            for (String publicIp : publicIpRulesMap.keySet()) {
                String policyIdentifier = publicIp.replace('.', '-');

                if (!_connection.createTenantVDCPFPolicy(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to create PF policy in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCPFPolicyRef(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to associate PF policy with NAT policy set in VNMC for guest network with vlan " + vlanId);
                }

                if (!_connection.createTenantVDCAclPolicy(tenant, policyIdentifier)) {
                    throw new ExecutionException("Failed to create ACL policy in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, true)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL ingress policy set in VNMC for guest network with vlan " + vlanId);
                }
                if (!_connection.createTenantVDCAclPolicyRef(tenant, policyIdentifier, false)) {
                    throw new ExecutionException("Failed to associate ACL policy with ACL egress policy set in VNMC for guest network with vlan " + vlanId);
                }

                for (PortForwardingRuleTO rule : publicIpRulesMap.get(publicIp)) {
                    if (rule.revoked()) {
                        if (!_connection.deleteTenantVDCPFRule(tenant, rule.getId(), policyIdentifier)) {
                            throw new ExecutionException("Failed to delete PF rule in VNMC for guest network with vlan " + vlanId);
                        }
                    } else {
                        if (!_connection.createTenantVDCPFIpPool(tenant, Long.toString(rule.getId()), rule.getDstIp())) {
                            throw new ExecutionException("Failed to create PF ip pool in VNMC for guest network with vlan " + vlanId);
                        }
                        if (!_connection.createTenantVDCPFPortPool(tenant, Long.toString(rule.getId()),
                                Integer.toString(rule.getDstPortRange()[0]), Integer.toString(rule.getDstPortRange()[1]))) {
                            throw new ExecutionException("Failed to create PF port pool in VNMC for guest network with vlan " + vlanId);
                        }

                        if (!_connection.createTenantVDCPFRule(tenant,
                                rule.getId(), policyIdentifier,
                                rule.getProtocol().toUpperCase(), rule.getSrcIp(),
                                Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
                            throw new ExecutionException("Failed to create PF rule in VNMC for guest network with vlan " + vlanId);
                        }
                    }
                }
            }

            if (!_connection.associateAclPolicySet(tenant)) {
                throw new ExecutionException("Failed to associate source NAT policy set with edge security profile in VNMC for guest network with vlan " + vlanId);
            }
        } catch (ExecutionException e) {
            String msg = "SetPortForwardingRulesCommand failed due to " + e.getMessage();
            s_logger.error(msg, e);
            return new Answer(cmd, false, msg);
View Full Code Here

TOP

Related Classes of com.cloud.utils.exception.ExecutionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.