mirror of https://github.com/apache/cloudstack.git
bug 9596: Extract Template/ISO - make extractable = false by default. Make changes to cleanup the extract URL's for multiple sec. storage.
status 9596: resolved fixed
This commit is contained in:
parent
85b8205522
commit
149c8d4b03
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public class UploadMonitorImpl implements UploadMonitor {
|
|||
|
||||
Timer _timer;
|
||||
int _cleanupInterval;
|
||||
int _urlExpirationInterval;
|
||||
|
||||
final Map<UploadVO, UploadListener> _listenerMap = new ConcurrentHashMap<UploadVO, UploadListener>();
|
||||
|
||||
|
|
@ -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<UploadVO> 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{
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue