diff --git a/api/src/com/cloud/agent/api/storage/DownloadCommand.java b/api/src/com/cloud/agent/api/storage/DownloadCommand.java index cef9920412d..bc58c20bc91 100644 --- a/api/src/com/cloud/agent/api/storage/DownloadCommand.java +++ b/api/src/com/cloud/agent/api/storage/DownloadCommand.java @@ -135,7 +135,6 @@ public class DownloadCommand extends AbstractDownloadCommand { //this.hvm = volume.isRequiresHvm(); this.checksum = checkSum; this.id = volume.getId(); - //this.description = volume.get; this.setSecUrl(secUrl); this.maxDownloadSizeInBytes = maxDownloadSizeInBytes; this.resourceType = ResourceType.VOLUME; diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java index f31454e66c2..1c43ee85001 100755 --- a/api/src/com/cloud/storage/Volume.java +++ b/api/src/com/cloud/storage/Volume.java @@ -32,9 +32,7 @@ public interface Volume extends ControlledEntity, BasedOn, StateObject 0) { for (VolumeHostVO volumeHost : toBeDownloaded) { if (volumeHost.getDownloadUrl() == null) { // If url is null we can't initiate the download diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index ee29d41e692..c7c28471cdb 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -556,16 +556,19 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager boolean volumeOnSec = false; VolumeHostVO volHostVO = _volumeHostDao.findByVolumeId(volume.getId()); if (volHostVO != null){ - volumeOnSec = true; + volumeOnSec = true; + if( !(volHostVO.getDownloadState() == Status.DOWNLOADED) ){ + throw new InvalidParameterValueException("Volume is not uploaded yet. Please try this operation once the volume is uploaded"); + } } - // Check that the volume is stored on shared storage - if (!(Volume.State.Allocated.equals(volume.getState()) || Volume.State.Uploaded.equals(volume.getState())) && !_storageMgr.volumeOnSharedStoragePool(volume)) { + //If the volume is Ready, check that the volume is stored on shared storage + if (!(Volume.State.Allocated.equals(volume.getState()) || Volume.State.UploadOp.equals(volume.getState())) && !_storageMgr.volumeOnSharedStoragePool(volume)) { throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool."); } - if ( !(Volume.State.Allocated.equals(volume.getState()) || Volume.State.Ready.equals(volume.getState()) || Volume.State.Uploaded.equals(volume.getState())) ) { - throw new InvalidParameterValueException("Volume state must be in Allocated, Ready or Uploaded state"); + if ( !(Volume.State.Allocated.equals(volume.getState()) || Volume.State.Ready.equals(volume.getState())) ) { + throw new InvalidParameterValueException("Volume state must be in Allocated or Ready state"); } VolumeVO rootVolumeOfVm = null; @@ -578,7 +581,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager HypervisorType rootDiskHyperType = _volsDao.getHypervisorType(rootVolumeOfVm.getId()); - if (volume.getState().equals(Volume.State.Allocated) || volume.getState().equals(Volume.State.Uploaded)) { + if (volume.getState().equals(Volume.State.Allocated) || volume.getState().equals(Volume.State.UploadOp)) { /* Need to create the volume */ VMTemplateVO rootDiskTmplt = _templateDao.findById(vm.getTemplateId()); DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterIdToDeployIn());