Package org.globus.workspace

Examples of org.globus.workspace.WorkspaceException


                            constructPropagateToPauseCommand(vm);

            this.cmd = (String[]) exe.toArray(new String[exe.size()]);

        } else {
            throw new WorkspaceException("no VirtualMachine in request " +
                    "context, can not " + this.name);
        }
    }
View Full Code Here


            return md5sum;
        }
        catch(AuthzDBException wsdbex)
        {
            logger.error("trouble looking up the cumulus information ", wsdbex);
            throw new WorkspaceException("Trouble with the database " + wsdbex.toString());
        }
        catch(Exception ex)
        {
            throw new WorkspaceException("error finding the checksum " + publicUrl, ex);
        }
    }
View Full Code Here

                }
            }
        }
        catch(Exception ex)
        {
            throw new WorkspaceException("error translating cumulus name " + publicUrl, ex);
        }

        if(rc == null)
        {
            throw new WorkspaceException("external image scheme " + publicUrl + " is not supported");
        }
        return rc;
    }
View Full Code Here

                    }
                    md5string = hexString.toString();                   
                }
                catch(FileNotFoundException fnf)
                {
                    throw new WorkspaceException("Unpropagated file not found", fnf)
                }
                catch(NoSuchAlgorithmException nsa)
                {
                    logger.error("There is no md5 digest", nsa);
                }
                catch(IOException ioe)
                {
                    logger.error("Error dealing with the unpropgated file", ioe);
                }

                if(new_file)
                {
                    fileIds[1] = authDB.newFile(keyName, fileIds[0], canUser, datakey, schemeType);
                }
                authDB.setFileSize(fileIds[1], size, md5string);
            }
            else
            {
                return;
            }
        }
        catch(AuthorizationException authex)
        {
            throw new WorkspaceException("Authorization exception occured ", authex);
        }
        catch(AuthzDBException wsdbex)
        {
            throw new WorkspaceException("Workspace database exception occured ", wsdbex);
        }
    }
View Full Code Here

                           " on node " + vm.getNode();
                } else {
                    err = "Do not run have rights to run " +
                            this.name + " with ctx ID = " + id;
                }
                return new WorkspaceException(err);
            }

            // while developing it is sometimes helpful to set cmd to null
            // before it is implemented (i.e., make just this one thing fake
            // for the timebeing without using the fakeness infrastructure
