diff --git a/api/src/com/cloud/api/commands/RegisterIsoCmd.java b/api/src/com/cloud/api/commands/RegisterIsoCmd.java index 7aef022aa41..0388db08e33 100755 --- a/api/src/com/cloud/api/commands/RegisterIsoCmd.java +++ b/api/src/com/cloud/api/commands/RegisterIsoCmd.java @@ -57,7 +57,7 @@ public class RegisterIsoCmd extends BaseCmd { @Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if you want to register the ISO to be publicly available to all users, false otherwise.") private Boolean publicIso; - @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the iso or its derivatives are extractable; default is true") + @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the iso or its derivatives are extractable; default is false") private Boolean extractable; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO") diff --git a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java index dedcfe84d64..0838e413d2b 100755 --- a/api/src/com/cloud/api/commands/RegisterTemplateCmd.java +++ b/api/src/com/cloud/api/commands/RegisterTemplateCmd.java @@ -75,7 +75,7 @@ public class RegisterTemplateCmd extends BaseCmd { @Parameter(name=ApiConstants.PASSWORD_ENABLED, type=CommandType.BOOLEAN, description="true if the template supports the password reset feature; default is false") private Boolean passwordEnabled; - @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the template or its derivatives are extractable; default is true") + @Parameter(name=ApiConstants.IS_EXTRACTABLE, type=CommandType.BOOLEAN, description="true if the template or its derivatives are extractable; default is false") private Boolean extractable; @Parameter(name=ApiConstants.REQUIRES_HVM, type=CommandType.BOOLEAN, description="true if this template requires HVM") diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 41c8f196787..f80c90560b8 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -111,7 +111,8 @@ public enum Config { ExpungeDelay("Advanced", UserVmManager.class, Integer.class, "expunge.delay", "86400", "Determines how long (in seconds) to wait before actually expunging destroyed vm. The default value = the default value of expunge.interval", null), ExpungeInterval("Advanced", UserVmManager.class, Integer.class, "expunge.interval", "86400", "The interval (in seconds) to wait before running the expunge thread.", null), ExpungeWorkers("Advanced", UserVmManager.class, Integer.class, "expunge.workers", "1", "Number of workers performing expunge ", null), - ExtractURLCleanUpInterval("Advanced", ManagementServer.class, Integer.class, "extract.url.cleanup.interval", "120", "The interval (in seconds) to wait before cleaning up the extract URL's ", null), + ExtractURLCleanUpInterval("Advanced", ManagementServer.class, Integer.class, "extract.url.cleanup.interval", "7200", "The interval (in seconds) to wait before cleaning up the extract URL's ", null), + ExtractURLExpirationInterval("Advanced", ManagementServer.class, Integer.class, "extract.url.expiration.interval", "14400", "The life of an extract URL after which it is deleted ", null), HostStatsInterval("Advanced", ManagementServer.class, Integer.class, "host.stats.interval", "60000", "The interval (in milliseconds) when host stats are retrieved from agents.", null), HostRetry("Advanced", AgentManager.class, Integer.class, "host.retry", "2", "Number of times to retry hosts for creating a volume", null), IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", "8096", "Defaul API port", null), @@ -222,7 +223,7 @@ public enum Config { VmOpCleanupWait("Advanced", ManagementServer.class, Long.class, "vm.op.cleanup.wait", "3600", "Time (in seconds) to wait before cleanuping up any vm work items", "Seconds"), VmOpCancelInterval("Advanced", ManagementServer.class, Long.class, "vm.op.cancel.interval", "3600", "Time (in seconds) to wait before cancelling a operation", "Seconds"), - DefaultPageSize("Advanced", ManagementServer.class, Long.class, "default.page.size", "-1", "Default page size for API list* commands; default value is -1 (Unlimited) ", null), + DefaultPageSize("Advanced", ManagementServer.class, Long.class, "default.page.size", "500", "Default page size for API list* commands", null), TaskCleanupRetryInterval("Advanced", ManagementServer.class, Integer.class, "task.cleanup.retry.interval", "600", "Time (in seconds) to wait before retrying cleanup of tasks if the cleanup failed previously. 0 means to never retry.", "Seconds"), diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java index a6792206803..bf91bc8ae84 100755 --- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java +++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java @@ -102,6 +102,7 @@ public class UploadMonitorImpl implements UploadMonitor { Timer _timer; int _cleanupInterval; + int _urlExpirationInterval; final Map _listenerMap = new ConcurrentHashMap(); @@ -360,8 +361,10 @@ public class UploadMonitorImpl implements UploadMonitor { _agentMgr.registerForHostEvents(new UploadListener(this), true, false, false); String cleanupInterval = configs.get("extract.url.cleanup.interval"); - _cleanupInterval = NumbersUtil.parseInt(cleanupInterval, 14400); + _cleanupInterval = NumbersUtil.parseInt(cleanupInterval, 7200); + String urlExpirationInterval = configs.get("extract.url.expiration.interval"); + _urlExpirationInterval = NumbersUtil.parseInt(urlExpirationInterval, 14400); String workers = (String)params.get("expunge.workers"); int wrks = NumbersUtil.parseInt(workers, 1); @@ -463,7 +466,7 @@ public class UploadMonitorImpl implements UploadMonitor { public void cleanupStorage() { - final int EXTRACT_URL_LIFE_LIMIT_IN_SECONDS = 14400;//FIX ME make it configurable. + final int EXTRACT_URL_LIFE_LIMIT_IN_SECONDS = _urlExpirationInterval; List extractJobs= _uploadDao.listByModeAndStatus(Mode.HTTP_DOWNLOAD, Status.DOWNLOAD_URL_CREATED); for (UploadVO extractJob : extractJobs){ @@ -471,8 +474,13 @@ public class UploadMonitorImpl implements UploadMonitor { String path = extractJob.getInstallPath(); s_logger.debug("Sending deletion of extract URL "+extractJob.getUploadUrl()); // Would delete the symlink for the Type and if Type == VOLUME then also the volume - DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(),extractJob.getUploadUrl()); - long result = send(extractJob.getHostId(), cmd, null); + DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(),extractJob.getUploadUrl()); + HostVO ssvm = _agentMgr.getSSAgent(ApiDBUtils.findHostById(extractJob.getHostId())); + if( ssvm == null ) { + s_logger.warn("There is no secondary storage VM for secondary storage host " + extractJob.getHostId()); + continue; + } + long result = send(ssvm.getId(), cmd, null); if (result == -1){ s_logger.warn("Unable to delete the link for " +extractJob.getType()+ " id=" +extractJob.getTypeId()+ " url="+extractJob.getUploadUrl()); }else{ diff --git a/server/src/com/cloud/template/TemplateAdapterBase.java b/server/src/com/cloud/template/TemplateAdapterBase.java index c8edfeeb3c9..eddf83ae80c 100755 --- a/server/src/com/cloud/template/TemplateAdapterBase.java +++ b/server/src/com/cloud/template/TemplateAdapterBase.java @@ -125,7 +125,7 @@ public abstract class TemplateAdapterBase implements TemplateAdapter { } if (isExtractable == null) { - isExtractable = Boolean.TRUE; + isExtractable = Boolean.FALSE; } if ((accountName == null) ^ (domainId == null)) {// XOR - Both have to be passed or don't pass any of them throw new InvalidParameterValueException("Please specify both account and domainId or dont specify any of them"); diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index c887d9b1b1a..3d49570ec02 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -813,7 +813,7 @@ CREATE TABLE `cloud`.`vm_template` ( `bootable` int(1) unsigned NOT NULL default 1 COMMENT 'true if this template represents a bootable ISO', `prepopulate` int(1) unsigned NOT NULL default 0 COMMENT 'prepopulate this template to primary storage', `cross_zones` int(1) unsigned NOT NULL default 0 COMMENT 'Make this template available in all zones', - `extractable` int(1) unsigned NOT NULL default 1 COMMENT 'Is this template extractable', + `extractable` int(1) unsigned NOT NULL default 0 COMMENT 'Is this template extractable', `hypervisor_type` varchar(32) COMMENT 'hypervisor that the template belongs to', `source_template_id` bigint unsigned COMMENT 'Id of the original template, if this template is created from snapshot', PRIMARY KEY (`id`)