Package org.globus.workspace.service.binding.vm

Examples of org.globus.workspace.service.binding.vm.VirtualMachineDeployment


            logger.debug("binding " + numNodes + " virtual machines: " + name);
        } else {
            logger.debug("binding virtual machine: " + name);
        }

        final VirtualMachineDeployment dep = new VirtualMachineDeployment();
        vm.setDeployment(dep);

        this.bindNetwork.neededAllocations(vm, req.getRequestedNics());
        this.bindResourcePool.consume(vm, req.getRequestedResourcePool());
        this.bindSchedule.consume(dep, req.getRequestedSchedule());
View Full Code Here


            logger.warn(Lager.id(vmid) + " assuming no node assignment yet " +
                    "because of ensemble not-done");
            return;
        }

        final VirtualMachineDeployment vmdep = vm.getDeployment();
        if (vmdep == null) {
            throw new ProgrammingError("deployment is null");
        }
       
        boolean preemptable = vm.isPreemptable();

        final int mem = vmdep.getIndividualPhysicalMemory();

        _releaseSpace(vmid, node, preemptable, mem);
    }
View Full Code Here

        if (rs == null || !rs.next()) {
            //No deployment for this VM
            return;
        }

        final VirtualMachineDeployment dep = new VirtualMachineDeployment();
        dep.setRequestedState(rs.getInt("requested_state"));
        dep.setRequestedShutdown(rs.getInt("requested_shutdown"));
        dep.setMinDuration(rs.getInt("min_duration"));
        dep.setIndividualPhysicalMemory(rs.getInt("ind_physmem"));
        dep.setIndividualCPUCount(rs.getInt("ind_physcpu"));
        vm.setDeployment(dep);
    }
View Full Code Here

    }

    public static void putAsyncRequestVMDeployment(AsyncRequest asyncRequest, int binding_index, Connection c) throws SQLException {

        VirtualMachine binding = asyncRequest.getBindings()[binding_index];
        VirtualMachineDeployment dep = binding.getDeployment();
        if (dep == null) {
            return;
        }

        PreparedStatement pstmt = c.prepareStatement(SQL_INSERT_ASYNC_REQUESTS_VM_DEPLOYMENT);

        pstmt.setString(1, asyncRequest.getId());
        pstmt.setInt(2, binding_index);
        pstmt.setInt(3, binding.getID());
        pstmt.setInt(4, dep.getRequestedState());
        pstmt.setInt(5, dep.getRequestedShutdown());
        pstmt.setInt(6, dep.getMinDuration());
        pstmt.setInt(7, dep.getIndividualPhysicalMemory());
        pstmt.setInt(8, dep.getIndividualCPUCount());
        pstmt.executeUpdate();
        pstmt.close();
    }
