Skip to content

Commit 93ce108

Browse files
SudharmaJainSudharmaJain
authored andcommitted
CLOUDSTACK-8901: PrepareTemplate job thread hard-coded to max 8 threads
1 parent 3393555 commit 93ce108

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

engine/components-api/src/com/cloud/template/TemplateManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,16 @@
3838
*/
3939
public interface TemplateManager {
4040
static final String AllowPublicUserTemplatesCK = "allow.public.user.templates";
41+
static final String TemplatePreloaderPoolSizeCK = "template.preloader.pool.size";
42+
4143
static final ConfigKey<Boolean> AllowPublicUserTemplates = new ConfigKey<Boolean>("Advanced", Boolean.class, AllowPublicUserTemplatesCK, "true",
4244
"If false, users will not be able to create public templates.", true, ConfigKey.Scope.Account);
4345

46+
static final ConfigKey<Integer> TemplatePreloaderPoolSize = new ConfigKey<Integer>("Advanced", Integer.class, TemplatePreloaderPoolSizeCK, "8",
47+
"Size of the TemplateManager threadpool", false, ConfigKey.Scope.Global);
48+
49+
50+
4451
/**
4552
* Prepares a template for vm creation for a certain storage pool.
4653
*

server/src/com/cloud/template/TemplateManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
926926
String disableExtraction = _configDao.getValue(Config.DisableExtraction.toString());
927927
_disableExtraction = (disableExtraction == null) ? false : Boolean.parseBoolean(disableExtraction);
928928

929-
_preloadExecutor = Executors.newFixedThreadPool(8, new NamedThreadFactory("Template-Preloader"));
929+
_preloadExecutor = Executors.newFixedThreadPool(TemplatePreloaderPoolSize.value(), new NamedThreadFactory("Template-Preloader"));
930930

931931
return true;
932932
}
@@ -1975,7 +1975,7 @@ public String getConfigComponentName() {
19751975

19761976
@Override
19771977
public ConfigKey<?>[] getConfigKeys() {
1978-
return new ConfigKey<?>[] {AllowPublicUserTemplates};
1978+
return new ConfigKey<?>[] {AllowPublicUserTemplates, TemplatePreloaderPoolSize};
19791979
}
19801980

19811981
public List<TemplateAdapter> getTemplateAdapters() {

0 commit comments

Comments
 (0)