mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	download template to primary storage works now
This commit is contained in:
		
							parent
							
								
									c60c373a38
								
							
						
					
					
						commit
						0c6e87c701
					
				@ -41,7 +41,7 @@ public class VolumeObjectTO implements DataTO {
 | 
			
		||||
 | 
			
		||||
    public VolumeObjectTO(VolumeInfo volume) {
 | 
			
		||||
        this.uuid = volume.getUuid();
 | 
			
		||||
        this.path = volume.getUri();
 | 
			
		||||
        this.path = volume.getPath();
 | 
			
		||||
        this.accountId = volume.getAccountId();
 | 
			
		||||
        if (volume.getDataStore() != null) {
 | 
			
		||||
            this.dataStore = volume.getDataStore().getTO();
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,7 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
 | 
			
		||||
    private String localStorageUuid;
 | 
			
		||||
    private String primaryStorageUrl;
 | 
			
		||||
    private String secondaryStorage;
 | 
			
		||||
    private String imageInstallPath;
 | 
			
		||||
    private Transaction txn;
 | 
			
		||||
 | 
			
		||||
    private String s3AccessKey;
 | 
			
		||||
@ -66,13 +67,14 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @BeforeMethod(alwaysRun = true)
 | 
			
		||||
 | 
			
		||||
    @Parameters({"devcloud-host-uuid", "devcloud-host-gateway", "devcloud-host-cidr",
 | 
			
		||||
        "devcloud-host-ip", "template-url", "devcloud-local-storage-uuid",
 | 
			
		||||
        "primary-storage-want-to-add", "devcloud-secondary-storage", "s3-accesskey", "s3-secretkey", "s3-endpoint", "s3-template-bucket", "s3-usehttps"})
 | 
			
		||||
        "primary-storage-want-to-add", "devcloud-secondary-storage", "s3-accesskey", "s3-secretkey", "s3-endpoint", "s3-template-bucket", "s3-usehttps", "image-install-path"})
 | 
			
		||||
    protected void setup(String hostuuid, String gateway, String cidr,
 | 
			
		||||
            String hostIp, String templateUrl, String localStorageUuid,
 | 
			
		||||
            String primaryStorage, String secondaryStorage, String s3_accessKey, String s3_secretKey, String s3_endpoint, String s3_template_bucket,
 | 
			
		||||
            String s3_usehttps) {
 | 
			
		||||
            String s3_usehttps, String imageInstallPath) {
 | 
			
		||||
        this.hostGuid = hostuuid;
 | 
			
		||||
        this.hostGateway = gateway;
 | 
			
		||||
        this.hostCidr = cidr;
 | 
			
		||||
@ -80,6 +82,7 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
 | 
			
		||||
        this.templateUrl = templateUrl;
 | 
			
		||||
        this.localStorageUuid = localStorageUuid;
 | 
			
		||||
        this.primaryStorageUrl = primaryStorage;
 | 
			
		||||
        this.imageInstallPath = imageInstallPath;
 | 
			
		||||
        this.setSecondaryStorage(secondaryStorage);
 | 
			
		||||
        // set S3 parameters
 | 
			
		||||
        this.s3AccessKey = s3_accessKey;
 | 
			
		||||
@ -125,6 +128,7 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
 | 
			
		||||
		this.secondaryStorage = secondaryStorage;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getS3AccessKey() {
 | 
			
		||||
        return s3AccessKey;
 | 
			
		||||
    }
 | 
			
		||||
@ -145,6 +149,12 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
 | 
			
		||||
        return s3UseHttps;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getImageInstallPath() {
 | 
			
		||||
        return imageInstallPath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setImageInstallPath(String imageInstallPath) {
 | 
			
		||||
        this.imageInstallPath = imageInstallPath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -79,8 +79,16 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Answer easySend(Long hostId, Command cmd) {
 | 
			
		||||
        // TODO Auto-generated method stub
 | 
			
		||||
        return null;
 | 
			
		||||
      try {
 | 
			
		||||
        return this.send(hostId, cmd);
 | 
			
		||||
    } catch (AgentUnavailableException e) {
 | 
			
		||||
        // TODO Auto-generated catch block
 | 
			
		||||
        e.printStackTrace();
 | 
			
		||||
    } catch (OperationTimedoutException e) {
 | 
			
		||||
        // TODO Auto-generated catch block
 | 
			
		||||
        e.printStackTrace();
 | 
			
		||||
    }
 | 
			
		||||
      return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected void loadResource(Long hostId) {
 | 
			
		||||
 | 
			
		||||
@ -183,22 +183,6 @@ public class volumeServiceTest extends CloudStackTestNGBase {
 | 
			
		||||
		imageStore.setUuid(UUID.randomUUID().toString());
 | 
			
		||||
		imageStore = imageStoreDao.persist(imageStore);
 | 
			
		||||
 | 
			
		||||
		//primaryStore = createPrimaryDataStore();
 | 
			
		||||
 | 
			
		||||
		//CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(UUID.randomUUID().toString());
 | 
			
		||||
 | 
			
		||||
		/*try {
 | 
			
		||||
			Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer);
 | 
			
		||||
		} catch (AgentUnavailableException e) {
 | 
			
		||||
			// TODO Auto-generated catch block
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		} catch (OperationTimedoutException e) {
 | 
			
		||||
			// TODO Auto-generated catch block
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		//Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 | 
			
		||||
@ -244,7 +244,12 @@ public class VolumeObject implements VolumeInfo {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String getPath() {
 | 
			
		||||
        return this.volumeVO.getPath();
 | 
			
		||||
        if (this.dataStore.getRole() == DataStoreRole.Primary) {
 | 
			
		||||
            return this.volumeVO.getPath();
 | 
			
		||||
        } else {
 | 
			
		||||
            DataObjectInStore objInStore = this.ojbectInStoreMgr.findObject(this, dataStore);
 | 
			
		||||
            return objInStore.getInstallPath();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 | 
			
		||||
@ -376,7 +376,7 @@ public class VolumeServiceImpl implements VolumeService {
 | 
			
		||||
            templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
 | 
			
		||||
            VolumeApiResult result = new VolumeApiResult(volume);
 | 
			
		||||
            result.setResult(e.toString());
 | 
			
		||||
            caller.complete(result);
 | 
			
		||||
            future.complete(result);
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user