Package org.nimbustools.api._repr.vm

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


            cmpName = this.getSmallName();
        } else {
            cmpName = name;
        }

        final _ResourceAllocation ra = this.repr._newResourceAllocation();
        ra.setNodeNumber(minNumNodes); // only respecting min at the moment

        if(spot && !cmpName.equals(siType)){
            throw new CannotTranslateException(
                    "Unsupported spot instance type: '" + name + "'." +
                        " Currently supported SI type: " + siType);           
        }
       
        Integer memory = getInstanceMemory(cmpName);
       
        ra.setMemory(memory);

        Integer cpus = getInstanceCPUs(cmpName);

        String publicNetwork = getInstancePublicNetwork(cmpName);
        String privateNetwork = getInstancePrivateNetwork(cmpName);

        ra.setIndCpuCount(cpus);

        ra.setSpotInstance(spot);
       
        ra.setArchitecture(this.cpuArch);

        ra.setPublicNetwork(publicNetwork);
        ra.setPrivateNetwork(privateNetwork);

        return ra;
    }
View Full Code Here


        req.setInstanceType(SIConstants.SI_TYPE_BASIC);

        req.setName(name);
        req.setRequestedNics(this.getNetwork());
       
        final _ResourceAllocation ra = this.reprFactory._newResourceAllocation();
        req.setRequestedRA(ra);
        ra.setNodeNumber(numInstances);
        ra.setMemory(this.instanceMem);
        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);
View Full Code Here

       
        if (vm == null) {
            throw new CannotTranslateException("null VirtualMachine?");
        }

        final _ResourceAllocation ra = this.repr._newResourceAllocation();

        final VirtualMachineDeployment dep = vm.getDeployment();
       
        if (dep == null) {
            return ra; // *** EARLY RETURN ***
        }

        ra.setSpotInstance(vm.isPreemptable());
        ra.setArchitecture(dep.getCPUArchitecture());
        ra.setCpuPercentage(dep.getCPUPercentage());
        ra.setIndCpuSpeed(dep.getIndividualCPUSpeed());
        ra.setIndCpuCount(dep.getIndividualCPUCount());
        ra.setMemory(dep.getIndividualPhysicalMemory());
        return ra;
    }
View Full Code Here

            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();
        schedule.setDurationSeconds(durationSeconds);
        req.setRequestedSchedule(schedule);
        ra.setNodeNumber(numNodes);
        ra.setMemory(mem);
        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);
View Full Code Here

        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());
       
View Full Code Here

        if (resource == null) {
            throw new CannotTranslateException("no resource?");
        }

        final _Schedule schedule = this.repr._newSchedule();

        schedule.setDestructionTime(resource.getTerminationTime());
        schedule.setStartTime(resource.getStartTime());

        final VirtualMachine vm = resource.getVM();
        if (vm == null) {
            throw new CannotTranslateException("null VirtualMachine?");
        }
        final VirtualMachineDeployment dep = vm.getDeployment();
        if (dep == null) {
            throw new CannotTranslateException("null deployment information?");
        }
        schedule.setDurationSeconds(dep.getMinDuration());

        return schedule;
    }
View Full Code Here

        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();
        schedule.setDurationSeconds(durationSeconds);
        req.setRequestedSchedule(schedule);
        ra.setNodeNumber(numNodes);
        ra.setMemory(mem);
        req.setShutdownType(CreateRequest.SHUTDOWN_TYPE_TRASH);
        req.setInitialStateRequest(CreateRequest.INITIAL_STATE_RUNNING);
View Full Code Here

        if (stateStr == null) {
            throw new CannotTranslateException("state string is required");
        }

        final _State state = this.repr._newState();
        state.setState(stateStr);
        state.setProblem(resource.getStateThrowable()); // can be null

        return state;
    }
View Full Code Here

        if (resource == null) {
            throw new CannotTranslateException("no resource?");
        }

        final _VM vm = this.repr._newVM();
        vm.setID(String.valueOf(resource.getID()));
        vm.setGroupID(resource.getGroupId());
        vm.setCoschedID(resource.getEnsembleId());
        vm.setLaunchIndex(resource.getLaunchIndex());
        vm.setNics(this.getNICs(resource.getVM()));
        vm.setMdUserData(resource.getVM().getMdUserData());
        vm.setCredentialName(resource.getVM().getCredentialName());
        vm.setVMFiles(this.getStorage(resource.getVM()));
        vm.setResourceAllocation(this.getRA(resource.getVM()));
        vm.setSchedule(this.getSchedule(resource));
        vm.setState(this.getState(resource));
        vm.setCreator(this.getCreator(resource));
        vm.setClientToken(resource.getClientToken());
        String deets = this.getDetails(resource.getVM());
        if (deets != null)
        {
            vm.setDetails(deets);
        }
       
        if(resource.getVM().isPreemptable()){
            vm.setLifeCycle(VMConstants.LIFE_CYCLE_SPOT);
        }
       
        return vm;
    }
View Full Code Here

        // todo: look at RA and construct blankspace request
        //return new VMFile[]{this.getRootFile(imageID, ownerID)};
        VMFile [] vma = new VMFile[1];
       
       // vma[0].
        final _VMFile file = this.repr._newVMFile();
        file.setRootFile(true);
        file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);

        // must convert to scp url
        // look up image id
        try
        {
            String urlStr;
            if(imageID.indexOf("cumulus://") == 0)
            {
                urlStr = imageID;
            }
            else
            {
                urlStr = getImageLocation(caller, imageID) + "/" + imageID;
            }
            file.setMountAs(this.rootFileMountAs);
            URI imageURI = new URI(urlStr);
            file.setURI(imageURI);
            vma[0] = file;
            return vma;
        }
        catch(Exception ex)
        {
View Full Code Here

TOP

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

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.