Merge pull request #1157 from SudharmaJain/cs-9100

CLOUDSTACK-9100: ISO.CREATE/TEMPLATE.CREATE event missing for usage_event by 
template sync thread

If there is a Management server restart while template is in downloading or 
installing state. Template Sync does not push event into usage_event table.

I have verified the fix manually. Here is a snapshot.
![image](https://cloud.githubusercontent.com/assets/12229259/11559714/0989748c-99e1-11e5-88e0-48b4dbec0224.png)

 I have registered 4 templates. template id 207 and 208(ISO.CREATE event is 
missing) before applying the fix. and template id 209 and 210 after applying 
the fix.

Repro Steps (3 cases)
==========
Case - 1 (private template)
-------------
1. register a private template/iso.
2. restart management server when template is in downloading state.
3. After management server restart, template_store_ref entry is removed if  
download was not yet completed.
4. on next management server restart, if download would have completed, 
template_store_ref entry will get populated, but TEMPLATE.CREATE event is 
missing in usage_event.

Case - 2 (Public template)
--------------------------------
1.  register public template.
2. restart management server when in downloading state.
3. after restart template download reinitiates.
4. template goes to ready state, but there is no usage event.

case -3 (public/private template)
---------------------------------
1. register a template
2. restart management server when template is in installing state.
3. after restart template goes to ready, but there is no usage event.

* pr/1157:
  CLOUDSTACK-9100: ISO.CREATE/TEMPLATE.CREATE event missing for usage_event by 
template sync thread

Signed-off-by: Koushik Das <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8ae4da89
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8ae4da89
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8ae4da89

Branch: refs/heads/master
Commit: 8ae4da89d21633d7a6502601bc0c8533b447d3ff
Parents: 30cfeb4 c335325
Author: Koushik Das <[email protected]>
Authored: Thu Apr 21 17:33:02 2016 +0530
Committer: Koushik Das <[email protected]>
Committed: Thu Apr 21 17:33:02 2016 +0530

----------------------------------------------------------------------
 .../storage/image/TemplateServiceImpl.java      | 75 +++++++++++++++++++-
 1 file changed, 73 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


Reply via email to