From 913e2b38bfe5b29c0c172171e83d4fb7f8a8e6d6 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Thu, 23 May 2013 17:22:44 -0700 Subject: [PATCH] CLOUDSTACK-2523: Recurring snapshot failed with NPE. --- .../com/cloud/storage/snapshot/SnapshotSchedulerImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index 5af0af00ae4..9b6d2188385 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -56,6 +56,7 @@ import com.cloud.utils.DateUtil; import com.cloud.utils.DateUtil.IntervalType; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.TestClock; import com.cloud.utils.db.DB; @@ -75,7 +76,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu @Inject protected AsyncJobManager _asyncMgr; @Inject protected VolumeDao _volsDao; @Inject protected ConfigurationDao _configDao; - + private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds private int _snapshotPollInterval; private Timer _testClockTimer; @@ -246,6 +247,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu params.put("ctxStartEventId", String.valueOf(eventId)); CreateSnapshotCmd cmd = new CreateSnapshotCmd(); + ComponentContext.inject(cmd); ApiDispatcher.getInstance().dispatchCreateCmd(cmd, params); params.put("id", ""+cmd.getEntityId()); params.put("ctxStartEventId", "1"); @@ -350,7 +352,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu _testTimerTask = new TestClock(this, minutesPerHour, hoursPerDay, daysPerWeek, daysPerMonth, weeksPerMonth, monthsPerYear); } _currentTimestamp = new Date(); - + s_logger.info("Snapshot Scheduler is configured."); return true;