From e9e5b847477780daf6a5ce9cb2eab0eec950229f Mon Sep 17 00:00:00 2001 From: Devdeep Singh Date: Sat, 18 Jan 2014 00:50:22 +0530 Subject: [PATCH] CLOUDSTACK-5894: A template created from a volume on hyper-v became unusable after the management server was restarted. The template.properties file created for the template has the format field in upper-case. This caused the template service to not to recognise the format and it removed the entry from the template_store_ref table in db. Fixed the format field in the templatee.properties. --- .../HypervResource/HypervResourceController.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs index 94837a2becd..a1c91a5b642 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs @@ -1590,6 +1590,11 @@ namespace HypervResource string templatePropFile = Path.Combine(path, "template.properties"); using (StreamWriter sw = new StreamWriter(File.Open(templatePropFile, FileMode.Create), Encoding.GetEncoding("iso-8859-1"))) { + if (format != null) + { + format = format.ToLower(); + } + sw.NewLine = "\n"; sw.WriteLine("id=" + templateId); sw.WriteLine("filename=" + templateUuid + "." + format); @@ -1599,7 +1604,7 @@ namespace HypervResource sw.WriteLine("virtualsize=" + virtualSize); sw.WriteLine(format + ".virtualsize=" + virtualSize); sw.WriteLine("size=" + physicalSize); - sw.WriteLine("vhd.size=" + physicalSize); + sw.WriteLine(format + ".size=" + physicalSize); sw.WriteLine("public=false"); } }