Package org.nimbustools.api._repr.vm

Examples of org.nimbustools.api._repr.vm._VM


        NIC[] nics = new NIC[networks.length];

        for (int i = 0; i < networks.length; i++) {
            String network = networks[i];

            _NIC nic = new DefaultNIC();
            nic.setNetworkName(network);
            nics[i] = nic;
        }
        return nics;
    }
View Full Code Here


            throws CannotTranslateException {
       
        if (networkName == null) {
            throw new CannotTranslateException("networkName is missing");
        }
        final _NIC nic = this.repr._newNIC();
        nic.setAcquisitionMethod(NIC.ACQUISITION_AllocateAndConfigure);
        nic.setNetworkName(networkName);
        nic.setName(nicName);
        return nic;
    }
View Full Code Here

        }
        return nics;
    }

    private NIC oneRequestedNIC(String networkName, String nicName) {
        final _NIC nic = this.reprFactory._newNIC();
        nic.setAcquisitionMethod(NIC.ACQUISITION_AllocateAndConfigure);
        nic.setNetworkName(networkName);
        nic.setName(nicName);
        return nic;
    }
View Full Code Here

        // Create Nic_Type object for each NIC
        final _NIC[] nics = new _NIC[numNics];

        for(int i = 0; i < numNics; i++) {
           
            final _NIC nic = this.repr._newNIC();
            nics[i] = nic;
           
            final String[] nicPropertiesStr =
                    nicsStr[i].split(XenUtil.WC_FIELD_SEPARATOR);
            final int numProps = nicPropertiesStr.length;

            // NIC string format:
            // Name;Assocaition;MAC;Network Mode;IP method
            //      ;IP address;gateway;broadcast;subnetmask;dns;hostname
            //      ;null;null;null;null  (maintain old protocol)
            // First five are assumed to exist

            // Name
            nic.setName(nicPart(nicPropertiesStr[0]));

            // MAC
            nic.setMAC(nicPart(nicPropertiesStr[2]));

            // IP config
            nic.setAcquisitionMethod(nicPropertiesStr[4]);
           
            if (numProps > 4) {

                nic.setIpAddress(nicPart(nicPropertiesStr[5]));
                nic.setGateway(nicPart(nicPropertiesStr[6]));
                nic.setBroadcast(nicPart(nicPropertiesStr[7]));
                nic.setNetmask(nicPart(nicPropertiesStr[8]));
                nic.setHostname(nicPart(nicPropertiesStr[10]));

            } else {
               
                nic.setIpAddress(null);
                nic.setGateway(null);
                nic.setBroadcast(null);
                nic.setNetmask(null);
                nic.setHostname(null);
            }
            // Currently, no more information is
            // bound internally, setting to null..
            nic.setNetwork(null);

            // Network (old name: Association)
            nic.setNetworkName(nicPart(nicPropertiesStr[1]));
        }

        return nics;
    }
View Full Code Here

                          int mem, int numNodes, boolean preemptable, String idemToken,
                          String networkName, String zoneName)
            throws URISyntaxException {
        req.setName(name);
       
        final _NIC nic = this.repr._newNIC();
        if (networkName == null) {
            nic.setNetworkName("public");
        } else {
            nic.setNetworkName(networkName);
        }
        nic.setAcquisitionMethod(NIC.ACQUISITION_AllocateAndConfigure);
        req.setRequestedNics(new _NIC[]{nic});

        final _ResourceAllocation ra = this.repr._newResourceAllocation();
        req.setRequestedRA(ra);
        final _Schedule schedule = this.repr._newSchedule();
View Full Code Here

        final VMM_Type vmm = requires.getVMM();
        if (vmm != null) {
            final VMM_TypeType type = vmm.getType();
            if (type != null) {
                final _RequiredVMM reqVMM = this.repr._newRequiredVMM();
                reqVMM.setType(type.getValue());
                reqVMM.setVersions(vmm.getVersion());
                req.setRequiredVMM(reqVMM);
            }
        }

        final Kernel_Type kernel = requires.getKernel();
View Full Code Here

        if (this.cpuArch == null || this.cpuArch.trim().length() == 0) {
            logger.warn("No CPU arch configured to send in requests?");
        }

        final _RequiredVMM vmm = this.repr._newRequiredVMM();
        vmm.setType(this.vmmType);
        final String[] versions = {this.vmmVersion};
        vmm.setVersions(versions);
        this.requestThisVMM = vmm;
    }
