Package com.cloud.exception

Examples of com.cloud.exception.ResourceUnavailableException


    @Override
    public boolean removeDhcpSupportForSubnet(Network network) throws ResourceUnavailableException{
        if (canHandle(network, Service.Dhcp)) {
            List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
            if ((routers == null) || (routers.size() == 0)) {
                   throw new ResourceUnavailableException("Can't find at least one router!", DataCenter.class, network.getDataCenterId());
            }
           try {
                return _routerMgr.removeDhcpSupportForSubnet(network, routers);
           }
           catch (ResourceUnavailableException e) {
View Full Code Here


            VirtualMachineProfile uservm = vm;

            List<DomainRouterVO> routers = getRouters(network, dest);

            if ((routers == null) || (routers.size() == 0)) {
                throw new ResourceUnavailableException("Can't find at least one router!", DataCenter.class, network.getDataCenterId());
            }

            return _routerMgr.applyDhcpEntry(network, nic, uservm, dest, routers);
        }
        return false;
View Full Code Here

            VirtualMachineProfile uservm = vm;

            List<DomainRouterVO> routers = getRouters(network, dest);

            if ((routers == null) || (routers.size() == 0)) {
                throw new ResourceUnavailableException("Can't find at least one router!", DataCenter.class, network.getDataCenterId());
            }

            return _routerMgr.applyUserData(network, nic, uservm, dest, routers);
        }
        return false;
View Full Code Here

            s_logger.debug("Router " + router.getInstanceName() + " is in " + router.getState() +
                    ", so not sending setup guest network command to the backend");
            return true;
        } else {
            s_logger.warn("Unable to setup guest network on virtual router " + router + " is not in the right state " + router.getState());
            throw new ResourceUnavailableException("Unable to setup guest network on the backend," +
                    " virtual router " + router + " is not in the right state", DataCenter.class, router.getDataCenterId());
        }
    }
View Full Code Here

            s_logger.debug("Router " + router.getInstanceName() + " is in " + router.getState() +
                    ", so not sending setup private network command to the backend");
        } else {
            s_logger.warn("Unable to setup private gateway, virtual router " + router + " is not in the right state " + router.getState());
           
            throw new ResourceUnavailableException("Unable to setup Private gateway on the backend," +
                    " virtual router " + router + " is not in the right state", DataCenter.class, router.getDataCenterId());
        }
        return true;
    }
View Full Code Here

                s_logger.debug("Router " + router.getInstanceName() + " is in " + router.getState() +
                        ", so not sending StaticRoute command to the backend");
            } else {
                s_logger.warn("Unable to apply StaticRoute, virtual router is not in the right state " + router.getState());
               
                throw new ResourceUnavailableException("Unable to apply StaticRoute on the backend," +
                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
            }
        }
        return result;
    }
View Full Code Here

    @Override
    public boolean startSite2SiteVpn(Site2SiteVpnConnection conn, VirtualRouter router) throws ResourceUnavailableException {
        if (router.getState() != State.Running) {
            s_logger.warn("Unable to apply site-to-site VPN configuration, virtual router is not in the right state " + router.getState());
            throw new ResourceUnavailableException("Unable to apply site 2 site VPN configuration," +
                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
        }

        return applySite2SiteVpn(true, router, conn);
    }
View Full Code Here

    @Override
    public boolean stopSite2SiteVpn(Site2SiteVpnConnection conn, VirtualRouter router) throws ResourceUnavailableException {
        if (router.getState() != State.Running) {
            s_logger.warn("Unable to apply site-to-site VPN configuration, virtual router is not in the right state " + router.getState());
            throw new ResourceUnavailableException("Unable to apply site 2 site VPN configuration," +
                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
        }

        return applySite2SiteVpn(false, router, conn);
    }
View Full Code Here

    public String[] applyVpnUsers(RemoteAccessVpn vpn, List<? extends VpnUser> users, VirtualRouter router) throws ResourceUnavailableException {
      Vpc vpc = _vpcDao.findById(vpn.getVpcId());

        if (router.getState() != State.Running) {
          s_logger.warn("Failed to add/remove Remote Access VPN users: router not in running state");
          throw new ResourceUnavailableException("Failed to add/remove Remote Access VPN users: router not in running state: " +
              router.getState(), DataCenter.class, vpc.getZoneId());
        }

        Commands cmds = new Commands(Command.OnError.Continue);
View Full Code Here

   
    @Override
    public boolean startRemoteAccessVpn(RemoteAccessVpn vpn, VirtualRouter router) throws ResourceUnavailableException {
        if (router.getState() != State.Running) {
            s_logger.warn("Unable to apply remote access VPN configuration, virtual router is not in the right state " + router.getState());
            throw new ResourceUnavailableException("Unable to apply remote access VPN configuration," +
                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
        }

        Commands cmds = new Commands(Command.OnError.Stop);
        createApplyVpnCommands(true, vpn, router, cmds);

        try {
          _agentMgr.send(router.getHostId(), cmds);
        } catch (OperationTimedoutException e) {
          s_logger.debug("Failed to start remote access VPN: ", e);
          throw new AgentUnavailableException("Unable to send commands to virtual router ", router.getHostId(), e);
        }
        Answer answer = cmds.getAnswer("users");
        if (!answer.getResult()) {
          s_logger.error("Unable to start vpn: unable add users to vpn in zone " + router.getDataCenterId()
              + " for account " + vpn.getAccountId() + " on domR: " + router.getInstanceName()
              + " due to " + answer.getDetails());
          throw new ResourceUnavailableException("Unable to start vpn: Unable to add users to vpn in zone " +
              router.getDataCenterId() + " for account " + vpn.getAccountId() + " on domR: "
              + router.getInstanceName() + " due to " + answer.getDetails(), DataCenter.class, router.getDataCenterId());
        }
        answer = cmds.getAnswer("startVpn");
        if (!answer.getResult()) {
          s_logger.error("Unable to start vpn in zone " + router.getDataCenterId() + " for account " +
              vpn.getAccountId() + " on domR: " + router.getInstanceName() + " due to "
              + answer.getDetails());
          throw new ResourceUnavailableException("Unable to start vpn in zone " + router.getDataCenterId()
              + " for account " + vpn.getAccountId() + " on domR: " + router.getInstanceName()
              + " due to " + answer.getDetails(), DataCenter.class, router.getDataCenterId());
        }

        return true;
View Full Code Here

TOP

Related Classes of com.cloud.exception.ResourceUnavailableException

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.