Package org.nimbustools.api.services.rm

Examples of org.nimbustools.api.services.rm.ResourceRequestDeniedException


            throw new SchedulingException("scheduler was instantiated " +
                    "incorrectly"); // note for future IoC muckers
        }

        if (coschedid != null && !this.slotManager.canCoSchedule()) {
            throw new ResourceRequestDeniedException("this " +
                    "scheduler can not coschedule, ensemble usage is not " +
                    "supported");
        }

        final int[] ids;
View Full Code Here


                "manager returned invalid response";

        final Reservation res = this.slotManager.reserveSpace(req, preemptable);

        if (res == null) {
            throw new ResourceRequestDeniedException(
                    invalidResponse + ": null response");
        }

        if (res.getResponseLength() == 0) {

            // Because reserveSpace will throw a request denied exception
            // if there was a problem asking for space, no node assignments
            // here we assume means best effort behavior is being used.
            // Check that assumption:

            if (!this.slotManager.isBestEffort()) {
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no address(es) were returned " +
                                "but not using a best-effort slot manager");
            }

            return res;
        }

        // otherwise, this will be a 'concrete' reservation

        if (res.getResponseLength() != req.getIds().length) {

            logger.fatal("node selection response is length " +
                         res.getResponseLength() +
                         " which does not match requested length " +
                         req.getIds().length + " -- attempting backout.");
           
            for (int i = 0; i < req.getIds().length; i++) {
                try {
                    this.slotManager.releaseSpace(req.getIds()[i]);
                } catch (ManageException e) {
                    if (logger.isDebugEnabled()) {
                        logger.error(e.getMessage(), e);
                    } else {
                        logger.error(e.getMessage());
                    }
                }
            }
            throw new ResourceRequestDeniedException(
                                "internal service error when reserving space");
        }

        final Calendar start = Calendar.getInstance();
        final Calendar stop = Calendar.getInstance();
