Package org.apache.cloudstack.storage.to

Examples of org.apache.cloudstack.storage.to.ImageOnPrimaryDataStoreTO


        return new Answer(cmd, false, errorMsg);
    }
   
    protected Answer execute(CreateVolumeFromBaseImageCommand cmd) {
        VolumeTO volume = cmd.getVolume();
        ImageOnPrimaryDataStoreTO baseImage = cmd.getImage();
        Connection conn = hypervisorResource.getConnection();
       
        try {
            VDI baseVdi = VDI.getByUuid(conn, baseImage.getPathOnPrimaryDataStore());
            VDI newVol = baseVdi.createClone(conn, new HashMap<String, String>());
            newVol.setNameLabel(conn, volume.getName());
            return new CreateObjectAnswer(cmd, newVol.getUuid(conn), newVol.getVirtualSize(conn));
        } catch (BadServerResponse e) {
            return new Answer(cmd, false, e.toString());
View Full Code Here


        }
    }
   
    @Test
    public void testDownloadTemplate() {
        ImageOnPrimaryDataStoreTO image = Mockito.mock(ImageOnPrimaryDataStoreTO.class);
        PrimaryDataStoreTO primaryStore = Mockito.mock(PrimaryDataStoreTO.class);
        Mockito.when(primaryStore.getUuid()).thenReturn(this.getLocalStorageUuid());
        Mockito.when(image.getPrimaryDataStore()).thenReturn(primaryStore);
       
        ImageDataStoreTO imageStore = Mockito.mock(ImageDataStoreTO.class);
        Mockito.when(imageStore.getType()).thenReturn("http");
       
        TemplateTO template = Mockito.mock(TemplateTO.class);
        Mockito.when(template.getPath()).thenReturn(this.getTemplateUrl());
        Mockito.when(template.getImageDataStore()).thenReturn(imageStore);
       
        Mockito.when(image.getTemplate()).thenReturn(template);
        //CopyTemplateToPrimaryStorageCmd cmd = new CopyTemplateToPrimaryStorageCmd(image);
        Command cmd = null;
        try {
            agentMgr.send(hostId, cmd);
        } catch (AgentUnavailableException e) {
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.to.ImageOnPrimaryDataStoreTO

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.