Package com.cloud.agent.api.storage

Examples of com.cloud.agent.api.storage.ListTemplateAnswer


            Map<String, TemplateProp> templateInfos = new HashMap<String, TemplateProp>();
            for (MockVolumeVO template : templates) {
                templateInfos.put(template.getName(), new TemplateProp(template.getName(), template.getPath()
                        .replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false));
            }
            return new ListTemplateAnswer(nfsUrl, templateInfos);
        } catch (Exception ex) {
            txn.rollback();
            throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex);
        } finally {
            txn.close();
View Full Code Here


        CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)resource.executeRequest(cpyCmd);
        Assert.assertTrue(copyCmdAnswer.getResult());

        //list template
        ListTemplateCommand listCmd = new ListTemplateCommand(swift);
        ListTemplateAnswer listAnswer = (ListTemplateAnswer)resource.executeRequest(listCmd);

        Assert.assertTrue(listAnswer.getTemplateInfo().size() > 0);
    }
View Full Code Here

    }

    private Answer execute(ListTemplateCommand cmd) {
        if (!_inSystemVM) {
            return new ListTemplateAnswer(null, null);
        }

        DataStoreTO store = cmd.getDataStore();
        if (store instanceof NfsTO) {
            NfsTO nfs = (NfsTO) store;
            String secUrl = nfs.getUrl();
            String root = getRootDir(secUrl);
            Map<String, TemplateProp> templateInfos = _dlMgr.gatherTemplateInfo(root);
            return new ListTemplateAnswer(secUrl, templateInfos);
        } else if (store instanceof SwiftTO) {
            SwiftTO swift = (SwiftTO) store;
            Map<String, TemplateProp> templateInfos = swiftListTemplate(swift);
            return new ListTemplateAnswer(swift.toString(), templateInfos);
        } else if (store instanceof S3TO) {
            S3TO s3 = (S3TO) store;
            Map<String, TemplateProp> templateInfos = s3ListTemplate(s3);
            return new ListTemplateAnswer(s3.getBucketName(), templateInfos);
        } else {
            return new Answer(cmd, false, "Unsupported image data store: " + store);
        }
    }
View Full Code Here

            answer = new Answer(cmd, false, errMsg);
        } else {
            answer = ep.sendMessage(cmd);
        }
        if (answer != null && answer.getResult()) {
            ListTemplateAnswer tanswer = (ListTemplateAnswer) answer;
            return tanswer.getTemplateInfo();
        } else {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("can not list template for secondary storage host " + ssStore.getId());
            }
        }
View Full Code Here


    private Answer execute(ListTemplateCommand cmd) {
        String root = getRootDir();
        Map<String, TemplateInfo> templateInfos = _dlMgr.gatherTemplateInfo(root);
        return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos);
    }
View Full Code Here

   
    private Map<String, TemplateInfo> listTemplate(HostVO ssHost) {
        ListTemplateCommand cmd = new ListTemplateCommand(ssHost.getStorageUrl());
        Answer answer = _agentMgr.sendToSecStorage(ssHost, cmd);
        if (answer != null && answer.getResult()) {
            ListTemplateAnswer tanswer = (ListTemplateAnswer)answer;
            return tanswer.getTemplateInfo();
        } else {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("can not list template for secondary storage host " + ssHost.getId());
            }
        }
View Full Code Here

            return null;
        }
        ListTemplateCommand cmd = new ListTemplateCommand(swift.toSwiftTO());
        Answer answer = _agentMgr.sendToSSVM(null, cmd);
        if (answer != null && answer.getResult()) {
            ListTemplateAnswer tanswer = (ListTemplateAnswer) answer;
            return tanswer.getTemplateInfo();
        } else {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("can not list template for swift " + swift);
            }
        }
View Full Code Here

        if (!_inSystemVM){
            return new Answer(cmd, true, null);
        }
        if (cmd.getSwift() != null) {
            Map<String, TemplateInfo> templateInfos = swiftListTemplate(cmd.getSwift());
            return new ListTemplateAnswer(cmd.getSwift().toString(), templateInfos);
        } else {
            String root = getRootDir(cmd.getSecUrl());
            Map<String, TemplateInfo> templateInfos = _dlMgr.gatherTemplateInfo(root);
            return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos);
        }
    }
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.storage.ListTemplateAnswer

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.