From 6dad46b7ed2ee25855dcd33a19729053df8cd1de Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 29 Apr 2019 23:37:15 +0530 Subject: [PATCH] server: sync templates on adding new secondary storage (#3302) Fixes #2689 With the current code, existing templates were not downloaded to the new secondary storage when it is added. SSVM needed to be restarted to start the download process. This PR starts templates sync for the new secondary storage when it is added. Signed-off-by: Abhishek Kumar --- server/src/main/java/com/cloud/storage/StorageManagerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java index 40ecb848a6f..ae7df6556e3 100644 --- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java @@ -80,6 +80,7 @@ import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.managed.context.ManagedContextRunnable; +import org.apache.cloudstack.management.ManagementServerHost; import org.apache.cloudstack.storage.command.DettachCommand; import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; @@ -115,7 +116,6 @@ import com.cloud.capacity.CapacityState; import com.cloud.capacity.CapacityVO; import com.cloud.capacity.dao.CapacityDao; import com.cloud.cluster.ClusterManagerListener; -import org.apache.cloudstack.management.ManagementServerHost; import com.cloud.configuration.Config; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.ConfigurationManagerImpl; @@ -2096,6 +2096,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C } else { // populate template_store_ref table _imageSrv.addSystemVMTemplatesToSecondary(store); + _imageSrv.handleTemplateSync(store); } // associate builtin template with zones associated with this image store