View Full Code Here

            throw new IllegalArgumentException(err);
        }

        if (worksp == null) {
            logger.error(NO_WRKSP);
            throw new WorkspaceException(NO_WRKSP);
        }

        final ArrayList cmd = new ArrayList(8);

        /* The python program can have teardown tasks associated with it
View Full Code Here

            throw new IllegalArgumentException(err);
        }

        if (worksp == null) {
            logger.error(NO_WRKSP);
            throw new WorkspaceException(NO_WRKSP);
        }

        final ArrayList cmd = new ArrayList(16);

        cmd.add(worksp);
View Full Code Here

            throw new IllegalArgumentException(err);
        }
                                                            
        if (worksp == null) {
            logger.error(NO_WRKSP);
            throw new WorkspaceException(NO_WRKSP);
        }

        final ArrayList cmd = new ArrayList(16);

        cmd.add(worksp);
View Full Code Here

        }

        // not possible, Home initializes
        if (worksp == null) {
            logger.error(NO_WRKSP);
            throw new WorkspaceException(NO_WRKSP);
        }

        final ArrayList cmd = new ArrayList(16);

        cmd.add(worksp);
        cmd.add("--create");

        if (startpaused) {
            cmd.add("--startpaused");
        }

        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");
            cmd.add(vm.getKernel());
        }

        if (vm.getKernelParameters() != null) {
            cmd.add("--kernelargs");
            cmd.add(vm.getKernelParameters());
        }

        if (vm.getNetwork() != null) {
            cmd.add("--networking");
            final String net = "'" + hackStatic(vm.getNetwork()) + "'";
            cmd.add(net);
        }

        // sources:
        VirtualMachinePartition rootdisk = null;
        final ArrayList regularPartitions = new ArrayList();
        final ArrayList blankPartitions = new ArrayList();

        // results to send:
        final ArrayList images = new ArrayList();
        final ArrayList imagemounts = new ArrayList();

        final VirtualMachinePartition[] partitions = vm.getPartitions();

        if (partitions == null || partitions.length == 0) {
            final String err = "should be at least one partition, Binding " +
                    "should have caught at the outset";
            logger.error(err);
            throw new WorkspaceException(err);
        } else {
            for (int i = 0; i < partitions.length; i++) {
                if (partitions[i].isRootdisk()) {
                    rootdisk = partitions[i];
                } else if (partitions[i].getBlankspace() > 0) {
                    blankPartitions.add(partitions[i]);
                } else {
                    regularPartitions.add(partitions[i]);
                }
            }
        }


        // todo: generalize when propagating more than just rootdisk
        if (rootdisk != null) {
           
            String rootImageURI = rootdisk.getImage();

            // We know that if Propagate was required and notificationInfo
            // is null that this is a create command following a successful
            // Propagate-only command, so we let the backend know it can
            // find the file in its workspace-specific secureimage directory
            // by setting this file URL to a relative path -- relative paths
            // hitting the backend always cause the workspace-specific
            // secureimage directory to be consulted first

            if (vm.isPropagateRequired() && notificationInfo == null) {
                final String newURI = convertToAlreadyPropagated(rootImageURI, vm);

                logger.debug("turned '" + rootImageURI + "' into '" +
                            newURI + "' because file was already propagated");

                // not handling readonly root partition yet
                images.add(newURI);
            } else {
                // not handling readonly root partition yet
                images.add(rootImageURI);
            }
            imagemounts.add(rootdisk.getImagemount());
        }

        if (!blankPartitions.isEmpty()) {
            int blankNum = 0;
            final Iterator iter = blankPartitions.iterator();

            while (iter.hasNext()) {
                final VirtualMachinePartition blank =
                                (VirtualMachinePartition) iter.next();
                final int megs = blank.getBlankspace();
                //When unpropagate support is added for blank partitions,
                // this file will likely be unpropagated to the image node
                // with the originally supplied filename as target -- and
                // perhaps some schema change will allow the user to specify
                // whether or not it should be saved at all (when serializing
                // it would have to be)
                images.add("blankcreate://blankpartition" + blankNum
                                                            + "-size-" + megs);
                imagemounts.add(blank.getImagemount());
                blankNum += 1;

                // (assuming blank partition will always be readwrite)
            }
        }
       
        if (!regularPartitions.isEmpty()) {
            final Iterator iter = regularPartitions.iterator();
            while (iter.hasNext()) {
                final VirtualMachinePartition regular =
                                (VirtualMachinePartition) iter.next();
                String imgStr = regular.getImage();
                if (!regular.isReadwrite()) {
                    imgStr += WC_FIELD_SEPARATOR + "ro";
                }
                images.add(imgStr);
                imagemounts.add(regular.getImagemount());
            }
        }

        if (images.isEmpty()) {
            final String err = "should be at least one image here...";
            logger.error(err);
            throw new WorkspaceException(err);
        }
        Iterator iter = images.iterator();
        String imageString = "";

        imageString += (String) iter.next();

        while (iter.hasNext()) {
            imageString += WC_GROUP_SEPARATOR;
            imageString += (String) iter.next();
        }

        cmd.add("--images");
        cmd.add("'" + imageString + "'");


        if (imagemounts.isEmpty()) {
            final String err = "should be at least one image and hence at least " +
                    "one imagemount string here...";
            logger.error(err);
            throw new WorkspaceException(err);
        }
        iter = imagemounts.iterator();
        String imagemountString = "";

        imagemountString += (String) iter.next();
View Full Code Here

            throw new IllegalArgumentException(err);
        }

        if (worksp == null) {
            logger.error(NO_WRKSP);
            throw new WorkspaceException(NO_WRKSP);
        }

        final ArrayList cmd = new ArrayList(8);

        cmd.add(worksp);
View Full Code Here

TOP

Related Classes of org.globus.workspace.WorkspaceException

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.