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.2 to 04adfe4
Date Wed, 27 Nov 2013 13:48:50 GMT
Updated Branches:
  refs/heads/4.2 e23b10319 -> 04adfe431


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/04adfe43
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/04adfe43
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/04adfe43

Branch: refs/heads/4.2
Commit: 04adfe4317bf36df6cc65bf47204c371b4dbcf2a
Parents: e23b103
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Wed Nov 27 14:48:03 2013 +0100
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Wed Nov 27 14:48:03 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/04adfe43/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 3be7461..2e836f0 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -434,7 +434,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/04adfe43/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 d29d1ec..df11597 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3554,7 +3554,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
 	        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