View Full Code Here

        }

        try {

            if (this.db.isCoschedDone(coschedid)) {
                throw new ResourceRequestDeniedException(
                        "co-scheduling group " + Lager.ensembleid(coschedid) +
                        "has already had a successful done operation " +
                        "invocation.  No additions may be made.");
            }
View Full Code Here

            throws WorkspaceDatabaseException,
                   ResourceRequestDeniedException {

        if (this.db.isCoschedDone(coschedid)) {
            throw new ResourceRequestDeniedException(
                    "co-scheduling group " + Lager.ensembleid(coschedid) +
                    " has already had a successful done-operation" +
                    " invocation.");
        }

        final NodeRequest[] reqs = this.db.getNodeRequests(coschedid);

        if (reqs == null || reqs.length == 0) {
            throw new ResourceRequestDeniedException(
                    "co-scheduling group " + Lager.ensembleid(coschedid) +
                    " has no pending requests stored for it but done is" +
                    " being called?");
        }

        final Reservation res =
                this.slotManager.reserveCoscheduledSpace(reqs, coschedid);

        final String invalidResponse = "Implementation problem: slot " +
                "manager returned invalid response";

        if (res == null) {
            throw new ResourceRequestDeniedException(
                    invalidResponse + ": null response");
        }

        if (res.getResponseLength() == 0) {
           
            // Because reserveCoscheduledSpace should throw a request denied
            // exception if there was a problem asking for space, no node
            // assignments here we assume means best effort behavior is being
            // used. Check that assumption:

            if (!this.slotManager.isBestEffort()) {
                this.fatalityBackoutReservation(res);
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no address(es) but not a best " +
                                "effort manager");
            }
        }

        // If reserveCoscheduledSpace generated an exception we let it
        // fly and leave the option open to call done again, but from here
        // on it is now done for good.
        try {
            this.db.deleteNodeRequestsAndBeDone(coschedid);
        } catch (Throwable t) {
            String msg = "Problem removing node requests from co-scheduling " +
                    "tracking.  This is severe, should never happen.  " +
                    "Attempting backout of slot reservations, this will " +
                    "probably fail as well.  Problem: \"" + t.getMessage();

            logger.fatal(msg, t);

            final String fullResponse = msg + "\", Backout result: " +
                                  this.fatalityBackoutReservation(res);
            throw new WorkspaceDatabaseException(fullResponse);
        }

        if (!this.slotManager.isBestEffort()) {
           
            // NOTE: coscheduling creates a situation where otherwise
            // not-best-effort slot managers make the DefaultSchedulerAdapter
            // *appear* to the service as a best effort scheduler.  That is OK
            // and expected (because of the add, add, ..."done now" ensemble
            // mechanism).  But this in no way means that the particular slot
            // manager *plugin implementation* as plugin to the
            // DefaultSchedulerAdapter should behave any differently than we
            // expect it to.

            if (!res.hasDurationList()) {
                throw new ResourceRequestDeniedException(
                        invalidResponse + ": no durations");
            }

            final int len = res.getResponseLength();
            for (int i = 0; i < len; i++) {
View Full Code Here

        if (failure.getMessage() != null) {
            clientMsg = clientMsg + ".  Error encountered: " +
                        failure.getMessage();
        }

        throw new ResourceRequestDeniedException(clientMsg);

    }
View Full Code Here

            // (workspace_control will validate)
            // (e.g., xml constraints don't check for >255 )

            // TODO: move to authorization check section
            if (!staticIPAllowed) {
                throw new ResourceRequestDeniedException("request for " +
                        "non-allocate networking method is denied");
            }

            if (nic.getIpAddress() == null
                    || nic.getBroadcast() == null
                    || nic.getNetmask() == null) {
               
                final String err = "acquisition method '" + method + "' " +
                        "requires at least IP, broadcast, and netmask settings";
                throw new CreationException(err);
            }

            final String newMac = this.networkAdapter.newMAC();
            if (newMac == null) {
                net.append("ANY");
            } else {
                net.append(newMac);
            }
            net.append(XenUtil.WC_FIELD_SEPARATOR);

            //only handling bridged
            net.append("Bridged");
            net.append(XenUtil.WC_FIELD_SEPARATOR);

            net.append(method);
            net.append(XenUtil.WC_FIELD_SEPARATOR);

            // broadcast, gateway, and netmask can be null
            net.append(nic.getIpAddress()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(nic.getGateway()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(nic.getBroadcast()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(nic.getNetmask()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null");

        } else if (method.equals(NIC.ACQUISITION_AllocateAndConfigure)) {

            //todo: once default association is configurable, there
            //  will also be an option to disallow defaults.
            // association being null means this
            //if (association == null) {
            //    throw errorBind("noAllocate");
            //}

            if (nic.getIpAddress() != null ||
                nic.getHostname()  != null ||
                nic.getBroadcast() != null ||
                nic.getGateway()   != null ||
                nic.getNetmask()   != null ||
                nic.getNetwork()   != null) {

                final String err = "no specific NIC network settings should " +
                        "be specified for acquisition method '" + method + "'";
                throw new CreationException(err);
            }

            int vmid = -1; // for logging
            if (vm != null) {
                final Integer integer = vm.getID();
                if (integer != null) {
                    vmid = integer.intValue();
                }
            }

            final Object[] entryAndDns =
                    this.networkAdapter.getNextEntry(association, vmid);

            if (entryAndDns == null || entryAndDns[0] == null) {
                // can't happen here, exception already thrown, but this is here
                // for clarity (and code analysis tools)
                final String err = "network '" + association
                        + "' is not currently available";
                logger.error(err);
                throw new ResourceRequestDeniedException(err);
            }

            final AssociationEntry entry = (AssociationEntry) entryAndDns[0];

            final String assignedMAC = entry.getMac();
View Full Code Here

        String[] pools = db.getResourcePools();
        if (resourcePool != null && Arrays.asList(pools).contains(resourcePool) == false) {

            String err = "Resource pool (Availability Zone) '" + resourcePool + "' does not exist.";
            logger.error(err);
            throw new ResourceRequestDeniedException(err);
        }

        final List<ResourcepoolEntry> availableEntries =
                db.getAvailableEntriesSortedByFreeMemoryPercentage(mem, resourcePool);

        if(availableEntries.isEmpty()){
            String err = "No resource is available for this request (based on memory).";
            logger.error(err);
            throw new NotEnoughMemoryException(err);
        }

        netFilter(availableEntries, neededAssociations, trace);

        if(availableEntries.isEmpty()){
            String err = "No resource can support the requested network(s).";
            logger.error(err);
            throw new ResourceRequestDeniedException(err);
        }
       
        return availableEntries;
    }
View Full Code Here

        // Acquiring whole manager lock requires that you also acquire the destruction lock
        // and also requires that you get it first.
        try {
            DESTRUCTION_LOCK.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ResourceRequestDeniedException(
                        new LockAcquisitionFailure(e));
        }
        try {
            WHOLE_MANAGER_LOCK.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ResourceRequestDeniedException(
                        new LockAcquisitionFailure(e));
        }
    }
View Full Code Here

    // Read the long locking comment above before using/changing
    private void _acquireDestructionLock() throws ResourceRequestDeniedException {
        try {
            DESTRUCTION_LOCK.lockInterruptibly();
        } catch (InterruptedException e) {
            throw new ResourceRequestDeniedException(
                        new LockAcquisitionFailure(e));
        }
    }
View Full Code Here

                final NodeRequest request = requests[i];

                final int[] ids = request.getIds();
                if (ids == null) {
                    throw new ResourceRequestDeniedException(
                            "Cannot proceed, no ids in NodeRequest (?)");
                }

                final String[] hostnames =
                        this.reserveSpace(ids,
                                          request.getMemory(),
                                          request.getNeededAssociations(),
                                          request.getResourcePool(),
                                          false);

                final Integer duration = new Integer(request.getDuration());

                for (int j = 0; j < ids.length; j++) {
                    idInts.add(new Integer(ids[j]));
                    allHostnames.add(hostnames[j]);
                    allDurations.add(duration);
                    allMemory.add(new Integer(request.getMemory()));
                }
            }
        } catch (Exception e) {
            String msg = "Problem reserving space for coscheduling group '" +
                         coschedid + "': " + e.getMessage();

            if (logger.isDebugEnabled()) {
                logger.error(msg, e);
            } else {
                logger.error(msg);
            }

            if (allHostnames.size() != allMemory.size()) {
                logger.fatal("Could not back reservations out, no matching " +
                        "memory recordings (?)");
                throw new ResourceRequestDeniedException(msg);
                }

            final String[] justReservedNodes = (String[])
                    allHostnames.toArray(new String[allHostnames.size()]);
            final Integer[] justReservedMemory = (Integer[])
                    allMemory.toArray(new Integer[allMemory.size()]);

            for (int i = 0; i < justReservedNodes.length; i++) {
                try {

                    ResourcepoolUtil.retireMem(justReservedNodes[i],
                                               justReservedMemory[i],
                                               this.db,
                                               this.lager.eventLog,
                                               this.lager.traceLog,
                                               -1, false);
            } catch (Exception ee) {
                    logger.error(ee.getMessage());
                }
            }

            throw new ResourceRequestDeniedException(msg);
        }

        final int length = idInts.size();

        final int[] all_ids = new int[length];
View Full Code Here

TOP

Related Classes of org.nimbustools.api.services.rm.ResourceRequestDeniedException

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.