Examples of CreationException


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

            if (failure instanceof ResourceRequestDeniedException) {
                throw (ResourceRequestDeniedException) failure;
            } else if (failure instanceof CreationException) {
                throw (CreationException) failure;
            } else {
                throw new CreationException("Unknown problem while " +
                        "processing networking", failure);
            }
        }

        logger.error("Problem with network validations or reservations, " +
View Full Code Here

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

        if (failure instanceof CreationException) {
            toThrow = failure;
        } else if (failure instanceof ResourceRequestDeniedException) {
            toThrow = failure;
        } else {
            toThrow = new CreationException("", failure);
        }

        if (bailed < 1) {

            // love it
View Full Code Here

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

        net.append(XenUtil.WC_FIELD_SEPARATOR);

        final String clientProvidedMAC = nic.getMAC();
        if (clientProvidedMAC != null
                && clientProvidedMAC.trim().length() > 0) {
            throw new CreationException("no security policy in place for " +
                    "client MAC specification, this is disabled, resubmit " +
                    "without specific MAC requirement");
        }

        final String method = nic.getAcquisitionMethod();
        if (method == null) {
            throw new CreationException("no network method specification");
        }

        if (method.equals(NIC.ACQUISITION_AcceptAndConfigure)
                || method.equals(NIC.ACQUISITION_Advisory)) {

            // todo: verify IP syntax here to identify a problem earlier
            // (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();
            if (assignedMAC == null) {
                net.append("ANY");
            } else {
                net.append(assignedMAC);
            }
            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);

            net.append(entry.getIpAddress()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(entry.getGateway()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(entry.getBroadcast()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(entry.getSubnetMask()).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(entryAndDns[1]).
                append(XenUtil.WC_FIELD_SEPARATOR).
                append(entry.getHostname()).
                append(XenUtil.WC_FIELD_SEPARATOR);

            // cert paths, old implementation
            net.append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null").
                append(XenUtil.WC_FIELD_SEPARATOR).
                append("null");

        } else {

            // todo: or just leave it up to the implementation?
            throw new CreationException("network method '" + method +
                    "' is not supported");
        }

        return net;
    }
View Full Code Here

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

                final String err = "requested shutdown state 'normal' is " +
                        "disabled, this site does not allow unpropagation " +
                        "from VMM nodes after the running time has expired. " +
                        "Use 'trash' instead and invoke unpropagation " +
                        "manually before running time has expired.";
                throw new CreationException(err);
            }

        } else if (CreateRequest.SHUTDOWN_TYPE_SERIALIZE.equals(shutdownRequest)) {

            // If this was implemented, !UnPropagateAfterRunningTimeEnabled
            // would also apply
            final String err = "requested shutdown state 'serialized' can " +
                    "not be accomplished, serialization is not supported";
            throw new CreationException(err);

        } else if (CreateRequest.SHUTDOWN_TYPE_TRASH.equals(shutdownRequest)) {

            dep.setRequestedShutdown(WorkspaceConstants.DEFAULT_SHUTDOWN_TRASH);

        } else {
            throw new CreationException("unknown shutdown type '" +
                    shutdownRequest + "'");
        }
       
    }
View Full Code Here

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

        final VirtualMachine[] vms = new VirtualMachine[numNodes];
        for (int i = 0; i < vms.length; i++) {
            try {
                vms[i] = VirtualMachine.cloneOne(vm);
            } catch (Exception e) {
                throw new CreationException(e.getMessage(), e);
            }
        }
       
        return vms;
    }
View Full Code Here

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

            }

            if (!ok) {
                final String err = "requested initial target state '" +
                        requestedInitialState + "' is illegal";
                throw new CreationException(err);
            }

            vm.getDeployment().setRequestedState(targetState);

        } else {
View Full Code Here

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

            FileOutputStream out = new FileOutputStream(localPath);
            out.write(credential.getBytes());
            out.flush();
            out.close();
        } catch (Exception e) {
            throw new CreationException("Couldn't save credential to " + localTempDirectory
                                         + ". " + e.getMessage());
        }

        final FileCopyNeed need;
        try {
            // FileCopyNeed expects a file in nimbus's tmp, not a full path
            need = new FileCopyNeed(credentialName);
            vm.addFileCopyNeed(need);
        } catch (Exception e) {
            final String err = "problem setting up file copy for credential: " +
                    credentialName + " : " + e.getMessage();
            throw new CreationException(err);
        }

        vm.setCredentialName(credentialName);
    }
View Full Code Here

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

        try {
            this.validate();
            this.bindFileWrites(vm, reqs);
        } catch (Exception e) {
            throw new CreationException(e.getMessage(), e);
        }
    }
View Full Code Here

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

    protected FileCopyNeed newNeed(String src,
                                        String dstPath) throws Exception {

        // already checked, this is for object extenders
        if (this.localDirPath == null) {
            throw new CreationException("cannot perform customization " +
                    "without local tmp directory");
        }

        final int maxContentLength = 40960; // embedded policy for now
       
View Full Code Here

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

                         Calendar termTime,
                         String node,
                         double chargeRatio) throws CreationException {

        if (vm == null) {
            throw new CreationException("null vm");
        }

        if (vm.getDeployment() == null) {
            throw new CreationException("null deployment information");
        }

        this.id = id;
        this.vm = vm;
        this.chargeRatio = chargeRatio;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.