From 06e0ddacb71f0359ddaa1e4a678f7c62367b2323 Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Wed, 25 Jun 2014 12:18:24 +0100 Subject: [PATCH 1/2] CA-115742: VM name and description change not allowed via XenCenter for VM Admin - FIXED The error has been caused by the shadow multiplier field on Advanced Settings page: XenCenter thinks that the values has changed, and tries to save it, but this is not allowed for VM Admin users. The solution is: - use -1 as the signal value for unparseable string, instead of 1.0, which is actually a valid value; - display the existing value without formatting it to 2 deciaml places; Also corrected the validation function, as the shadow multiplier has to be greater than or equal to 1, not 0.1. Signed-off-by: Mihaela Stoica --- XenAdmin/SettingsPanels/VMAdvancedEditPage.cs | 19 +++++++------------ XenModel/Messages.Designer.cs | 2 +- XenModel/Messages.resx | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs b/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs index dc50b2694..a0d3b38ee 100644 --- a/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs +++ b/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs @@ -130,11 +130,7 @@ namespace XenAdmin.SettingsPanels public bool HasChanged { - get - { - return ShadowValue != vm.HVM_shadow_multiplier - || ShadowMultiplierTextBox.Text != vm.HVM_shadow_multiplier.ToString(); - } + get { return ShadowValue != vm.HVM_shadow_multiplier; } } private double ShadowValue @@ -142,21 +138,20 @@ namespace XenAdmin.SettingsPanels get { double v; - return double.TryParse(ShadowMultiplierTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out v) - ? v - : SHADOW_MULTIPLIER_GENERAL_USE; + return double.TryParse(ShadowMultiplierTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out v) + ? v + : -1; } set { - ShadowMultiplierTextBox.Text = value.ToString("N", CultureInfo.InvariantCulture); + ShadowMultiplierTextBox.Text = value.ToString(CultureInfo.InvariantCulture); } } public void ShowLocalValidationMessages() { double v; - if (!(double.TryParse(ShadowMultiplierTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out v) - && v > 0.1)) + if (!ValidToSave) { HelpersGUI.ShowBalloonMessage(ShadowMultiplierTextBox, Messages.SHADOW_MEMORY_MULTIPLIER_VALUE, @@ -176,7 +171,7 @@ namespace XenAdmin.SettingsPanels { double v; return double.TryParse(ShadowMultiplierTextBox.Text, NumberStyles.Any, CultureInfo.InvariantCulture, out v) - && v > 0.1; + && v >= 1.0; } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index b0460c4ae..94e9ca830 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -27598,7 +27598,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Value should be a number greater than 0.1. + /// Looks up a localized string similar to Value should be a number greater than or equal to 1.0. /// public static string SHADOW_MEMORY_MULTIPLIER_VALUE { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 2f60a05ae..1bd4a5fb7 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -9590,7 +9590,7 @@ Upgrading VMs using StorageLink Gateway to XenServer 6.0 is only supported if th Shadow memory multiplier: {0} - Value should be a number greater than 0.1 + Value should be a number greater than or equal to 1.0 Shared From 5e13fd1d0100ac6276bd7035e81cf2592c1c117f Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Thu, 26 Jun 2014 10:19:35 +0100 Subject: [PATCH 2/2] CA-115742: Removed unused variable. Signed-off-by: Mihaela Stoica --- XenAdmin/SettingsPanels/VMAdvancedEditPage.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs b/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs index a0d3b38ee..27690c9ac 100644 --- a/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs +++ b/XenAdmin/SettingsPanels/VMAdvancedEditPage.cs @@ -150,7 +150,6 @@ namespace XenAdmin.SettingsPanels public void ShowLocalValidationMessages() { - double v; if (!ValidToSave) { HelpersGUI.ShowBalloonMessage(ShadowMultiplierTextBox,