View Full Code Here

        req.setShutdownType(CreateRequest.SHUTDOWN_TYPE_TRASH);
        req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);

        ra.setArchitecture(this.cpuArch);
        ra.setSpotInstance(true);
        final _RequiredVMM reqVMM = this.reprFactory._newRequiredVMM();
        reqVMM.setType(this.vmmType);
        reqVMM.setVersions(new String[]{this.vmmVersion});
        req.setRequiredVMM(reqVMM);

        final _VMFile file = this.reprFactory._newVMFile();
        file.setRootFile(true);
        file.setBlankSpaceName(null);
View Full Code Here

        req.setShutdownType(CreateRequest.SHUTDOWN_TYPE_TRASH);
        req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);

        ra.setArchitecture(ResourceAllocation.ARCH_x86);
        ra.setSpotInstance(preemptable);
        final _RequiredVMM reqVMM = this.repr._newRequiredVMM();
        reqVMM.setType("Xen");
        reqVMM.setVersions(new String[]{"3"});
        req.setRequiredVMM(reqVMM);

        final _VMFile file = this.repr._newVMFile();
        file.setRootFile(true);
        file.setBlankSpaceName(null);
View Full Code Here

        if (!(req.getRequestedRA() instanceof _ResourceAllocation)) {
            throw new CannotTranslateException(
                    "expecting writable ResourceAllocation");
        }

        _ResourceAllocation ra = (_ResourceAllocation) req.getRequestedRA();
        if (ra == null) {
            ra = this.repr._newResourceAllocation();
            req.setRequestedRA(ra);
        }

        final _Schedule sched = this.repr._newSchedule();
        if (dep.getDeploymentTime() != null) {
            final int requestedSecs;
            try {
                requestedSecs = CommonUtil.durationToSeconds(
                            dep.getDeploymentTime().getMinDuration());
            } catch (InvalidDurationException e) {
                throw new CannotTranslateException(e.getMessage(), e);
            }
            sched.setDurationSeconds(requestedSecs);
        }
        req.setRequestedSchedule(sched);

        ra.setNodeNumber(dep.getNodeNumber());
       
        // handled elsewhere: dep.getPostShutdown();

        final ShutdownMechanism_Type shutdownMech = dep.getShutdownMechanism();
        if (shutdownMech == null) {
            req.setShutdownType(CreateRequest.SHUTDOWN_TYPE_NORMAL);
        } else {
            final String type = (String) shutdownMap.get(shutdownMech);
            if (type == null) {
                throw new CannotTranslateException("unknown shutdown " +
                        "mechanism '" + shutdownMech.toString() + "'");
            } else {
                req.setShutdownType(type);
            }
        }

        final InitialState_Type initialState = dep.getInitialState();
        if (initialState == null) {
            req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);
        } else {
            final String state = (String) initialStateMap.get(initialState);
            if (state == null) {
                throw new CannotTranslateException("unknown initial " +
                        "state '" + initialState.toString() + "'");
            } else {
                req.setInitialStateRequest(state);
            }
        }

        final ResourceAllocation_Type wsra = dep.getResourceAllocation();
        if (wsra == null) {
            throw new CannotTranslateException(
                    "ResourceAllocation_Type may not be missing");
        }

        ra.setMemory(this.getMemoryMB(wsra));
        ra.setIndCpuCount(this.getCPUCount(wsra));

        boolean noFiles = false;
        final VMFile[] files = req.getVMFiles();
        if (files == null || files.length == 0) {
            noFiles = true;
View Full Code Here

TOP

Related Classes of org.nimbustools.api._repr.vm._VM

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.