public void testCopyBaseImage() {
DataStore primaryStore = createPrimaryDataStore();
primaryStoreId = primaryStore.getId();
primaryStore = this.dataStoreMgr.getPrimaryDataStore(primaryStoreId);
VolumeVO volume = createVolume(image.getId(), primaryStore.getId());
VolumeInfo volInfo = this.volFactory.getVolume(volume.getId());
AsyncCallFuture<VolumeApiResult> future = this.volumeService.createVolumeFromTemplateAsync(volInfo,
this.primaryStoreId, this.templateFactory.getTemplate(this.image.getId(), DataStoreRole.Image));
try {
VolumeApiResult result = future.get();
AssertJUnit.assertTrue(result.isSuccess());
VolumeInfo newVol = result.getVolume();
boolean res = this.volumeService.destroyVolume(newVol.getId());
Assert.assertTrue(res);
VolumeInfo vol = this.volFactory.getVolume(volume.getId());
future = this.volumeService.expungeVolumeAsync(vol);
result = future.get();
Assert.assertTrue(result.isSuccess());
} catch (InterruptedException e) {
Assert.fail(e.toString());