View Full Code Here

        }

        long requestDur = 0;
        for (int i = 0; i < bindings.length; i++) {

            final VirtualMachineDeployment dep = bindings[i].getDeployment();
            if (dep == null) {
                final String msg = "ERROR: No deployment information in " +
                        "binding, can't make decision.";
                buf.append(msg);
                logger.error(buf.toString());
                throw new AuthorizationException(msg);
            }

            final long seconds = dep.getMinDuration();
            requestDur += seconds / 60;
        }

        final Double doubleRequestDur = requestDur * chargeRatio;
        requestDur = doubleRequestDur.longValue();

        if (bindings.length > 1) {
            buf.append("Duration total of all requests in group: ");
        } else {
            buf.append("Duration request: ");
        }

        buf.append(requestDur)
           .append("\n");

        // zero or below means no check should be made
        if (rights.getMaxCPUs() > 0) {
            final long maxCPUs = rights.getMaxCPUs();
            for (int i = 0; i < bindings.length; i++) {

                final VirtualMachineDeployment dep = bindings[i].getDeployment();
                if (dep == null) {
                    final String msg = "ERROR: No deployment information in " +
                            "binding, can't make decision.";
                    buf.append(msg);
                    logger.error(buf.toString());
                    throw new AuthorizationException(msg);
                }
                final long currentCPUs = dep.getIndividualCPUCount();
                if (currentCPUs > maxCPUs) {

                    buf.append("\nDenied: Requested CPU count (")
                       .append(currentCPUs)
                       .append(") + is greater or equal to maximum CPU count (")
View Full Code Here

                                            int defaultSecs,
                                            int maxSecs)
                               throws AuthorizationException,
                                      ResourceRequestDeniedException {

        final VirtualMachineDeployment dep = vm.getDeployment();
        if (dep == null) {
            throw new AuthorizationException(
                        "internal error, no deployment, vm #" + vm.getID());
        }

        final int requestedSecs = dep.getMinDuration();
        if (requestedSecs == VirtualMachineDeployment.NOTSET) {
            dep.setMinDuration(defaultSecs);
        } else if (requestedSecs > maxSecs) {
                // client visible message:
                throw new ResourceRequestDeniedException(
                        "request duration (" + requestedSecs + " seconds)" +
                                " exceeds the maximum allowed (" + maxSecs +
View Full Code Here

        if (allowedCPUArchitectures == null) {
            // if policy is null, means 'any'
            return; // *** EARLY RETURN ***
        }

        final VirtualMachineDeployment dep = vm.getDeployment();
        if (dep == null) {
            throw new ResourceRequestDeniedException(
                            "no CPU architecture description (no dep)");
        }

        final String requestedArch = dep.getCPUArchitecture();
        if (requestedArch == null) {
            throw new ResourceRequestDeniedException(
                            "no CPU architecture description (no dep.arch)");
        }

View Full Code Here

        cmd.add("--name");
        cmd.add(xenName(vm));

        if (vm.getDeployment() != null) {

            final VirtualMachineDeployment dep = vm.getDeployment();

            // the service does not currently support a default memory
            // config, but workspace_control does -- in the future,
            // decision to allow a default memory config will be policy
            // driven at service level
            if (dep.getIndividualPhysicalMemory() > 0) {
                cmd.add("--memory");
                cmd.add(Integer.toString(dep.getIndividualPhysicalMemory()));
            }

            if (dep.getIndividualCPUCount() > 0) {
                cmd.add("--vcpus");
                cmd.add(Integer.toString(dep.getIndividualCPUCount()));
            }
        }

        if (vm.getKernel() != null) {
            cmd.add("--kernel");
View Full Code Here

            pstmt.setNull(13, Types.VARCHAR);
        }

        PreparedStatement pstmt2 = null;

        VirtualMachineDeployment dep = vm.getDeployment();
        if (dep != null) {
            pstmt2 = c.prepareStatement(SQL_INSERT_VM_DEPLOYMENT);
            pstmt2.setInt(1, id);
            // can be -1
            pstmt2.setInt(2, dep.getRequestedState());
            pstmt2.setInt(3, dep.getRequestedShutdown());
            // can be -1
            pstmt2.setInt(4, dep.getMinDuration());
            // can be -1 (but binding will reject that)
            pstmt2.setInt(5, dep.getIndividualPhysicalMemory());
            pstmt2.setInt(6, dep.getIndividualCPUCount());
        }

        final ArrayList inserts = new ArrayList(16);
        inserts.add(pstmt);
        if (pstmt2 != null) {
View Full Code Here

    }

    public static void addDeployment(VirtualMachine vm, ResultSet rs)
                                                    throws SQLException {

        final VirtualMachineDeployment dep = new VirtualMachineDeployment();
        dep.setRequestedState(rs.getInt(1));
        dep.setRequestedShutdown(rs.getInt(2));
        dep.setMinDuration(rs.getInt(3));
        dep.setIndividualPhysicalMemory(rs.getInt(4));
        dep.setIndividualCPUCount(rs.getInt(5));
        vm.setDeployment(dep);
    }
View Full Code Here

TOP

Related Classes of org.globus.workspace.service.binding.vm.VirtualMachineDeployment

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.