Skip to content

Commit 0c6e87c

Browse files
committed
download template to primary storage works now
1 parent c60c373 commit 0c6e87c

6 files changed

Lines changed: 30 additions & 23 deletions

File tree

‎engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public VolumeObjectTO() {
4141

4242
public VolumeObjectTO(VolumeInfo volume) {
4343
this.uuid = volume.getUuid();
44-
this.path = volume.getUri();
44+
this.path = volume.getPath();
4545
this.accountId = volume.getAccountId();
4646
if (volume.getDataStore() != null) {
4747
this.dataStore = volume.getDataStore().getTO();

‎engine/storage/integration-test/test/org/apache/cloudstack/storage/test/CloudStackTestNGBase.java‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests {
3636
private String localStorageUuid;
3737
private String primaryStorageUrl;
3838
private String secondaryStorage;
39+
private String imageInstallPath;
3940
private Transaction txn;
4041

4142
private String s3AccessKey;
@@ -66,20 +67,22 @@ protected void closeDB(Method testMethod) throws Exception {
6667
}
6768

6869
@BeforeMethod(alwaysRun = true)
70+
6971
@Parameters({"devcloud-host-uuid", "devcloud-host-gateway", "devcloud-host-cidr",
7072
"devcloud-host-ip", "template-url", "devcloud-local-storage-uuid",
71-
"primary-storage-want-to-add", "devcloud-secondary-storage", "s3-accesskey", "s3-secretkey", "s3-endpoint", "s3-template-bucket", "s3-usehttps"})
73+
"primary-storage-want-to-add", "devcloud-secondary-storage", "s3-accesskey", "s3-secretkey", "s3-endpoint", "s3-template-bucket", "s3-usehttps", "image-install-path"})
7274
protected void setup(String hostuuid, String gateway, String cidr,
7375
String hostIp, String templateUrl, String localStorageUuid,
7476
String primaryStorage, String secondaryStorage, String s3_accessKey, String s3_secretKey, String s3_endpoint, String s3_template_bucket,
75-
String s3_usehttps) {
77+
String s3_usehttps, String imageInstallPath) {
7678
this.hostGuid = hostuuid;
7779
this.hostGateway = gateway;
7880
this.hostCidr = cidr;
7981
this.hostIp = hostIp;
8082
this.templateUrl = templateUrl;
8183
this.localStorageUuid = localStorageUuid;
8284
this.primaryStorageUrl = primaryStorage;
85+
this.imageInstallPath = imageInstallPath;
8386
this.setSecondaryStorage(secondaryStorage);
8487
// set S3 parameters
8588
this.s3AccessKey = s3_accessKey;
@@ -125,6 +128,7 @@ public void setSecondaryStorage(String secondaryStorage) {
125128
this.secondaryStorage = secondaryStorage;
126129
}
127130

131+
128132
public String getS3AccessKey() {
129133
return s3AccessKey;
130134
}
@@ -145,6 +149,12 @@ public boolean isS3UseHttps() {
145149
return s3UseHttps;
146150
}
147151

152+
public String getImageInstallPath() {
153+
return imageInstallPath;
154+
}
148155

156+
public void setImageInstallPath(String imageInstallPath) {
157+
this.imageInstallPath = imageInstallPath;
158+
}
149159

150160
}

‎engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,16 @@ public String getName() {
7979

8080
@Override
8181
public Answer easySend(Long hostId, Command cmd) {
82-
// TODO Auto-generated method stub
83-
return null;
82+
try {
83+
return this.send(hostId, cmd);
84+
} catch (AgentUnavailableException e) {
85+
// TODO Auto-generated catch block
86+
e.printStackTrace();
87+
} catch (OperationTimedoutException e) {
88+
// TODO Auto-generated catch block
89+
e.printStackTrace();
90+
}
91+
return null;
8492
}
8593

8694
protected void loadResource(Long hostId) {

‎engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,22 +183,6 @@ public void setUp() {
183183
imageStore.setUuid(UUID.randomUUID().toString());
184184
imageStore = imageStoreDao.persist(imageStore);
185185

186-
//primaryStore = createPrimaryDataStore();
187-
188-
//CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(UUID.randomUUID().toString());
189-
190-
/*try {
191-
Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer);
192-
} catch (AgentUnavailableException e) {
193-
// TODO Auto-generated catch block
194-
e.printStackTrace();
195-
} catch (OperationTimedoutException e) {
196-
// TODO Auto-generated catch block
197-
e.printStackTrace();
198-
}*/
199-
200-
201-
//Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore);
202186
}
203187

204188
@Override

‎engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ public String getFolder() {
244244

245245
@Override
246246
public String getPath() {
247-
return this.volumeVO.getPath();
247+
if (this.dataStore.getRole() == DataStoreRole.Primary) {
248+
return this.volumeVO.getPath();
249+
} else {
250+
DataObjectInStore objInStore = this.ojbectInStoreMgr.findObject(this, dataStore);
251+
return objInStore.getInstallPath();
252+
}
248253
}
249254

250255
@Override

‎engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStor
376376
templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
377377
VolumeApiResult result = new VolumeApiResult(volume);
378378
result.setResult(e.toString());
379-
caller.complete(result);
379+
future.complete(result);
380380
}
381381
return;
382382
}

0 commit comments

Comments
 (0)