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/4.3 to 3d601ba
Date Wed, 27 Nov 2013 13:44:18 GMT
Updated Branches:
  refs/heads/4.3 7f6002458 -> 3d601ba41


CLOUDSTACK-5293: fix issue when collect vm disk statistics from iso
(cherry picked from commit f17f35eeb853ef170ba48d67ddd99d4f91f6a231)


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

Branch: refs/heads/4.3
Commit: 3d601ba41a2d60fcd25559852648cd2e8624f32e
Parents: 7f60024
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Wed Nov 27 14:43:47 2013 +0100
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Wed Nov 27 14:43:47 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/3d601ba4/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 699c3c0..45fc43e 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -438,7 +438,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/3d601ba4/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 09afe32..485a345 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3581,7 +3581,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