Package org.globus.workspace.service

Examples of org.globus.workspace.service.InstanceResource


        // Not worried about races w/ destruction here.

        for (int key : keys) {
            try {
                InstanceResource resource = this.find(key);
                NIC[] nics = this.dataConvert.getNICs(resource.getVM());
                for (NIC nic : nics) {
                    if (nic.getIpAddress().equals(ip)) {
                        resourceList.add(resource);
                        break;
                    }
View Full Code Here


            }
            return 0;
        }

        for (int i = 0; i < ids.length; i++) {
            InstanceResource resource;
            try {
                resource = this.home.find(ids[i]);
            } catch (Exception e) {
                logger.error(Lager.id(ids[i]), e);
                try {
                    this.scheduler.stateNotification(ids[i], STATE_DESTROYING);
                } catch (ManageException e2) {
                    logger.error("", e2);
                }
                continue;
            }

            resource.setOpsEnabled(false);
            try {

                // serialize request is invalid right now
                if (resource.getVM().getRequestedShutdownMechanism()
                        == DEFAULT_SHUTDOWN_TRASH) {

                    if (lager.eventLog) {

                        logger.info(Lager.ev(ids[i]) + "Running time has" +
                                " expired, client requested default" +
                                " shutdown mechanism of Trash," +
                                " destroying resource");
                    }

                    this.home.destroy(ids[i]);

                } else if (resource.getState() > STATE_STAGED_OUT) {

                    if (lager.eventLog) {

                        logger.info(Lager.ev(ids[i]) + "Running time has" +
                            " expired, client requested default shutdown" +
                            " mechanism of Normal, but the resource is" +
                            " either being destroyed or has been corrupted," +
                            " nothing to do");
                    }

                } else {

                    if (lager.eventLog) {
                        logger.info(Lager.ev(ids[i]) + "Running time has" +
                            " expired, client requested default shutdown" +
                            " mechanism of Normal, setting target state" +
                            " to StagedOut");
                    }

                    resource.setTargetState(STATE_STAGED_OUT);
                }

                this.scheduler.markShutdown(ids[i]);
               
            } catch (ManageException e) {
View Full Code Here

                // unless there was a race
                this.cancelWorkspace(slot.vmid, SEVERE_PILOT_FAULT);
                return;
            }

            final InstanceResource resource;
            try {
                resource = this.instHome.find(slot.vmid);
            } catch (DoesNotExistException e) {
                final String msg = "workspace #" + slot.vmid + " is unknown " +
                        "to the service but the pilot tracker has receieved " +
                        "space for it to run?  pilot ID: '" + slotid + "' " +
                        "There is nothing we can do about this.";
                logger.error(e.getMessage());
                return;
            }

            final int runningTime =
                    resource.getVM().getDeployment().getMinDuration();

            // double-checking assumptions
            if (runningTime > slot.duration - this.padding) {
                logger.error("The running time stored for workspace #" +
                        slot.vmid + " is greater than slot duration (?). " +
View Full Code Here

    private void cancelWorkspace(int vmid,
                                 boolean trash,
                                 Throwable t) {

        final InstanceResource resource;
        try {
            resource = this.instHome.find(vmid);
        } catch (Exception e) {
            final String msg = "Couldn't find workspace " + Lager.id(vmid) +
                    " to cancel, already gone.";
            logger.error(msg);
            return;
        }

        if (!trash) {
            resource.setVMMaccessOK(false);
        }
        try {
            final int curr = resource.getState();
            // no need to set a new state if it is already corrupted
            // (this is a check then act problem)
            if (curr < WorkspaceConstants.STATE_CORRUPTED) {
                resource.setState(curr + WorkspaceConstants.STATE_CORRUPTED,
                                  null);
            }
        } catch (ManageException e) {
            final String msg = "Couldn't set corrupted state on workspace "
                    + Lager.id(vmid) +
View Full Code Here

        // will never be null return array, just empty
        final int[] ids = this.findMemberIDs(coschedid);

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

            final InstanceResource rsrc;

            try {
                rsrc = this.whome.find(ids[i]);
            } catch (DoesNotExistException e) {
                continue; // *** SKIP ***
 
View Full Code Here

        // will never be null return array, just empty
        final int[] ids = this.findMemberIDs(groupid);

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

            final InstanceResource rsrc;
           
            try {
                rsrc = this.whome.find(ids[i]);
            } catch (DoesNotExistException e) {
                continue; // *** SKIP ***
 
View Full Code Here

    // implements Callable
    // -------------------------------------------------------------------------
   
    public Object call() throws Exception {

        InstanceResource resource;
        try {
            resource = this.home.find(this.id);
        } catch (DoesNotExistException e) {
            return "Workspace #" + this.id + " removed already.\n";
        } catch (ManageException e) {
            return "Problem finding workspace #" + this.id + ": " +
                    e.getMessage() + "\n";
        }

        // not moving to group terminate yet on backend
        resource.setLastInGroup(false);
        resource.setPartOfGroupRequest(false);

        this.home.destroy(this.id);

        if (!this.blockForSuccess) {
            return null;
View Full Code Here

        for (IdempotentInstance instance : instances) {
            if (instance == null) {
                throw new CreationException("Idempotent reservation has null instance");
            }

            InstanceResource resource;
            try {
                resource = this.whome.find(instance.getID());

                if (resource == null) {
                    throw new CreationException("Existing idempotent instance was null (?)");
                }

                // these parameter checks can only be performed against a running
                // instance.

                this.checkIdempotentInstanceForMismatch(resource, req, logId);

            } catch (DoesNotExistException e) {
                logger.debug("Idempotent reservation request has a terminated instance");

                final VirtualMachine vm = new VirtualMachine();
                vm.setNetwork("NONE");
                final VirtualMachineDeployment deployment = new VirtualMachineDeployment();
                vm.setDeployment(deployment);

                resource = new IdempotentInstanceResource(instance.getID(),
                        instance.getName(), null, res.getGroupId(), instances.size(),
                        instance.getLaunchIndex(), res.getCreatorId(), vm,
                        WorkspaceConstants.STATE_DESTROYING, res.getClientToken());
            }

            if (resource.getName() == null) {
                if (req.getName() != null) {
                    throw new IdempotentCreationMismatchException("instance name mismatch");
                }
            } else {
                if (!resource.getName().equals(req.getName())) {
                    throw new IdempotentCreationMismatchException("instance name mismatch");
                }
            }
            resources[index] = resource;
View Full Code Here

        boolean last = false;
        if (idx == ids.length-1) {
            last = true;
        }

        final InstanceResource resource = this.whome.newInstance(id);

        this.populateResource(id, resource, vm,
                              callerID, coschedID, groupID, clientToken,
                              startTime, termTime, node,
                              ids.length, last, idx, chargeRatio);

        this.persistence.add(resource);

        if (context != null) {
            // todo: adding IPs to text here isn't necessary, this was added
            // as a shortcut for a release but needs to go back to IaaS-agnostic
            // text that works like a blob. Clean up w/ next interface changes
            // to the ctx broker
            try {
                final String newContent =
                        addIPs(context.getBootstrapText(), vm);
                final FileCopyNeed need =
                        this.binding.newFileCopyNeed(
                                newContent, context.getBootstrapPath());
                resource.newFileCopyNeed(need);
            } catch (Exception e) {
                logger.error(e.getMessage());
            }
        }
View Full Code Here

TOP

Related Classes of org.globus.workspace.service.InstanceResource

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.