Package com.cloud.exception

Examples of com.cloud.exception.DiscoveryException


    }

    @Override
    public SwiftVO addSwift(AddSwiftCmd cmd) throws DiscoveryException {
        if (!isSwiftEnabled()) {
            throw new DiscoveryException("Swift is not enabled");
        }
        SwiftVO swift = new SwiftVO(cmd.getUrl(), cmd.getAccount(), cmd.getUsername(), cmd.getKey());
        swift = _swiftDao.persist(swift);
        return swift;
    }
View Full Code Here


    }
   
    private void verifyConnection(final S3TO s3) throws DiscoveryException {

        if (!canConnect(s3)) {
            throw new DiscoveryException(format("Unable to connect to S3 "
                    + "using access key %1$s, secret key %2$s, and endpoint, "
                    + "%3$S", s3.getAccessKey(), s3.getSecretKey(),
                    s3.getEndPoint() != null ? s3.getEndPoint() : "default"));
        }
View Full Code Here

    }

    private void enforceS3PreConditions() throws DiscoveryException {

        if (!this.isS3Enabled()) {
            throw new DiscoveryException("S3 is not enabled.");
        }

        if (this.getS3TO() != null) {
            throw new DiscoveryException("Attempt to define multiple S3 "
                    + "instances.  Only one instance definition is supported.");
        }

    }
View Full Code Here

            if (pingAns == null || !pingAns.getResult()) {
                String errMsg =
                        "Agent not running, or no route to agent on at "
                                + uri;
                s_logger.debug(errMsg);
                throw new DiscoveryException(errMsg);
            }

            Map<HypervDirectConnectResource, Map<String, String>> resources =
                    new HashMap<HypervDirectConnectResource,
                    Map<String, String>>();
View Full Code Here

            com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(hostIp, 22);
            sshConnection.connect(null, 60000, 60000);
            sshConnection = SSHCmdHelper.acquireAuthorizedConnection(hostIp, username, password);
            if (sshConnection == null) {
                throw new DiscoveryException(String.format("Cannot connect to ovm host(IP=%1$s, username=%2$s, password=%3$s, discover failed", hostIp, username, password));
            }

            if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "[ -f '/etc/ovs-agent/agent.ini' ]")) {
                throw new DiscoveryException("Can not find /etc/ovs-agent/agent.ini " + hostIp);
            }

            Map<String, String> details = new HashMap<String, String>();
            OvmResourceBase ovmResource = new OvmResourceBase();
            details.put("ip", hostIp);
View Full Code Here

                success = true;
                return result;
            }

            s_logger.warn("Unable to find the server resources at " + url);
            throw new DiscoveryException("Unable to add the external cluster");
        } finally {
            if (!success) {
                _clusterDetailsDao.deleteDetails(cluster.getId());
                _clusterDao.remove(cluster.getId());
            }
View Full Code Here

            }
        }
        if (!isHypervisorTypeSupported) {
            String msg = "Do not support HypervisorType " + hypervisorType + " for " + url;
            s_logger.warn(msg);
            throw new DiscoveryException(msg);
        }
        s_logger.warn("Unable to find the server resources at " + url);
        throw new DiscoveryException("Unable to add the host");
    }
View Full Code Here

            String masterIp = _connPool.getMasterIp(hostIp, username, pass);
            conn = _connPool.masterConnect(masterIp, username, pass);
            if (conn == null) {
                String msg = "Unable to get a connection to " + url;
                s_logger.debug(msg);
                throw new DiscoveryException(msg);
            }

            Set<Pool> pools = Pool.getAll(conn);
            Pool pool = pools.iterator().next();
            Pool.Record pr = pool.getRecord(conn);
            String poolUuid = pr.uuid;
            Map<Host, Host.Record> hosts = Host.getAllRecords(conn);

            /*set cluster hypervisor type to xenserver*/
            ClusterVO clu = _clusterDao.findById(clusterId);
            if ( clu.getGuid()== null ) {
                setClusterGuid(clu, poolUuid);
            } else {
                List<HostVO> clusterHosts = _resourceMgr.listAllHostsInCluster(clusterId);
                if( clusterHosts != null && clusterHosts.size() > 0) {
                    if (!clu.getGuid().equals(poolUuid)) {
                        if (hosts.size() == 1) {
                            if (!addHostsToPool(conn, hostIp, clusterId)) {
                                String msg = "Unable to add host(" + hostIp + ") to cluster " + clusterId;
                                s_logger.warn(msg);
                                throw new DiscoveryException(msg);
                            }
                        } else {
                            String msg = "Host (" + hostIp + ") is already in pool(" + poolUuid + "), can to join pool(" + clu.getGuid() + ")";
                            s_logger.warn(msg);
                            throw new DiscoveryException(msg);
                        }
                    }
                } else {
                    setClusterGuid(clu, poolUuid);
                }
View Full Code Here

            throw new CloudRuntimeException("Unable to reach the pool master of the existing cluster");
        }

        if( !_connPool.joinPool(conn, hostIp, masterIp, username, pass) ){
            s_logger.warn("Unable to join the pool");
            throw new DiscoveryException("Unable to join the pool");
        }
        return true;
    }
View Full Code Here

            String vsmPassword = _urlParams.get("vsmpassword");
            String clusterName = cluster.getName();
            try {
                vsmInfo = _nexusElement.validateAndAddVsm(vsmIp, vsmUser, vsmPassword, clusterId, clusterName);
            } catch(ResourceInUseException ex) {
                DiscoveryException discEx = new DiscoveryException(ex.getLocalizedMessage() + ". The resource is " + ex.getResourceName());
                throw discEx;
            }
            vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
    }
View Full Code Here

TOP

Related Classes of com.cloud.exception.DiscoveryException

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.