Skip to content

Commit eb6bed8

Browse files
committed
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.
1 parent 1bf610d commit eb6bed8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,11 @@ private static void PostCreateTemplate(string path, string templateId, string te
15901590
string templatePropFile = Path.Combine(path, "template.properties");
15911591
using (StreamWriter sw = new StreamWriter(File.Open(templatePropFile, FileMode.Create), Encoding.GetEncoding("iso-8859-1")))
15921592
{
1593+
if (format != null)
1594+
{
1595+
format = format.ToLower();
1596+
}
1597+
15931598
sw.NewLine = "\n";
15941599
sw.WriteLine("id=" + templateId);
15951600
sw.WriteLine("filename=" + templateUuid + "." + format);
@@ -1599,7 +1604,7 @@ private static void PostCreateTemplate(string path, string templateId, string te
15991604
sw.WriteLine("virtualsize=" + virtualSize);
16001605
sw.WriteLine(format + ".virtualsize=" + virtualSize);
16011606
sw.WriteLine("size=" + physicalSize);
1602-
sw.WriteLine("vhd.size=" + physicalSize);
1607+
sw.WriteLine(format + ".size=" + physicalSize);
16031608
sw.WriteLine("public=false");
16041609
}
16051610
}

0 commit comments

Comments
 (0)