This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new bf35aef  CLOUDSTACK-10032 : Database entries for templates created 
from snapshots disappear after management-server service restart (#2224)
bf35aef is described below

commit bf35aefe0fa7628f813863d2e288310c899adab1
Author: niteshsarda <[email protected]>
AuthorDate: Thu Aug 31 13:10:41 2017 +0530

    CLOUDSTACK-10032 : Database entries for templates created from snapshots 
disappear after management-server service restart (#2224)
    
    This issue occurs only with KVM hypervisor. Database entries for templates 
created from snapshots disappear after management-server service restart
    
    # STEPS TO REPRODUCE
    
    Create a ACS setup and add KVM hypervisor as host.
    Create snapshot of any disk (root or data disk) of an instance.
    Create template using disk snapshot.
    Verify that template got downloaded completely and is in Ready state.
    Also, verify that entry for this template is present in template_store_ref 
table in database.
    Now restart management server.
    Once management server is restarted completely and web UI is available, 
check the template status. It will be in Active state instead of downloaded.
    Also, entry for this template vanishes from template_store_ref table in 
database.
    
    # Fix for the Issue
    
    In NfsSecondaryStorageResource.java class, inside method 
copySnapshotToTemplateFromNfsToNfs() bufferwriter which was created for writing 
data in template.properties file is not closed and hence few properties were 
not getting written in template.properties. As few properties were absent in 
template.properties file, so after management server restart, this template is 
not loaded and hence it goes into Active state.
---
 .../apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
 
b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index 4f3ad07..4980d97 100644
--- 
a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ 
b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -528,6 +528,8 @@ public class NfsSecondaryStorageResource extends 
ServerResourceBase implements S
                     bufferWriter.write("\n");
                     long size = _storage.getSize(destFileFullPath);
                     bufferWriter.write("size=" + size);
+                    bufferWriter.close();
+                    writer.close();
 
                     /**
                      * Snapshots might be in either QCOW2 or RAW image format

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to