Package com.cloud.agent.api.storage

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


        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


   
    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

        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

            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

   
    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

      for (MockVolumeVO template : templates) {
        templateInfos.put(template.getName(), new TemplateInfo(template.getName(), template.getPath()
            .replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false));
      }
      txn.commit();
      return new ListTemplateAnswer(cmd.getSecUrl(), 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


    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

            for (MockVolumeVO template : templates) {
                templateInfos.put(template.getName(), new TemplateInfo(template.getName(), template.getPath()
                        .replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false));
            }
            txn.commit();
            return new ListTemplateAnswer(cmd.getSecUrl(), 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

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.