cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/master to f17f35e
Date Wed, 27 Nov 2013 13:38:36 GMT
Updated Branches:
  refs/heads/master 226b19348 -> f17f35eeb


CLOUDSTACK-5293: fix issue when collect vm disk statistics from iso


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

Branch: refs/heads/master
Commit: f17f35eeb853ef170ba48d67ddd99d4f91f6a231
Parents: 226b193
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Wed Nov 27 14:38:25 2013 +0100
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Wed Nov 27 14:38:25 2013 +0100

----------------------------------------------------------------------
 server/src/com/cloud/server/StatsCollector.java | 5 ++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f17f35ee/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index 470c37d..5300105 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -433,7 +433,10 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
                                 for (VmDiskStatsEntry vmDiskStat : vmDiskStats) {
                                     SearchCriteria<VolumeVO> sc_volume = _volsDao.createSearchCriteria();
                                     sc_volume.addAnd("path", SearchCriteria.Op.EQ, vmDiskStat.getPath());
-                                    VolumeVO volume = _volsDao.search(sc_volume, null).get(0);
+                                    List<VolumeVO> volumes = _volsDao.search(sc_volume,
null);
+                                    if ((volumes == null) || (volumes.size() == 0))
+                                        break;
+                                    VolumeVO volume = volumes.get(0);
                                     VmDiskStatisticsVO previousVmDiskStats =
                                         _vmDiskStatsDao.findBy(userVm.getAccountId(), userVm.getDataCenterId(),
vmId, volume.getId());
                                     VmDiskStatisticsVO vmDiskStat_lock = _vmDiskStatsDao.lock(userVm.getAccountId(),
userVm.getDataCenterId(), vmId, volume.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f17f35ee/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 45b141f..c0b0031 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3351,7 +3351,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                         for (VmDiskStatsEntry vmDiskStat : vmDiskStats) {
                             SearchCriteria<VolumeVO> sc_volume = _volsDao.createSearchCriteria();
                             sc_volume.addAnd("path", SearchCriteria.Op.EQ, vmDiskStat.getPath());
-                            VolumeVO volume = _volsDao.search(sc_volume, null).get(0);
+                            List<VolumeVO> volumes = _volsDao.search(sc_volume, null);
+                            if ((volumes == null) || (volumes.size() == 0))
+                                break;
+                            VolumeVO volume = volumes.get(0);
                             VmDiskStatisticsVO previousVmDiskStats =
                                 _vmDiskStatsDao.findBy(userVm.getAccountId(), userVm.getDataCenterId(),
userVm.getId(), volume.getId());
                             VmDiskStatisticsVO vmDiskStat_lock = _vmDiskStatsDao.lock(userVm.getAccountId(),
userVm.getDataCenterId(), userVm.getId(), volume.getId());


Mime
View raw message