Repository: cloudstack Updated Branches: refs/heads/CID-1241966 [created] 586e00cee
CID-1241966 Fix potential null deref Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1c94017f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1c94017f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1c94017f Branch: refs/heads/CID-1241966 Commit: 1c94017ff693fbff51553d0095aef4d9e0552098 Parents: ef4b5d4 Author: Hugo Trippaers <[email protected]> Authored: Tue Sep 30 11:27:51 2014 +0200 Committer: Hugo Trippaers <[email protected]> Committed: Tue Sep 30 11:27:51 2014 +0200 ---------------------------------------------------------------------- .../orchestration/VolumeOrchestrator.java | 66 ++++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c94017f/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index fa036e7..262b94d 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -211,16 +211,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati public VolumeVO allocateDuplicateVolumeVO(Volume oldVol, Long templateId) { VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(), - oldVol.getName(), - oldVol.getDataCenterId(), - oldVol.getDomainId(), - oldVol.getAccountId(), - oldVol.getDiskOfferingId(), - oldVol.getProvisioningType(), - oldVol.getSize(), - oldVol.getMinIops(), - oldVol.getMaxIops(), - oldVol.get_iScsiName()); + oldVol.getName(), + oldVol.getDataCenterId(), + oldVol.getDomainId(), + oldVol.getAccountId(), + oldVol.getDiskOfferingId(), + oldVol.getProvisioningType(), + oldVol.getSize(), + oldVol.getMinIops(), + oldVol.getMaxIops(), + oldVol.get_iScsiName()); if (templateId != null) { newVol.setTemplateId(templateId); } else { @@ -595,16 +595,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati maxIops = maxIops != null ? maxIops : offering.getMaxIops(); VolumeVO vol = new VolumeVO(type, - name, - vm.getDataCenterId(), - owner.getDomainId(), - owner.getId(), - offering.getId(), - offering.getProvisioningType(), - size, - minIops, - maxIops, - null); + name, + vm.getDataCenterId(), + owner.getDomainId(), + owner.getId(), + offering.getId(), + offering.getProvisioningType(), + size, + minIops, + maxIops, + null); if (vm != null) { vol.setInstanceId(vm.getId()); } @@ -656,16 +656,16 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati maxIops = maxIops != null ? maxIops : offering.getMaxIops(); VolumeVO vol = new VolumeVO(type, - name, - vm.getDataCenterId(), - owner.getDomainId(), - owner.getId(), - offering.getId(), - offering.getProvisioningType(), - size, - minIops, - maxIops, - null); + name, + vm.getDataCenterId(), + owner.getDomainId(), + owner.getId(), + offering.getId(), + offering.getProvisioningType(), + size, + minIops, + maxIops, + null); vol.setFormat(getSupportedImageFormatForCluster(template.getHypervisorType())); if (vm != null) { vol.setInstanceId(vm.getId()); @@ -682,8 +682,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati } if (vm.getType() == VirtualMachine.Type.User) { - UserVmVO userVm = _userVmDao.findById(vm.getId()); - vol.setDisplayVolume(userVm.isDisplayVm()); + UserVmVO userVm = _userVmDao.findById(vm.getId()); + vol.setDisplayVolume(userVm.isDisplayVm()); } @@ -1092,7 +1092,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati if (assignedPool == null && recreate) { assignedPool = _storagePoolDao.findById(vol.getPoolId()); } - if (assignedPool != null || recreate) { + if (assignedPool != null) { Volume.State state = vol.getState(); if (state == Volume.State.Allocated || state == Volume.State.Creating) { VolumeTask task = new VolumeTask(VolumeTaskType.RECREATE, vol, null);
