CP-12475: XenCenter work for thin provisioning: Add Virtual Disk dialog: new fields

Created SR.IsThinProvisioned property
This commit is contained in:
Gabor Apati-Nagy 2015-06-25 13:42:08 +01:00
parent 31af0f0004
commit 37330629b8
3 changed files with 15 additions and 11 deletions

View File

@ -210,19 +210,15 @@ namespace XenAdmin.Controls
/// <summary>
/// Returns how much disk space is required to create the disk on an SR
/// This depends on whether the SR is thin provisioned and what the initial allocation rate is
/// This depends on whether the SR is thin provisioned and on what the initial allocation rate is
/// </summary>
/// <param name="sr"></param>
/// <returns></returns>
private long GetRequiredDiskSizeForSR(SR sr)
{
if (sr != null && sr.sm_config != null
&& sr.sm_config.ContainsKey("allocation") && sr.sm_config["allocation"] == "dynamic")
{
if (sr != null && sr.IsThinProvisioned)
return (long)(InitialAllocationRate * DiskSize);
}
return DiskSize;
}

View File

@ -215,7 +215,7 @@ namespace XenAdmin.Dialogs
if (srToCheck == null)
return false;
return srToCheck.sm_config.Keys.Contains("allocation") && srToCheck.sm_config["allocation"] == "dynamic";
return srToCheck.IsThinProvisioned;
}
}
@ -340,11 +340,11 @@ namespace XenAdmin.Dialogs
if (srToCheck == null)
return;
if (srToCheck.IsThinProvisioned)
{
var smConfig = srToCheck.sm_config;
decimal temp = 0;
if (smConfig != null && smConfig.ContainsKey("allocation") && smConfig["allocation"] == "dynamic")
{
if (smConfig.ContainsKey("initial_allocation") && decimal.TryParse(smConfig["initial_allocation"], out temp))
initialAllocationNumericUpDown.Value = temp * 100;

View File

@ -1122,6 +1122,14 @@ namespace XenAPI
}
}
public bool IsThinProvisioned
{
get
{
return this.sm_config != null && this.sm_config.ContainsKey("allocation") && this.sm_config["allocation"] == "dynamic";
}
}
#region IEquatable<SR> Members
/// <summary>