CLOUDSTACK-4116: don't update db if hypervisor storage processor does

not return volume size.
This commit is contained in:
Min Chen 2013-08-06 15:21:36 -07:00
parent 923c4fd60f
commit 0243f043cb
1 changed files with 6 additions and 2 deletions

View File

@ -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);
}