CA-330890: update storage select wazard in XCM

Signed-off-by: Xueqing Zhang <xueqing.zhang@citrix.com>
This commit is contained in:
Xueqing Zhang 2019-11-25 18:03:13 +08:00 committed by Konstantina Chremmou
parent fc1cbf636e
commit 224acb6706
6 changed files with 73 additions and 33 deletions

View File

@ -306,7 +306,7 @@ namespace XenAdmin.Controls
return string.Format(Messages.SR_PICKER_INSUFFICIENT_SPACE, Util.DiskSizeString(DiskSize, 2),
Util.DiskSizeString(TheSR.FreeSpace(), 2));
if (DiskSize > SR.DISK_MAX_SIZE)
return string.Format(Messages.SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE,
return string.Format(Messages.SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE,
Util.DiskSizeString(SR.DISK_MAX_SIZE, 0));
return "";
}

View File

@ -45,7 +45,6 @@ namespace XenAdmin.Wizards.ConversionWizard
{
private bool _buttonNextEnabled;
private long _requiredDiskSize;
public SrSelectionPage()
{
InitializeComponent();
@ -139,8 +138,7 @@ namespace XenAdmin.Wizards.ConversionWizard
private void UpdateButtons()
{
_buttonNextEnabled = comboBoxSr.SelectedItem is SrWrapper wrapper &&
wrapper.AvailableSpace >= _requiredDiskSize;
_buttonNextEnabled = comboBoxSr.SelectedItem is SrWrapper wrapper && wrapper.CanUse;
OnPageUpdated();
}
@ -151,6 +149,13 @@ namespace XenAdmin.Wizards.ConversionWizard
tableLayoutPanelError.Visible = true;
}
private void ShowWarning(string msg)
{
pictureBoxError.Image = Images.StaticImages._000_Alert2_h32bit_16;
labelError.Text = msg;
tableLayoutPanelError.Visible = true;
}
#region Event handler
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
@ -229,13 +234,30 @@ namespace XenAdmin.Wizards.ConversionWizard
if (comboBoxSr.SelectedItem is SrWrapper wrapper)
{
SelectedSR = wrapper.item;
if (wrapper.AvailableSpace >= _requiredDiskSize)
tableLayoutPanelError.Visible = false;
else
SM sm = SelectedSR.GetSM();
bool vdiSizeUnlimited = sm != null && Array.IndexOf(sm.capabilities, "LARGE_VDI") != -1;
bool isThinlyProvisioned = sm != null && Array.IndexOf(sm.capabilities, "THIN_PROVISIONING") != -1;
if (_requiredDiskSize > SR.DISK_MAX_SIZE && !vdiSizeUnlimited)
{
ShowError(string.Format(Messages.SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE, Util.DiskSizeString(SR.DISK_MAX_SIZE, 0)));
wrapper.CanUse = false;
}
else if (_requiredDiskSize > wrapper.AvailableSpace && !isThinlyProvisioned)
{
ShowError(Messages.CONVERSION_STORAGE_PAGE_SR_TOO_SMALL);
wrapper.CanUse = false;
}
else if (_requiredDiskSize > wrapper.AvailableSpace)
{
ShowWarning(Messages.CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT);
wrapper.CanUse = true;
}
else
{
tableLayoutPanelError.Visible = false;
wrapper.CanUse = true;
}
}
UpdatePieChart();
UpdateButtons();
}
@ -247,7 +269,7 @@ namespace XenAdmin.Wizards.ConversionWizard
private class SrWrapper : ToStringWrapper<SR>
{
public readonly long AvailableSpace;
public bool CanUse;
public SrWrapper(SR sr, long availableSpace)
: base(sr, $"{sr.Name()}, {Util.DiskSizeString(availableSpace)} {Messages.AVAILABLE}")
{

View File

@ -19,7 +19,7 @@ namespace XenAdmin {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Messages {
@ -9496,6 +9496,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to The SR is overcommitted.
/// </summary>
public static string CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT {
get {
return ResourceManager.GetString("CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to There is not enough available space on this SR.
/// </summary>
@ -18239,7 +18248,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to When overcommited the pool cannot guarantee to tolerate the number of server failures specified.
/// Looks up a localized string similar to When overcommitted the pool cannot guarantee to tolerate the number of server failures specified.
///
///Reduce protection levels, or bring more servers online to increase the maximum supported capacity..
/// </summary>
@ -27054,7 +27063,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to The SR &apos;{0}&apos; is over committed. There is only {1} of free space and the new VM requires {2}..
/// Looks up a localized string similar to The SR &apos;{0}&apos; is overcommitted. There is only {1} of free space and the new VM requires {2}..
/// </summary>
public static string NEWVMWIZARD_STORAGEPAGE_SROVERCOMMIT {
get {
@ -33922,6 +33931,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to You cannot create a disk greater than {0} on this SR..
/// </summary>
public static string SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE {
get {
return ResourceManager.GetString("SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This SR does not need to be upgraded..
/// </summary>
@ -33985,15 +34003,6 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to You cannot create a disk greater than {0} on this SR..
/// </summary>
public static string SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE {
get {
return ResourceManager.GetString("SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} required when only {1} available.
/// </summary>

View File

@ -3427,6 +3427,9 @@ VM {2} をエクスポートしてもよろしいですか?</value>
<data name="CONVERSION_STORAGE_PAGE_REQUIRED_SPACE" xml:space="preserve">
<value>必要な容量 {0}</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT" xml:space="preserve">
<value>SR はオーバーコミットされており</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_TOO_SMALL" xml:space="preserve">
<value>この SR には十分な空き容量がありません</value>
</data>
@ -11812,6 +11815,9 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
<value>初回割り当て: {0}
増分割り当て: {1}</value>
</data>
<data name="SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>この SR には、{0} を超えるサイズのディスクを作成できません。</value>
</data>
<data name="SR_DOES_NOT_NEED_UPGRADE" xml:space="preserve">
<value>この SR をアップグレードする必要はありません。</value>
</data>
@ -11830,9 +11836,6 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
<data name="SR_IS_LOCAL" xml:space="preserve">
<value>ホーム サーバーが設定されていない VM はローカル ストレージにディスクを持つことはできません</value>
</data>
<data name="SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>この SR には、{0} を超えるサイズのディスクを作成できません。</value>
</data>
<data name="SR_PICKER_DISK_TOO_BIG" xml:space="preserve">
<value>ディスク サイズ ({0}) が SR サイズ ({1}) を超過しています</value>
</data>

View File

@ -3422,6 +3422,9 @@ This action cannot be undone. Are you sure you want to continue?</value>
<data name="CONVERSION_STORAGE_PAGE_REQUIRED_SPACE" xml:space="preserve">
<value>Required space {0}</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT" xml:space="preserve">
<value>The SR is overcommitted</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_TOO_SMALL" xml:space="preserve">
<value>There is not enough available space on this SR</value>
</data>
@ -6392,7 +6395,7 @@ Do you want to apply this HA configuration anyway?</value>
<value>{0} - pool is overcommitted</value>
</data>
<data name="HA_OVERCOMMIT_BLURB" xml:space="preserve">
<value>When overcommited the pool cannot guarantee to tolerate the number of server failures specified.
<value>When overcommitted the pool cannot guarantee to tolerate the number of server failures specified.
Reduce protection levels, or bring more servers online to increase the maximum supported capacity.</value>
</data>
@ -9238,7 +9241,7 @@ Review these settings, then click Previous if you need to change anything. Other
<value>&lt;no suitable storage&gt;</value>
</data>
<data name="NEWVMWIZARD_STORAGEPAGE_SROVERCOMMIT" xml:space="preserve">
<value>The SR '{0}' is over committed. There is only {1} of free space and the new VM requires {2}.</value>
<value>The SR '{0}' is overcommitted. There is only {1} of free space and the new VM requires {2}.</value>
</data>
<data name="NEWVMWIZARD_STORAGEPAGE_TITLE" xml:space="preserve">
<value>Configure storage for the new VM</value>
@ -11810,6 +11813,9 @@ You may need to reboot your server(s) to enable SR-IOV network.</value>
<value>Initial allocation: {0}
Incremental allocation: {1}</value>
</data>
<data name="SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>You cannot create a disk greater than {0} on this SR.</value>
</data>
<data name="SR_DOES_NOT_NEED_UPGRADE" xml:space="preserve">
<value>This SR does not need to be upgraded.</value>
</data>
@ -11828,9 +11834,6 @@ Incremental allocation: {1}</value>
<data name="SR_IS_LOCAL" xml:space="preserve">
<value>VMs without a home server cannot have disks on local storage</value>
</data>
<data name="SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>You cannot create a disk greater than {0} on this SR.</value>
</data>
<data name="SR_PICKER_DISK_TOO_BIG" xml:space="preserve">
<value>Disk size ({0}) exceeds SR size ({1})</value>
</data>

View File

@ -3423,6 +3423,9 @@
<data name="CONVERSION_STORAGE_PAGE_REQUIRED_SPACE" xml:space="preserve">
<value>所需空间 {0}</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_OVERCOMMIT" xml:space="preserve">
<value>SR 过量使用</value>
</data>
<data name="CONVERSION_STORAGE_PAGE_SR_TOO_SMALL" xml:space="preserve">
<value>此 SR 上的可用空间不足</value>
</data>
@ -11811,6 +11814,9 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
<value>初始分配: {0}
增量分配: {1}</value>
</data>
<data name="SR_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>无法在此 SR 上创建大于 {0} 的磁盘。</value>
</data>
<data name="SR_DOES_NOT_NEED_UPGRADE" xml:space="preserve">
<value>该 SR 不需要升级。</value>
</data>
@ -11829,9 +11835,6 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
<data name="SR_IS_LOCAL" xml:space="preserve">
<value>没有主服务器的 VM 不能在本地存储中包含磁盘</value>
</data>
<data name="SR_PICKER_DISKSIZE_EXCEEDS_DISK_MAX_SIZE" xml:space="preserve">
<value>无法在此 SR 上创建大于 {0} 的磁盘。</value>
</data>
<data name="SR_PICKER_DISK_TOO_BIG" xml:space="preserve">
<value>磁盘大小({0})超过 SR 大小({1})</value>
</data>