Examples of MockSecStorageVO


Examples of com.cloud.simulator.MockSecStorageVO

        return this.getClass().getSimpleName();
    }

    @Override
    public void preinstallTemplates(String url, long zoneId) {
        MockSecStorageVO storage = null;
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
        try {
            txn.start();
            storage = _mockSecStorageDao.findByUrl(url);

            if (storage == null) {
                storage = new MockSecStorageVO();
                URI uri;
                try {
                    uri = new URI(url);
                } catch (URISyntaxException e) {
                    return;
                }

                String nfsHost = uri.getHost();
                String nfsPath = uri.getPath();
                String path = nfsHost + ":" + nfsPath;
                String dir = "/mnt/" + UUID.nameUUIDFromBytes(path.getBytes()).toString() + File.separator;

                storage.setUrl(url);
                storage.setCapacity(DEFAULT_HOST_STORAGE_SIZE);

                storage.setMountPoint(dir);


                storage = _mockSecStorageDao.persist(storage);

                // preinstall default templates into secondary storage
                long defaultTemplateSize = 2 * 1024 * 1024 * 1024L;
                MockVolumeVO template = new MockVolumeVO();
                template.setName("simulator-domR");
                template.setPath(storage.getMountPoint() + "template/tmpl/1/100/" + UUID.randomUUID().toString());
                template.setPoolId(storage.getId());
                template.setSize(defaultTemplateSize);
                template.setType(MockVolumeType.TEMPLATE);
                template.setStatus(Status.DOWNLOADED);
                template = _mockVolumeDao.persist(template);


                template = new MockVolumeVO();
                template.setName("simulator-Centos");
                template.setPath(storage.getMountPoint() + "template/tmpl/1/111/" + UUID.randomUUID().toString());
                template.setPoolId(storage.getId());
                template.setSize(defaultTemplateSize);
                template.setType(MockVolumeType.TEMPLATE);
                template.setStatus(Status.DOWNLOADED);

                template = _mockVolumeDao.persist(template);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.