Skip to content

Commit 68f51a3

Browse files
minchen07milamberspace
authored andcommitted
CLOUDSTACK-2523: Recurring snapshot failed with NPE.
1 parent 0017687 commit 68f51a3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.cloud.utils.DateUtil.IntervalType;
5757
import com.cloud.utils.NumbersUtil;
5858

59+
import com.cloud.utils.component.ComponentContext;
5960
import com.cloud.utils.component.ManagerBase;
6061
import com.cloud.utils.concurrency.TestClock;
6162
import com.cloud.utils.db.DB;
@@ -75,7 +76,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
7576
@Inject protected AsyncJobManager _asyncMgr;
7677
@Inject protected VolumeDao _volsDao;
7778
@Inject protected ConfigurationDao _configDao;
78-
79+
7980
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 5; // 5 seconds
8081
private int _snapshotPollInterval;
8182
private Timer _testClockTimer;
@@ -246,6 +247,7 @@ protected void scheduleSnapshots() {
246247
params.put("ctxStartEventId", String.valueOf(eventId));
247248

248249
CreateSnapshotCmd cmd = new CreateSnapshotCmd();
250+
ComponentContext.inject(cmd);
249251
ApiDispatcher.getInstance().dispatchCreateCmd(cmd, params);
250252
params.put("id", ""+cmd.getEntityId());
251253
params.put("ctxStartEventId", "1");
@@ -350,7 +352,7 @@ public boolean configure(String name, Map<String, Object> params)
350352
_testTimerTask = new TestClock(this, minutesPerHour, hoursPerDay, daysPerWeek, daysPerMonth, weeksPerMonth, monthsPerYear);
351353
}
352354
_currentTimestamp = new Date();
353-
355+
354356
s_logger.info("Snapshot Scheduler is configured.");
355357

356358
return true;

0 commit comments

Comments
 (0)