mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-12475: XenCenter work for thin provisioning: Add Virtual Disk dialog: new fields
Created SR.IsThinProvisioned property
This commit is contained in:
parent
31af0f0004
commit
37330629b8
@ -210,18 +210,14 @@ 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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
var smConfig = srToCheck.sm_config;
|
||||
decimal temp = 0;
|
||||
|
||||
if (smConfig != null && smConfig.ContainsKey("allocation") && smConfig["allocation"] == "dynamic")
|
||||
if (srToCheck.IsThinProvisioned)
|
||||
{
|
||||
var smConfig = srToCheck.sm_config;
|
||||
decimal temp = 0;
|
||||
|
||||
if (smConfig.ContainsKey("initial_allocation") && decimal.TryParse(smConfig["initial_allocation"], out temp))
|
||||
initialAllocationNumericUpDown.Value = temp * 100;
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user