Repository: cloudstack
Updated Branches:
  refs/heads/master 1b51bbbf7 -> bd6a89939


Adding/updating comments around the volume's hypervisor snapshot reserve field

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd6a8993
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd6a8993
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd6a8993

Branch: refs/heads/master
Commit: bd6a89939d6a5472582ff6cd90ee04e008205ee9
Parents: 1b51bbb
Author: Mike Tutkowski <[email protected]>
Authored: Thu Jan 29 15:50:42 2015 -0700
Committer: Mike Tutkowski <[email protected]>
Committed: Thu Jan 29 15:50:42 2015 -0700

----------------------------------------------------------------------
 .../cloudstack/engine/orchestration/VolumeOrchestrator.java    | 6 +++---
 .../storage/motion/StorageSystemDataMotionStrategy.java        | 2 +-
 server/src/com/cloud/storage/StorageManagerImpl.java           | 5 +++++
 3 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd6a8993/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 7c6d3e2..9ddaa9f 100644
--- 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -482,7 +482,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
     @DB
     public VolumeInfo createVolume(VolumeInfo volume, VirtualMachine vm, 
VirtualMachineTemplate template, DataCenter dc, Pod pod, Long clusterId, 
ServiceOffering offering,
             DiskOffering diskOffering, List<StoragePool> avoids, long size, 
HypervisorType hyperType) {
-        // update the volume's hypervisor_ss_reserve from its disk offering 
(used for managed storage)
+        // update the volume's hv_ss_reserve (hypervisor snapshot reserve) 
from a disk offering (used for managed storage)
         volume = 
volService.updateHypervisorSnapshotReserveForVolume(diskOffering, 
volume.getId(), hyperType);
 
         StoragePool pool = null;
@@ -1235,7 +1235,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
                 DiskOffering diskOffering = 
_entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId());
                 HypervisorType hyperType = 
vm.getVirtualMachine().getHypervisorType();
 
-                // update the volume's hypervisor_ss_reserve from its disk 
offering (used for managed storage)
+                // update the volume's hv_ss_reserve (hypervisor snapshot 
reserve) from a disk offering (used for managed storage)
                 
volService.updateHypervisorSnapshotReserveForVolume(diskOffering, 
volume.getId(), hyperType);
 
                 volume = volFactory.getVolume(newVol.getId(), destPool);
@@ -1255,7 +1255,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
                     DiskOffering diskOffering = 
_entityMgr.findById(DiskOffering.class, volume.getDiskOfferingId());
                     HypervisorType hyperType = 
vm.getVirtualMachine().getHypervisorType();
 
-                    // update the volume's hypervisor_ss_reserve from its disk 
offering (used for managed storage)
+                    // update the volume's hv_ss_reserve (hypervisor snapshot 
reserve) from a disk offering (used for managed storage)
                     
volService.updateHypervisorSnapshotReserveForVolume(diskOffering, 
volume.getId(), hyperType);
 
                     long hostId = vm.getVirtualMachine().getHostId();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd6a8993/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
 
b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
index e9244be..3c9334d 100644
--- 
a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
+++ 
b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
@@ -250,7 +250,7 @@ public class StorageSystemDataMotionStrategy implements 
DataMotionStrategy {
             DiskOfferingVO diskOffering = 
_diskOfferingDao.findByIdIncludingRemoved(volumeInfo.getDiskOfferingId());
             SnapshotVO snapshot = _snapshotDao.findById(snapshotInfo.getId());
 
-            // update the volume's hypervisor_ss_reserve from its disk 
offering (used for managed storage)
+            // update the volume's hv_ss_reserve (hypervisor snapshot reserve) 
from a disk offering (used for managed storage)
             
_volumeService.updateHypervisorSnapshotReserveForVolume(diskOffering, 
volumeInfo.getId(), snapshot.getHypervisorType());
 
             AsyncCallFuture<VolumeApiResult> future = 
_volumeService.createVolumeAsync(volumeInfo, volumeInfo.getDataStore());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd6a8993/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java 
b/server/src/com/cloud/storage/StorageManagerImpl.java
index ba8925a..bfaa461 100644
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1582,11 +1582,16 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
         long allocatedSizeWithtemplate = 
_capacityMgr.getAllocatedPoolCapacity(poolVO, null);
         long totalAskingSize = 0;
         for (Volume volume : volumes) {
+            // refreshing the volume from the DB to get latest hv_ss_reserve 
(hypervisor snapshot reserve) field
+            // I could have just assigned this to "volume", but decided to 
make a new variable for it so that it
+            // might be clearer that this "volume" in "volumes" still might 
have an old value for hv_ss_reverse.
             VolumeVO volumeVO = _volumeDao.findById(volume.getId());
 
             if (volumeVO.getHypervisorSnapshotReserve() == null) {
+                // update the volume's hv_ss_reserve (hypervisor snapshot 
reserve) from a disk offering (used for managed storage)
                 
volService.updateHypervisorSnapshotReserveForVolume(getDiskOfferingVO(volumeVO),
 volumeVO.getId(), getHypervisorType(volumeVO));
 
+                // hv_ss_reserve field might have been updated; refresh from 
DB to make use of it in getVolumeSizeIncludingHypervisorSnapshotReserve
                 volumeVO = _volumeDao.findById(volume.getId());
             }
 

Reply via email to