cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/master to d332782
Date Fri, 08 Aug 2014 16:53:48 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 2491630f5 -> d33278250


CLOUDSTACK-7264:NPE while creating scheduled/recurring snapshots for the
removed account with cleanup_needed=1.


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

Branch: refs/heads/master
Commit: d33278250dd5d33529aebe67b7e4a461e64e77e2
Parents: 2491630
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Aug 8 09:42:05 2014 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Aug 8 09:42:55 2014 -0700

----------------------------------------------------------------------
 .../cloud/storage/snapshot/SnapshotSchedulerImpl.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d3327825/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index ba3d63a..599e906 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -52,7 +52,9 @@ import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.dao.SnapshotPolicyDao;
 import com.cloud.storage.dao.SnapshotScheduleDao;
 import com.cloud.storage.dao.VolumeDao;
+import com.cloud.user.Account;
 import com.cloud.user.User;
+import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.DateUtil.IntervalType;
 import com.cloud.utils.NumbersUtil;
@@ -84,6 +86,8 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
     protected ConfigurationDao _configDao;
     @Inject
     protected ApiDispatcher _dispatcher;
+    @Inject
+    protected AccountDao _acctDao;
 
     protected AsyncJobDispatcher _asyncDispatcher;
 
@@ -235,6 +239,14 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
                     // this volume is not attached
                     continue;
                 }
+                Account volAcct = _acctDao.findById(volume.getAccountId());
+                if (volAcct == null || volAcct.getState() == Account.State.disabled) {
+                    // this account has been removed, so don't trigger recurring snapshot
+                    if (s_logger.isDebugEnabled()) {
+                        s_logger.debug("Skip snapshot for volume " + volume.getUuid() + "
since its account has been removed or disabled");
+                    }
+                    continue;
+                }
                 if (_snapshotPolicyDao.findById(policyId) == null) {
                     _snapshotScheduleDao.remove(snapshotToBeExecuted.getId());
                 }


Mime
View raw message