CP:13667: Adds condition that checks if sm_config contains the keys "allocation_quantum" and "initial_allocation" before getting the values.

This commit is contained in:
Carmen Agimof 2015-08-25 15:12:01 +01:00
parent 1bb49737b2
commit 7c53955104
2 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ namespace XenAdmin.SettingsPanels
= initial_allocation_label.Visible
= incremental_allocation_label.Visible = sr.IsThinProvisioned;
if(sr.IsThinProvisioned)
if(sr.IsThinProvisioned && vdi.sm_config.ContainsKey("initial_allocation") && vdi.sm_config.ContainsKey("allocation_quantum"))
{
initial_alloc_value.Text = Util.MemorySizeStringSuitableUnits(Convert.ToDouble(vdi.sm_config["initial_allocation"]) * Util.BINARY_MEGA, true);
incr_alloc_value.Text = Util.MemorySizeStringSuitableUnits(Convert.ToDouble(vdi.sm_config["allocation_quantum"]) * Util.BINARY_MEGA, true);

View File

@ -1244,7 +1244,7 @@ namespace XenAdmin.TabPages
{
s.AddEntry(FriendlyName("SR.size"), sr.SizeString);
s.AddEntry(FriendlyName("SR.provisioning"), sr.IsThinProvisioned ? Messages.SR_THIN_PROVISIONING : Messages.SR_THICK_PROVISIONING);
if(sr.IsThinProvisioned)
if(sr.IsThinProvisioned && sr.sm_config.ContainsKey("initial_allocation") && sr.sm_config.ContainsKey("allocation_quantum"))
{
s.AddEntry(FriendlyName("SR.disk-space-allocations"),
Helpers.GetAllocationProperties(sr.sm_config["initial_allocation"], sr.sm_config["allocation_quantum"]));