Package org.nimbustools.api._repr.vm

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


        if (bd == null) {
            throw new IllegalArgumentException("bd may not be null");
        }

        final _VMFile file = this.repr._newVMFile();
        file.setRootFile(false);
        file.setURI(null);

        final String name = bd.getPartitionName();
        if (name == null) {
            throw new CannotTranslateException(
                    "a blank disk description is missing PartitionName");
        }
        file.setBlankSpaceName(name);

        final String mountAs = bd.getMountAs();
        if (mountAs == null) {
            throw new CannotTranslateException(
                    "a blank disk description is missing mountAs");
        }
        file.setMountAs(mountAs);

        // setBlankSpaceSize is needed, but will get set in resource allocation
        // consumption methods

        return file;
View Full Code Here


            if (!(files[i] instanceof _VMFile)) {
                throw new CannotTranslateException("expecting writable VMFile");
            }

            final _VMFile file =
                    (_VMFile)files[i];
            if (file == null) {
                continue;
            }

            final String name = file.getBlankSpaceName();
            if (name == null) {
                continue;
            }

            final Integer size = (Integer) blankStorageRequests.get(name);
            if (size == null) {
                throw new CannotTranslateException("blank space listed in" +
                        "definition but no matching blank storage request " +
                        "is in deployment request");
            }

            final int space = size.intValue();

            if (space < 1) {
                throw new CannotTranslateException(
                        "blank space request is for under 1 MB");
            }

            file.setBlankSpaceSize(space);

            // remove to mark 'used' so we can check at the end for extras
            blankStorageRequests.remove(name);
        }
View Full Code Here

                    if (!(vmFiles[i] instanceof _VMFile)) {
                        throw new CannotTranslateException(
                            "expecting writable VMFile");
                    }

                    final _VMFile file = (_VMFile)vmFiles[i];

                    if (file.isRootFile()) {
                        file.setUnpropURI(this.convertURI(unpropTarget));
                        break;
                    }
                }
            }
        }
View Full Code Here

        if (bd == null) {
            throw new IllegalArgumentException("bd may not be null");
        }

        final _VMFile file = this.repr._newVMFile();

        file.setRootFile(rootfile);
        file.setBlankSpaceName(null);
        file.setBlankSpaceSize(-1);

        final URI uri = bd.getLocation();
        if (uri == null) {
            throw new CannotTranslateException("a disk is missing location");
        }

        file.setURI(this.convertURI(uri));

        final String mountAs = bd.getMountAs();
        if (mountAs == null) {
            throw new CannotTranslateException("a disk is missing mountAs");
        }
        file.setMountAs(mountAs);

        final DiskPermissions_Type perms = bd.getPermissions();

        if (perms == null) {
            file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        } else if (perms.equals(DiskPermissions_Type.ReadOnly)) {
            file.setDiskPerms(VMFile.DISKPERMS_ReadOnly);
        } else if (perms.equals(DiskPermissions_Type.ReadWrite)) {
            file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        } else {
            throw new CannotTranslateException(
                    "unknown disk permission: '" + perms + "'");
        }
View Full Code Here

                }
            }
        }


        final _VMFile file = this.repr._newVMFile();
        file.setRootFile(true);
        file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        file.setMountAs(this.getRootFileMountAs());
        file.setURI(imageURI);
        return file;
    }
View Full Code Here

        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);
        file.setBlankSpaceSize(-1);
        file.setURI(imageURI);
        file.setMountAs(this.rootFileMountAs);
        file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        req.setVMFiles(new _VMFile[]{file});

        return req;
    }
View Full Code Here

        if (part == null) {
            throw new CannotTranslateException("null partition");
        }

        final _VMFile vmFile = this.repr._newVMFile();

        vmFile.setRootFile(part.isRootdisk());
        if (part.isReadwrite()) {
            vmFile.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        } else {
            vmFile.setDiskPerms(VMFile.DISKPERMS_ReadOnly);
        }
        vmFile.setMountAs(part.getImagemount());

        final int size = part.getBlankspace();
        if (size > 0) {
            vmFile.setBlankSpaceSize(size);
            vmFile.setBlankSpaceName(null); // unknown
        }

        try {
            final String unpropTargetStr = part.getAlternateUnpropTarget();
            if (unpropTargetStr != null) {
                vmFile.setUnpropURI(new URI(unpropTargetStr));
            }
            vmFile.setURI(new URI(part.getImage()));
        } catch (URISyntaxException e) {
            throw new CannotTranslateException(e.getMessage(), e);
        }

        return vmFile;
View Full Code Here

        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);
        file.setBlankSpaceSize(-1);
        file.setURI(new URI("file:///tmp/nothing"));
        file.setMountAs("sda1");
        file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
        req.setVMFiles(new _VMFile[]{file});

        req.setClientToken(idemToken);
        req.setRequestedResourcePool(zoneName);
    }
View Full Code Here

TOP

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

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.