CLOUDSTACK-4116: don't update db if hypervisor storage processor does
not return volume size.


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

Branch: refs/heads/master
Commit: ec89e23665d32607d04c66e3df77e872f8f6a8b9
Parents: 45c34b9
Author: Min Chen <[email protected]>
Authored: Tue Aug 6 15:21:36 2013 -0700
Committer: Min Chen <[email protected]>
Committed: Tue Aug 6 15:42:18 2013 -0700

----------------------------------------------------------------------
 .../org/apache/cloudstack/storage/volume/VolumeObject.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec89e236/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
 
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index 7ec5022..de63d7d 100644
--- 
a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ 
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -471,7 +471,9 @@ public class VolumeObject implements VolumeInfo {
                     VolumeVO vol = this.volumeDao.findById(this.getId());
                     VolumeObjectTO newVol = (VolumeObjectTO) 
cpyAnswer.getNewData();
                     vol.setPath(newVol.getPath());
-                    vol.setSize(newVol.getSize());
+                    if (newVol.getSize() != null) {
+                        vol.setSize(newVol.getSize());
+                    }
                     vol.setPoolId(this.getDataStore().getId());
                     volumeDao.update(vol.getId(), vol);
                 } else if (answer instanceof CreateObjectAnswer) {
@@ -479,7 +481,9 @@ public class VolumeObject implements VolumeInfo {
                     VolumeObjectTO newVol = (VolumeObjectTO) 
createAnswer.getData();
                     VolumeVO vol = this.volumeDao.findById(this.getId());
                     vol.setPath(newVol.getPath());
-                    vol.setSize(newVol.getSize());
+                    if (newVol.getSize() != null) {
+                        vol.setSize(newVol.getSize());
+                    }
                     vol.setPoolId(this.getDataStore().getId());
                     volumeDao.update(vol.getId(), vol);
                 }

Reply via email to