From a2883d825235f5d33c08dd1d31549ac7d5913f9f Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Fri, 20 Feb 2015 13:07:20 +0000 Subject: [PATCH 1/5] CA-161460: Present a helpful error message when a patch we are trying to download from another server has been deleted --- .../PatchingWizard_UploadPage.cs | 33 ++++++++++++++----- .../Actions/Pool_Patch/ApplyPatchAction.cs | 10 ++++++ XenModel/Messages.Designer.cs | 24 +++++++++++++- XenModel/Messages.resx | 10 ++++++ 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs index 35bf4265d..9800137b2 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; using System.Drawing; -using System.Linq; +using System.Linq; using System.Windows.Forms; using XenAdmin.Actions; using XenAdmin.Controls; using XenAdmin.Core; using XenAdmin.Dialogs; -using XenAPI; +using XenAPI; namespace XenAdmin.Wizards.PatchingWizard { @@ -134,7 +134,8 @@ namespace XenAdmin.Wizards.PatchingWizard OnPageUpdated(); } - private bool canUpload = true; + private bool canUpload = true; + private bool canDownload = true; private DiskSpaceRequirements diskSpaceRequirements; private void TryUploading() @@ -218,12 +219,17 @@ namespace XenAdmin.Wizards.PatchingWizard } private void UpdateButtons() - { + { if (!canUpload && diskSpaceRequirements != null) { diskSpaceErrorLinkLabel.Visible = true; diskSpaceErrorLinkLabel.Text = diskSpaceRequirements.GetMessageForActionLink(); - } + } + else if (!canDownload) + { + diskSpaceErrorLinkLabel.Visible = true; + diskSpaceErrorLinkLabel.Text = Messages.PATCHINGWIZARD_MORE_INFO; + } else diskSpaceErrorLinkLabel.Visible = false; } @@ -318,11 +324,14 @@ namespace XenAdmin.Wizards.PatchingWizard if (action == null) return; - action.Completed -= multipleAction_Completed; + action.Completed -= multipleAction_Completed; + + canDownload = !(action.Exception is PatchDownloadFailedException); Program.Invoke(this, () => { - labelProgress.Text = GetActionDescription(action); + labelProgress.Text = GetActionDescription(action); + UpdateButtons(); }); } @@ -363,7 +372,15 @@ namespace XenAdmin.Wizards.PatchingWizard } private void diskspaceErrorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { + { + if (!canDownload) + { + var msg = string.Format(Messages.PATCH_DOWNLOAD_FAILED_MORE_INFO, SelectedExistingPatch.name_label, SelectedExistingPatch.Connection.Name); + new ThreeButtonDialog( + new ThreeButtonDialog.Details(SystemIcons.Error, msg)) + .ShowDialog(this); + } + if (diskSpaceRequirements == null) return; diff --git a/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs b/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs index a11f6dd6d..3f1d03196 100644 --- a/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs +++ b/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs @@ -69,6 +69,10 @@ namespace XenAdmin.Actions (HTTP_actions.get_sss)HTTP_actions.get_pool_patch_download, Session.uuid, patch.uuid); } + catch (Exception e) + { + throw new PatchDownloadFailedException(string.Format(Messages.PATCH_DOWNLOAD_FAILED, patch.name_label, patch.Connection.Name), e); + } finally { Connection = null; @@ -169,4 +173,10 @@ namespace XenAdmin.Actions } + + public class PatchDownloadFailedException : ApplicationException + { + public PatchDownloadFailedException(string message, Exception innerException) : + base(message, innerException) { } + } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index dcaa135e3..57fcb8d08 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -24632,6 +24632,28 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Failed to download {0} from '{1}'. + /// + public static string PATCH_DOWNLOAD_FAILED { + get { + return ResourceManager.GetString("PATCH_DOWNLOAD_FAILED", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to download the update {0} from '{1}'. + /// + ///The update is installed on '{1}', but the update installation file may have since been deleted. + /// + ///Upload the update from an .xsupdate file instead.. + /// + public static string PATCH_DOWNLOAD_FAILED_MORE_INFO { + get { + return ResourceManager.GetString("PATCH_DOWNLOAD_FAILED_MORE_INFO", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} ///Date modified: {1} diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 4895c155f..64e7e08c7 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -12581,4 +12581,14 @@ You will need to navigate to the Console on each of the selected VMs to complete Re&start + + Failed to download {0} from '{1}' + + + Failed to download the update {0} from '{1}'. + +The update is installed on '{1}', but the update installation file may have since been deleted. + +Upload the update from an .xsupdate file instead. + \ No newline at end of file From d4dc9e2b0611f7b1d297168dcc3f25dcfbf65ce9 Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Fri, 20 Feb 2015 13:15:40 +0000 Subject: [PATCH 2/5] CA-161460: Rename diskSpaceErrorLinkLabel -> errorLinkLabel, as it is now used more widely --- .../PatchingWizard_UploadPage.Designer.cs | 16 +++++------ .../PatchingWizard_UploadPage.cs | 12 ++++---- .../PatchingWizard_UploadPage.resx | 28 +++++++++---------- XenAdmin/XenAdmin.csproj | 1 + 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.Designer.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.Designer.cs index 9ed439203..d8d535590 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.Designer.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.Designer.cs @@ -34,7 +34,7 @@ this.labelProgress = new System.Windows.Forms.Label(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.flickerFreeListBox1 = new XenAdmin.Controls.FlickerFreeListBox(); - this.diskSpaceErrorLinkLabel = new System.Windows.Forms.LinkLabel(); + this.errorLinkLabel = new System.Windows.Forms.LinkLabel(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -45,7 +45,7 @@ this.tableLayoutPanel1.Controls.Add(this.labelProgress, 0, 2); this.tableLayoutPanel1.Controls.Add(this.progressBar1, 0, 3); this.tableLayoutPanel1.Controls.Add(this.flickerFreeListBox1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.diskSpaceErrorLinkLabel, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.errorLinkLabel, 1, 2); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // // label2 @@ -74,12 +74,12 @@ this.flickerFreeListBox1.Name = "flickerFreeListBox1"; this.flickerFreeListBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.flickerFreeListBox1_DrawItem); // - // diskSpaceErrorLinkLabel + // errorLinkLabel // - resources.ApplyResources(this.diskSpaceErrorLinkLabel, "diskSpaceErrorLinkLabel"); - this.diskSpaceErrorLinkLabel.Name = "diskSpaceErrorLinkLabel"; - this.diskSpaceErrorLinkLabel.TabStop = true; - this.diskSpaceErrorLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.diskspaceErrorLinkLabel_LinkClicked); + resources.ApplyResources(this.errorLinkLabel, "errorLinkLabel"); + this.errorLinkLabel.Name = "errorLinkLabel"; + this.errorLinkLabel.TabStop = true; + this.errorLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.errorLinkLabel_LinkClicked); // // PatchingWizard_UploadPage // @@ -99,6 +99,6 @@ private System.Windows.Forms.Label labelProgress; private System.Windows.Forms.ProgressBar progressBar1; private Controls.FlickerFreeListBox flickerFreeListBox1; - private System.Windows.Forms.LinkLabel diskSpaceErrorLinkLabel; + private System.Windows.Forms.LinkLabel errorLinkLabel; } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs index 9800137b2..1434f3c18 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs @@ -222,16 +222,16 @@ namespace XenAdmin.Wizards.PatchingWizard { if (!canUpload && diskSpaceRequirements != null) { - diskSpaceErrorLinkLabel.Visible = true; - diskSpaceErrorLinkLabel.Text = diskSpaceRequirements.GetMessageForActionLink(); + errorLinkLabel.Visible = true; + errorLinkLabel.Text = diskSpaceRequirements.GetMessageForActionLink(); } else if (!canDownload) { - diskSpaceErrorLinkLabel.Visible = true; - diskSpaceErrorLinkLabel.Text = Messages.PATCHINGWIZARD_MORE_INFO; + errorLinkLabel.Visible = true; + errorLinkLabel.Text = Messages.PATCHINGWIZARD_MORE_INFO; } else - diskSpaceErrorLinkLabel.Visible = false; + errorLinkLabel.Visible = false; } private void UpdateActionProgress(AsyncAction action) @@ -371,7 +371,7 @@ namespace XenAdmin.Wizards.PatchingWizard return textColor; } - private void diskspaceErrorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void errorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (!canDownload) { diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.resx b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.resx index 77f640385..20139f0be 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.resx +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.resx @@ -250,40 +250,40 @@ Please wait for this operation to complete, then click Next to continue with the 3 - + Fill - + 627, 354 - + 3, 3, 3, 3 - + 1, 1, 1, 1 - + 70, 18 - + 2 - + &More info... - + False - - diskSpaceErrorLinkLabel + + errorLinkLabel - + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + tableLayoutPanel1 - + 4 @@ -317,7 +317,7 @@ Please wait for this operation to complete, then click Next to continue with the 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label2" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelProgress" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="progressBar1" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="flickerFreeListBox1" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="diskSpaceErrorLinkLabel" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,Percent,100,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label2" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelProgress" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="progressBar1" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="flickerFreeListBox1" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="errorLinkLabel" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,Percent,100,AutoSize,0,AutoSize,0" /></TableLayoutSettings> True diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index 0f4e7121a..3194143b7 100644 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -2143,6 +2143,7 @@ PatchingWizard_UploadPage.cs + Designer PatchingWizard_UploadPage.cs From 9a681fe0f5ec7e53b46c78f276c868fdf0d22f04 Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Fri, 20 Feb 2015 13:20:05 +0000 Subject: [PATCH 3/5] CAR-1711: Improve text --- XenModel/Messages.Designer.cs | 2 +- XenModel/Messages.resx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 57fcb8d08..473ade844 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -23974,7 +23974,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to You need to manually free up more space and try again.. + /// Looks up a localized string similar to Free up some space and try again.. /// public static string NOT_ENOUGH_SPACE_MESSAGE_NOCLEANUP { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 64e7e08c7..d9603d695 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -8324,7 +8324,7 @@ It is strongly recommended that you Cancel and apply the latest version of the p There is not enough space on '{0}' to install update '{1}'. - You need to manually free up more space and try again. + Free up some space and try again. Space required: {0} From 94ec31426f7d84f3b1a26ee87328695a6b026d35 Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Fri, 20 Feb 2015 13:29:00 +0000 Subject: [PATCH 4/5] CA-161460: Clear the error message when going Back and Forward --- .../Wizards/PatchingWizard/PatchingWizard_UploadPage.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs index 1434f3c18..1d284eaac 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_UploadPage.cs @@ -47,8 +47,14 @@ namespace XenAdmin.Wizards.PatchingWizard public override void PageLoaded(PageLoadedDirection direction) { base.PageLoaded(direction); + + canUpload = true; + canDownload = true; + UpdateButtons(); + if (SelectedUpdateType == UpdateType.Existing) _patch = SelectedExistingPatch; + if (direction == PageLoadedDirection.Forward) { PrepareUploadActions(); From 5adab0cfa6cfc46b839de7624c189340e10cf7dc Mon Sep 17 00:00:00 2001 From: Stephen Turner Date: Fri, 20 Feb 2015 13:39:13 +0000 Subject: [PATCH 5/5] CAR-1711: Download update from a pool name, not an IP address --- XenModel/Actions/Pool_Patch/ApplyPatchAction.cs | 2 +- XenModel/Messages.Designer.cs | 2 +- XenModel/Messages.resx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs b/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs index 3f1d03196..ab16d40bb 100644 --- a/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs +++ b/XenModel/Actions/Pool_Patch/ApplyPatchAction.cs @@ -52,7 +52,7 @@ namespace XenAdmin.Actions if (patch_ref != null) return patch_ref; - Description = String.Format(Messages.DOWNLOADING_PATCH_FROM, patch.Connection.Hostname); + Description = String.Format(Messages.DOWNLOADING_PATCH_FROM, patch.Connection.Name); // 1st download patch from the pool that has it (the connection on the xenobject) diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 473ade844..89ecb51fa 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -10806,7 +10806,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Downloading Update from Server {0}.... + /// Looks up a localized string similar to Downloading update from '{0}'.... /// public static string DOWNLOADING_PATCH_FROM { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index d9603d695..4799727c1 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -3797,7 +3797,7 @@ This will also delete its subfolders. {0} is now available - Downloading Update from Server {0}... + Downloading update from '{0}'... Downloading {0}