Package org.apache.cloudstack.engine.subsystem.api.storage

Examples of org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo


            if (availHypers.contains(template.getHypervisorType())) {
                // only download sys template applicable for current hypervisor
                TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao
                        .findByStoreTemplate(store.getId(), template.getId());
                if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready) {
                    TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
                    createTemplateAsync(tmplt, store, null);
                }
            }
        }
    }
View Full Code Here


                TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao
                        .findByStoreTemplate(store.getId(), template.getId());
                if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready) {
                    associateTemplateToZone(template.getId(), dcId);
                    s_logger.info("Downloading builtin template " + template.getUniqueName() + " to data center: " + dcId);
                    TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
                    createTemplateAsync(tmplt, store, null);
                }
            }
        }
    }
View Full Code Here

                            if (availHypers.contains(tmplt.getHypervisorType())) {
                                s_logger.info("Downloading template " + tmplt.getUniqueName() + " to image store "
                                        + store.getName());
                                associateTemplateToZone(tmplt.getId(), zoneId);
                                TemplateInfo tmpl = _templateFactory.getTemplate(tmplt.getId(), DataStoreRole.Image);
                                createTemplateAsync(tmpl, store, null);
                            } else {
                                s_logger.info("Skip downloading template " + tmplt.getUniqueName() + " since current data center does not have hypervisor "
                                        + tmplt.getHypervisorType().toString());
                            }
View Full Code Here

        return copyAsync(srcTemplate, srcTemplate, (DataStore) pool);
    }

    protected Void copyTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl, CopyCommandResult> callback,
            TemplateOpContext<TemplateApiResult> context) {
        TemplateInfo destTemplate = context.getTemplate();
        CopyCommandResult result = callback.getResult();
        AsyncCallFuture<TemplateApiResult> future = context.getFuture();
        TemplateApiResult res = new TemplateApiResult(destTemplate);
        try {
            if (result.isFailed()) {
                res.setResult(result.getResult());
                destTemplate.processEvent(Event.OperationFailed);
            } else {
                destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
            }
            future.complete(res);
        } catch (Exception e) {
            s_logger.debug("Failed to process copy template callback", e);
            res.setResult(e.toString());
View Full Code Here

    protected Void copyTemplateCrossZoneCallBack(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Performing copy template cross zone callback after completion");
        }
        TemplateInfo destTemplate = context.getTemplate();
        CreateCmdResult result = callback.getResult();
        AsyncCallFuture<TemplateApiResult> future = context.getFuture();
        TemplateApiResult res = new TemplateApiResult(destTemplate);
        try {
            if (result.isFailed()) {
                res.setResult(result.getResult());
                destTemplate.processEvent(Event.OperationFailed);
            } else {
                destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
            }
            future.complete(res);
        } catch (Exception e) {
            s_logger.debug("Failed to process copy template cross zones callback", e);
            res.setResult(e.toString());
View Full Code Here

                ts.setDataStoreRole(dataStore.getRole());
                String installPath = TemplateConstants.DEFAULT_TMPLT_ROOT_DIR + "/"
                        + TemplateConstants.DEFAULT_TMPLT_FIRST_LEVEL_DIR
                        + templateDao.findById(obj.getId()).getAccountId() + "/" + obj.getId();
                if (dataStore.getTO() instanceof S3TO) {
                    TemplateInfo tmpl = (TemplateInfo) obj;
                    installPath += "/" + tmpl.getUniqueName(); // for S3, we
                    // append
                    // template name
                    // in the path
                    // for template
                    // sync since we
View Full Code Here

        Mockito.when(epSelector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(ep);
    }

    @Test(priority = 1)
    public void registerTemplate() {
        TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
        DataStore store = dataStoreMgr.getImageStore(dcId);
        AsyncCallFuture<TemplateApiResult> future = new AsyncCallFuture<TemplateApiResult>();
        templateSvr.createTemplateAsync(template, store, future);
        try {
            TemplateApiResult result = future.get();
View Full Code Here

        }
    }

    @Test(priority = 2)
    public void copyTemplateToCache() {
        TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
        DataObject cacheObj = this.cacheMgr.createCacheObject(template, new ZoneScope(dcId));
        assertNotNull(cacheObj, "failed to create cache object");
    }
View Full Code Here

         * templateStore.setTemplateId(image.getId());
         * templateStoreDao.persist(templateStore);
         */

        DataStore store = this.dataStoreMgr.getDataStore(imageStore.getId(), DataStoreRole.Image);
        TemplateInfo template = templateFactory.getTemplate(image.getId(), DataStoreRole.Image);
        DataObject templateOnStore = store.create(template);
        TemplateObjectTO to = new TemplateObjectTO();
        to.setPath(this.getImageInstallPath());
        to.setFormat(ImageFormat.VHD);
        to.setSize(100L);
View Full Code Here

        VolumeApiResult result = future.get();

        AssertJUnit.assertTrue(result.isSuccess());
        volInfo = result.getVolume();
        VMTemplateVO templateVO = createTemplateInDb();
        TemplateInfo tmpl = this.templateFactory.getTemplate(templateVO.getId(), DataStoreRole.Image);
        DataStore imageStore = this.dataStoreMgr.getImageStore(this.dcId);

        AsyncCallFuture<TemplateApiResult> templateResult = this.imageService.createTemplateFromVolumeAsync(volInfo, tmpl, imageStore);
        TemplateApiResult templateApiResult = templateResult.get();
        Assert.assertTrue(templateApiResult.isSuccess());
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo

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.