mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 14:27:26 +01:00
Merge pull request #343 from stephen-turner/CA-161460
CA-161460: XenCenter should fail gracefully if patch download fails
This commit is contained in:
commit
f55a1fc892
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
@ -135,6 +141,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
}
|
||||
|
||||
private bool canUpload = true;
|
||||
private bool canDownload = true;
|
||||
private DiskSpaceRequirements diskSpaceRequirements;
|
||||
|
||||
private void TryUploading()
|
||||
@ -221,11 +228,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)
|
||||
{
|
||||
errorLinkLabel.Visible = true;
|
||||
errorLinkLabel.Text = Messages.PATCHINGWIZARD_MORE_INFO;
|
||||
}
|
||||
else
|
||||
diskSpaceErrorLinkLabel.Visible = false;
|
||||
errorLinkLabel.Visible = false;
|
||||
}
|
||||
|
||||
private void UpdateActionProgress(AsyncAction action)
|
||||
@ -320,9 +332,12 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
action.Completed -= multipleAction_Completed;
|
||||
|
||||
canDownload = !(action.Exception is PatchDownloadFailedException);
|
||||
|
||||
Program.Invoke(this, () =>
|
||||
{
|
||||
labelProgress.Text = GetActionDescription(action);
|
||||
UpdateButtons();
|
||||
});
|
||||
|
||||
}
|
||||
@ -362,8 +377,16 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
return textColor;
|
||||
}
|
||||
|
||||
private void diskspaceErrorLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
private void errorLinkLabel_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;
|
||||
|
||||
|
@ -250,40 +250,40 @@ Please wait for this operation to complete, then click Next to continue with the
|
||||
<data name=">>flickerFreeListBox1.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<data name="errorLinkLabel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="errorLinkLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>627, 354</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<data name="errorLinkLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 3, 3, 3</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<data name="errorLinkLabel.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>1, 1, 1, 1</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="errorLinkLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 18</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="errorLinkLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Text" xml:space="preserve">
|
||||
<data name="errorLinkLabel.Text" xml:space="preserve">
|
||||
<value>&More info...</value>
|
||||
</data>
|
||||
<data name="diskSpaceErrorLinkLabel.Visible" type="System.Boolean, mscorlib">
|
||||
<data name="errorLinkLabel.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>diskSpaceErrorLinkLabel.Name" xml:space="preserve">
|
||||
<value>diskSpaceErrorLinkLabel</value>
|
||||
<data name=">>errorLinkLabel.Name" xml:space="preserve">
|
||||
<value>errorLinkLabel</value>
|
||||
</data>
|
||||
<data name=">>diskSpaceErrorLinkLabel.Type" xml:space="preserve">
|
||||
<data name=">>errorLinkLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>diskSpaceErrorLinkLabel.Parent" xml:space="preserve">
|
||||
<data name=">>errorLinkLabel.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>diskSpaceErrorLinkLabel.ZOrder" xml:space="preserve">
|
||||
<data name=">>errorLinkLabel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
@ -317,7 +317,7 @@ Please wait for this operation to complete, then click Next to continue with the
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?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></value>
|
||||
<value><?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></value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
|
@ -2143,6 +2143,7 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Wizards\PatchingWizard\PatchingWizard_UploadPage.resx">
|
||||
<DependentUpon>PatchingWizard_UploadPage.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Wizards\PatchingWizard\PatchingWizard_UploadPage.zh-CN.resx">
|
||||
<DependentUpon>PatchingWizard_UploadPage.cs</DependentUpon>
|
||||
|
@ -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)
|
||||
|
||||
@ -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) { }
|
||||
}
|
||||
}
|
||||
|
26
XenModel/Messages.Designer.cs
generated
26
XenModel/Messages.Designer.cs
generated
@ -10806,7 +10806,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Downloading Update from Server {0}....
|
||||
/// Looks up a localized string similar to Downloading update from '{0}'....
|
||||
/// </summary>
|
||||
public static string DOWNLOADING_PATCH_FROM {
|
||||
get {
|
||||
@ -23974,7 +23974,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string NOT_ENOUGH_SPACE_MESSAGE_NOCLEANUP {
|
||||
get {
|
||||
@ -24632,6 +24632,28 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to download {0} from '{1}'.
|
||||
/// </summary>
|
||||
public static string PATCH_DOWNLOAD_FAILED {
|
||||
get {
|
||||
return ResourceManager.GetString("PATCH_DOWNLOAD_FAILED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string PATCH_DOWNLOAD_FAILED_MORE_INFO {
|
||||
get {
|
||||
return ResourceManager.GetString("PATCH_DOWNLOAD_FAILED_MORE_INFO", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}
|
||||
///Date modified: {1}
|
||||
|
16
XenModel/Messages.resx
Normal file → Executable file
16
XenModel/Messages.resx
Normal file → Executable file
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@ -3806,7 +3806,7 @@ This will also delete its subfolders.</value>
|
||||
<value>{0} is now available</value>
|
||||
</data>
|
||||
<data name="DOWNLOADING_PATCH_FROM" xml:space="preserve">
|
||||
<value>Downloading Update from Server {0}...</value>
|
||||
<value>Downloading update from '{0}'...</value>
|
||||
</data>
|
||||
<data name="DOWNLOAD_AND_EXTRACT_ACTION_DOWNLOADING_DESC" xml:space="preserve">
|
||||
<value>Downloading {0}</value>
|
||||
@ -8336,7 +8336,7 @@ It is strongly recommended that you Cancel and apply the latest version of the p
|
||||
<value>There is not enough space on '{0}' to install update '{1}'.</value>
|
||||
</data>
|
||||
<data name="NOT_ENOUGH_SPACE_MESSAGE_NOCLEANUP" xml:space="preserve">
|
||||
<value>You need to manually free up more space and try again.</value>
|
||||
<value>Free up some space and try again.</value>
|
||||
</data>
|
||||
<data name="NOT_ENOUGH_SPACE_MESSAGE_REQUIRED_SPACE" xml:space="preserve">
|
||||
<value>Space required: {0}</value>
|
||||
@ -8728,6 +8728,16 @@ It is strongly recommended that you Cancel and apply the latest version of the p
|
||||
<data name="PATCH_DESCRIPTION_AND_INSTALLATION_SIZE" xml:space="preserve">
|
||||
<value>{0}
|
||||
Installation size: {1}</value>
|
||||
</data>
|
||||
<data name="PATCH_DOWNLOAD_FAILED" xml:space="preserve">
|
||||
<value>Failed to download {0} from '{1}'</value>
|
||||
</data>
|
||||
<data name="PATCH_DOWNLOAD_FAILED_MORE_INFO" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="PATCH_EXPANDED_DESCRIPTION" xml:space="preserve">
|
||||
<value>{0}
|
||||
|
Loading…
Reference in New Issue
Block a user