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.
This commit is contained in:
niteshsarda 2017-08-31 13:10:41 +05:30 committed by Rohit Yadav
parent 01b040d19e
commit bf35aefe0f

View File

@ -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