DaanHoogland commented on a change in pull request #4641:
URL: https://github.com/apache/cloudstack/pull/4641#discussion_r568636962
##########
File path: server/src/main/java/com/cloud/storage/download/DownloadListener.java
##########
@@ -284,18 +308,22 @@ public void processConnect(Host agent, StartupCommand
cmd, boolean forRebalance)
_imageSrv.handleSysTemplateDownload(hostHyper,
agent.getDataCenterId());
// update template_zone_ref for cross-zone templates
_imageSrv.associateCrosszoneTemplatesToZone(agent.getDataCenterId());
+ } else if (cmd instanceof StartupSecondaryStorageCommand) {
+ s_logger.debug("Scheduling postConnect task at " +
STATUS_POLL_INTERVAL + " ms");
+ schedulePostConnectTask(agent, cmd, STATUS_POLL_INTERVAL);
}
- /* This can be removed
- else if ( cmd instanceof StartupStorageCommand) {
- StartupStorageCommand storage = (StartupStorageCommand)cmd;
- if( storage.getResourceType() ==
Storage.StorageResourceType.SECONDARY_STORAGE ||
- storage.getResourceType() ==
Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE ) {
- downloadMonitor.addSystemVMTemplatesToHost(agent,
storage.getTemplateInfo());
- downloadMonitor.handleTemplateSync(agent);
- downloadMonitor.handleVolumeSync(agent);
- }
- }*/
- else if (cmd instanceof StartupSecondaryStorageCommand) {
+ }
+
+ private void schedulePostConnectTask(Host agent, StartupCommand cmd, long
delay) {
+ if (_postConnectTask != null)
+ _postConnectTask.cancel();
+
+ _postConnectTask = new PostConnectTask(this, agent, cmd);
+ _timer.schedule(_postConnectTask, delay);
+ }
+
+ private void postConnect(Host agent, StartupCommand cmd) throws
ConnectionException {
+ if (cmd instanceof StartupSecondaryStorageCommand) {
Review comment:
this is only ever called with a `StartupSecondaryStorageCommand` so can
we change the parameter type and skip the class check?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]