[
https://issues.apache.org/jira/browse/CLOUDSTACK-5536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13932656#comment-13932656
]
Min Chen commented on CLOUDSTACK-5536:
--------------------------------------
I found the root cause of this issue, but haven't found an ideal solution to
resolve this. When management server restarts, our code has two places to
trigger system vm template download: 1) host connects to MS, it will trigger
TemplateServiceImpl.handleSysTemplateDownload to download system vm template
for that hypervisor if template_store_ref does not have an entry for that
system vm template that is READY state. This will create a new entry in
template_store_ref table. 2) Template sync process done by
TemplateServiceImpl.handleSysTemplateDownload, where we only arbitrarily pick
one entry in template_store_ref to remove, but this are not cleaning up all the
related template_store_ref for this template. We also cannot remove all related
template_store_ref entries in a brute force way since handleSysTemplateDownload
may just initiate a download on that system vm template. We need to find a
better solution to coordinate these two template download processes.
> Restarting cloudstack service with template download in progress creates
> redundant entries in DB for systemVM template
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: CLOUDSTACK-5536
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5536
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Components: Template
> Affects Versions: 4.3.0
> Environment: Latest 4.3 MS build
> VmWare Host
> Reporter: Pavan Kumar Bandarupally
> Assignee: Min Chen
> Fix For: 4.3.0
>
> Attachments: MS Log.rar
>
>
> My NFS secondary store has been migrated to Object Storage and an S3
> secondary Store is added. At this point the systemVM template will be
> downloaded to S3 store.
> If we restart cloudstack-management service when download is in progress, the
> current entry in template_store_ref which shows status as creating , persists
> and a new entry will be created. If we restart the service once again another
> entry is created persisting the older two entries as is.
> "Removing leftover template routing-8 entry from template store table" is
> shown in the traces but this doesn't take effect.
> mysql> select template_id, store_id, store_role, state, install_path from
> template_store_ref;
> +-------------+----------+------------+-----------+---------------------------------------------------------------------------+
> | template_id | store_id | store_role | state | install_path
> |
> +-------------+----------+------------+-----------+---------------------------------------------------------------------------+
> | 8 | 1 | ImageCache | Ready |
> template/tmpl/1/8/2ad21358-644d-450c-99a1-6c156afa3206.ova |
> | 7 | 1 | ImageCache | Ready |
> template/tmpl/1/7/a970a6d7-b1ed-3d5a-a8ed-661e059d9f30.ova |
> | 7 | 2 | Image | Ready | NULL
> |
> | 8 | 2 | Image | Creating |
> template/tmpl/1/8/routing-8 |
> | 202 | 2 | Image | Ready |
> template/tmpl/2/202/202-2-480dd062-9b5c-3f3d-8bd5-934b160883dc/Win832.ova |
> | 8 | 2 | Image | Ready |
> template/tmpl/1/8/routing-8/systemvmtemplate-4.2-vh7.ova |
> | 8 | 2 | Image | Allocated |
> template/tmpl/1/8/routing-8/systemvmtemplate-4.2-vh7.ova |
> | 8 | 2 | Image | Allocated |
> template/tmpl/1/8/routing-8 |
> +-------------+----------+------------+-----------+---------------------------------------------------------------------------+
> Expected:
> -------------------
> Upon service restart, template sync should reset the download of the template
> and create only one entry for the systemVM template.
> Actual:
> ---------
> The older entry persists and new entry is created with status as Allocated or
> Creating.
> Note:
> =========
> This happens only with SystemVM template. General template downloads are
> properly reset and only one entry exists for them.
--
This message was sent by Atlassian JIRA
(v6.2#6252)