Skip to content

Commit 1c94017

Browse files
committed
CID-1241966 Fix potential null deref
1 parent ef4b5d4 commit 1c94017

1 file changed

Lines changed: 33 additions & 33 deletions

File tree

engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,16 @@ public Volume allocateDuplicateVolume(Volume oldVol, Long templateId) {
211211

212212
public VolumeVO allocateDuplicateVolumeVO(Volume oldVol, Long templateId) {
213213
VolumeVO newVol = new VolumeVO(oldVol.getVolumeType(),
214-
oldVol.getName(),
215-
oldVol.getDataCenterId(),
216-
oldVol.getDomainId(),
217-
oldVol.getAccountId(),
218-
oldVol.getDiskOfferingId(),
219-
oldVol.getProvisioningType(),
220-
oldVol.getSize(),
221-
oldVol.getMinIops(),
222-
oldVol.getMaxIops(),
223-
oldVol.get_iScsiName());
214+
oldVol.getName(),
215+
oldVol.getDataCenterId(),
216+
oldVol.getDomainId(),
217+
oldVol.getAccountId(),
218+
oldVol.getDiskOfferingId(),
219+
oldVol.getProvisioningType(),
220+
oldVol.getSize(),
221+
oldVol.getMinIops(),
222+
oldVol.getMaxIops(),
223+
oldVol.get_iScsiName());
224224
if (templateId != null) {
225225
newVol.setTemplateId(templateId);
226226
} else {
@@ -595,16 +595,16 @@ public DiskProfile allocateRawVolume(Type type, String name, DiskOffering offeri
595595
maxIops = maxIops != null ? maxIops : offering.getMaxIops();
596596

597597
VolumeVO vol = new VolumeVO(type,
598-
name,
599-
vm.getDataCenterId(),
600-
owner.getDomainId(),
601-
owner.getId(),
602-
offering.getId(),
603-
offering.getProvisioningType(),
604-
size,
605-
minIops,
606-
maxIops,
607-
null);
598+
name,
599+
vm.getDataCenterId(),
600+
owner.getDomainId(),
601+
owner.getId(),
602+
offering.getId(),
603+
offering.getProvisioningType(),
604+
size,
605+
minIops,
606+
maxIops,
607+
null);
608608
if (vm != null) {
609609
vol.setInstanceId(vm.getId());
610610
}
@@ -656,16 +656,16 @@ public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering
656656
maxIops = maxIops != null ? maxIops : offering.getMaxIops();
657657

658658
VolumeVO vol = new VolumeVO(type,
659-
name,
660-
vm.getDataCenterId(),
661-
owner.getDomainId(),
662-
owner.getId(),
663-
offering.getId(),
664-
offering.getProvisioningType(),
665-
size,
666-
minIops,
667-
maxIops,
668-
null);
659+
name,
660+
vm.getDataCenterId(),
661+
owner.getDomainId(),
662+
owner.getId(),
663+
offering.getId(),
664+
offering.getProvisioningType(),
665+
size,
666+
minIops,
667+
maxIops,
668+
null);
669669
vol.setFormat(getSupportedImageFormatForCluster(template.getHypervisorType()));
670670
if (vm != null) {
671671
vol.setInstanceId(vm.getId());
@@ -682,8 +682,8 @@ public DiskProfile allocateTemplatedVolume(Type type, String name, DiskOffering
682682
}
683683

684684
if (vm.getType() == VirtualMachine.Type.User) {
685-
UserVmVO userVm = _userVmDao.findById(vm.getId());
686-
vol.setDisplayVolume(userVm.isDisplayVm());
685+
UserVmVO userVm = _userVmDao.findById(vm.getId());
686+
vol.setDisplayVolume(userVm.isDisplayVm());
687687
}
688688

689689

@@ -1092,7 +1092,7 @@ private List<VolumeTask> getTasks(List<VolumeVO> vols, Map<Volume, StoragePool>
10921092
if (assignedPool == null && recreate) {
10931093
assignedPool = _storagePoolDao.findById(vol.getPoolId());
10941094
}
1095-
if (assignedPool != null || recreate) {
1095+
if (assignedPool != null) {
10961096
Volume.State state = vol.getState();
10971097
if (state == Volume.State.Allocated || state == Volume.State.Creating) {
10981098
VolumeTask task = new VolumeTask(VolumeTaskType.RECREATE, vol, null);

0 commit comments

Comments
 (0)