CP-28279: Use different messages for RPU (for reporting success or failure)

- Also corrected the function that creates the update plan action in RPU: when running a retry, these actions shouldn't be regenerated.

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2018-06-22 15:57:31 +01:00 committed by Konstantina Chremmou
parent 7ed8a2ba44
commit e8d2b9e493
5 changed files with 159 additions and 35 deletions

View File

@ -123,7 +123,12 @@ namespace XenAdmin.Wizards.PatchingWizard
#endregion
#region Virtual members
public abstract string BlurbText();
protected abstract string BlurbText();
protected abstract string SuccessMessageOnCompletion(bool multiplePools);
protected abstract string FailureMessageOnCompletion(bool multiplePools);
protected abstract string SuccessMessagePerPool();
protected abstract string FailureMessagePerPool(bool multipleErrors);
protected virtual void GeneratePlanActions(Pool pool, List<HostPlanActions> planActions, List<PlanAction> finalActions) { }
@ -271,14 +276,12 @@ namespace XenAdmin.Wizards.PatchingWizard
if (bgwErrorCount > 0)
{
sb.AppendIndented(bgwErrorCount > 1
? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_POOL_MANY
: Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_POOL_ONE).AppendLine();
sb.AppendIndented(FailureMessagePerPool(bgwErrorCount > 1)).AppendLine();
sb.AppendIndented(errorSb);
}
else if (!bgw.IsBusy)
{
sb.AppendIndented(Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_ONE).AppendLine();
sb.AppendIndented(SuccessMessagePerPool()).AppendLine();
}
sb.AppendLine();
@ -506,17 +509,13 @@ namespace XenAdmin.Wizards.PatchingWizard
panel1.Visible = true;
if (_someWorkersFailed)
{
labelError.Text = backgroundWorkers.Count > 1
? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_MANY
: Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_ONE;
labelError.Text = FailureMessageOnCompletion(backgroundWorkers.Count > 1);
pictureBox1.Image = Images.StaticImages._000_error_h32bit_16;
buttonRetry.Visible = true;
}
else
{
labelError.Text = backgroundWorkers.Count > 1
? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_MANY
: Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_ONE;
labelError.Text = SuccessMessageOnCompletion(backgroundWorkers.Count > 1);
pictureBox1.Image = Images.StaticImages._000_Tick_h32bit_16;
buttonRetry.Visible = false;
progressBar.Value = 100;

View File

@ -74,13 +74,34 @@ namespace XenAdmin.Wizards.PatchingWizard
#endregion
#region AutomatedUpdatesBesePage overrides
public override string BlurbText()
protected override string BlurbText()
{
return WizardMode == WizardMode.AutomatedUpdates
? Messages.PATCHINGWIZARD_UPLOAD_AND_INSTALL_TITLE_AUTOMATED_MODE
: Messages.PATCHINGWIZARD_UPLOAD_AND_INSTALL_TITLE_NEW_VERSION_AUTOMATED_MODE;
}
protected override string SuccessMessageOnCompletion(bool multiplePools)
{
return multiplePools ? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_MANY : Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_ONE;
}
protected override string FailureMessageOnCompletion(bool multiplePools)
{
return multiplePools ? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_MANY : Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_ONE;
}
protected override string SuccessMessagePerPool()
{
return Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_SUCCESS_ONE;
}
protected override string FailureMessagePerPool(bool multipleErrors)
{
return multipleErrors ? Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_POOL_MANY : Messages.PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR_POOL_ONE;
}
protected override void GeneratePlanActions(Pool pool, List<HostPlanActions> planActions, List<PlanAction> finalActions)
{
bool automatedUpdatesRestricted = pool.Connection.Cache.Hosts.Any(Host.RestrictBatchHotfixApply);

View File

@ -65,9 +65,30 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
#endregion
#region AutomatedUpdatesBesePage overrides
public override string BlurbText()
protected override string BlurbText()
{
return Messages.PATCHINGWIZARD_UPLOAD_AND_INSTALL_TITLE_NEW_VERSION_AUTOMATED_MODE;
return Messages.ROLLING_UPGRADE_UPGRADE_IN_PROGRESS;
}
protected override string SuccessMessageOnCompletion(bool multiplePools)
{
return multiplePools ? Messages.ROLLING_UPGRADE_SUCCESS_MANY : Messages.ROLLING_UPGRADE_SUCCESS_ONE;
}
protected override string FailureMessageOnCompletion(bool multiplePools)
{
return multiplePools ? Messages.ROLLING_UPGRADE_ERROR_MANY : Messages.ROLLING_UPGRADE_ERROR_ONE;
}
protected override string SuccessMessagePerPool()
{
return Messages.ROLLING_UPGRADE_SUCCESS_ONE;
}
protected override string FailureMessagePerPool(bool multipleErrors)
{
return multipleErrors ? Messages.ROLLING_UPGRADE_ERROR_POOL_MANY : Messages.ROLLING_UPGRADE_ERROR_POOL_ONE;
}
protected override void GeneratePlanActions(Pool pool, List<HostPlanActions> planActions, List<PlanAction> finalActions)
@ -189,41 +210,40 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard
return false;
}
private Dictionary<Pool, List<XenServerPatch>> AllUploadedPatches = new Dictionary<Pool, List<XenServerPatch>>();
private Dictionary<Pool, List<XenServerPatch>> MinimalPatches = new Dictionary<Pool, List<XenServerPatch>>();
private Dictionary<UpdateProgressBackgroundWorker, List<XenServerPatch>> AllUploadedPatches = new Dictionary<UpdateProgressBackgroundWorker, List<XenServerPatch>>();
private Dictionary<UpdateProgressBackgroundWorker, List<XenServerPatch>> MinimalPatches = new Dictionary<UpdateProgressBackgroundWorker, List<XenServerPatch>>(); // should be calculated only once per pool (to ensure update homogeneity)
protected override void DoAfterInitialPlanActions(UpdateProgressBackgroundWorker bgw, Host host, List<Host> hosts)
{
var hostPlanActions = bgw.HostActions.FirstOrDefault(ha => ha.Host.Equals(host));
if (hostPlanActions == null)
return;
if (hostPlanActions.UpdatesPlanActions.Count > 0) // this is a retry; do not recreate actions
return;
if (!ApplyUpdatesToNewVersion || host.Connection.Cache.Hosts.Any(Host.RestrictBatchHotfixApply))
return;
if (!MinimalPatches.ContainsKey(bgw))
MinimalPatches.Add(bgw, Updates.GetMinimalPatches(host.Connection));
var pool = Helpers.GetPoolOfOne(host.Connection);
if (pool == null)
return;
if (!MinimalPatches.ContainsKey(pool))
MinimalPatches.Add(pool, Updates.GetMinimalPatches(pool.Connection));
var minimalPatches = MinimalPatches[pool];
var minimalPatches = MinimalPatches[bgw];
if (minimalPatches == null)
return;
if (!AllUploadedPatches.ContainsKey(pool))
AllUploadedPatches.Add(pool, new List<XenServerPatch>());
var uploadedPatches = AllUploadedPatches[pool];
if (!AllUploadedPatches.ContainsKey(bgw))
AllUploadedPatches.Add(bgw, new List<XenServerPatch>());
var uploadedPatches = AllUploadedPatches[bgw];
var hostActions = GetUpdatePlanActionsForHost(host, hosts, minimalPatches, uploadedPatches, new KeyValuePair<XenServerPatch, string>());
if (hostActions.UpdatesPlanActions != null && hostActions.UpdatesPlanActions.Count > 0)
{
foreach (var ha in bgw.HostActions)
if (hostPlanActions != null)
{
if (host.Equals(ha.Host))
{
ha.UpdatesPlanActions = hostActions.UpdatesPlanActions;
ha.DelayedActions = hostActions.DelayedActions;
break;
}
hostPlanActions.UpdatesPlanActions = hostActions.UpdatesPlanActions;
hostPlanActions.DelayedActions.InsertRange(0, hostActions.DelayedActions);
}
}
}

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", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Messages {
@ -30505,6 +30505,42 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to One or more of the rolling pool upgrade processes were not completed successfully. The upgrade process has been paused. Press Retry to resume it..
/// </summary>
public static string ROLLING_UPGRADE_ERROR_MANY {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_ERROR_MANY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The rolling pool upgrade process was not completed successfuly. The upgrade process has been paused. Press Retry to resume it..
/// </summary>
public static string ROLLING_UPGRADE_ERROR_ONE {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_ERROR_ONE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The following errors occurred while rolling pool upgrade was in progress:.
/// </summary>
public static string ROLLING_UPGRADE_ERROR_POOL_MANY {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_ERROR_POOL_MANY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The following error occurred while rolling pool upgrade was in progress:.
/// </summary>
public static string ROLLING_UPGRADE_ERROR_POOL_ONE {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_ERROR_POOL_ONE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Locate the network install files (Automatic Mode).
/// </summary>
@ -30549,6 +30585,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to All rolling pool upgrade processes were completed successfuly..
/// </summary>
public static string ROLLING_UPGRADE_SUCCESS_MANY {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_SUCCESS_MANY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The rolling pool upgrade process was completed successfuly..
/// </summary>
public static string ROLLING_UPGRADE_SUCCESS_ONE {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_SUCCESS_ONE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Still waiting for the upgrade to complete.\n\nThere maybe a problem check the server console.\n\nClick Keep Waiting if the upgrade is still running or Cancel if there was an error..
/// </summary>
@ -30594,6 +30648,15 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Rolling pool upgrade is in progress. The upgrade might take some time..
/// </summary>
public static string ROLLING_UPGRADE_UPGRADE_IN_PROGRESS {
get {
return ResourceManager.GetString("ROLLING_UPGRADE_UPGRADE_IN_PROGRESS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rolling pool upgrade did not complete..
/// </summary>

View File

@ -10600,6 +10600,18 @@ Click Server Status Report to open the Compile Server Status Report Wizard or cl
<data name="ROLLING_UPGRADE_DISCONNECTED_SERVER" xml:space="preserve">
<value>No longer connected to {0}. Please review your selection and try again.</value>
</data>
<data name="ROLLING_UPGRADE_ERROR_MANY" xml:space="preserve">
<value>One or more of the rolling pool upgrade processes were not completed successfully. The upgrade process has been paused. Press Retry to resume it.</value>
</data>
<data name="ROLLING_UPGRADE_ERROR_ONE" xml:space="preserve">
<value>The rolling pool upgrade process was not completed successfuly. The upgrade process has been paused. Press Retry to resume it.</value>
</data>
<data name="ROLLING_UPGRADE_ERROR_POOL_MANY" xml:space="preserve">
<value>The following errors occurred while rolling pool upgrade was in progress:</value>
</data>
<data name="ROLLING_UPGRADE_ERROR_POOL_ONE" xml:space="preserve">
<value>The following error occurred while rolling pool upgrade was in progress:</value>
</data>
<data name="ROLLING_UPGRADE_METHOD_PAGE_TEXT" xml:space="preserve">
<value>Locate the network install files (Automatic Mode)</value>
</data>
@ -10623,6 +10635,12 @@ To skip this server and continue to the next server in the pool, click Skip This
The master must be upgraded first, so if you skip the master, the rolling pool upgrade will be canceled for this pool.
</value>
</data>
<data name="ROLLING_UPGRADE_SUCCESS_MANY" xml:space="preserve">
<value>All rolling pool upgrade processes were completed successfuly.</value>
</data>
<data name="ROLLING_UPGRADE_SUCCESS_ONE" xml:space="preserve">
<value>The rolling pool upgrade process was completed successfuly.</value>
</data>
<data name="ROLLING_UPGRADE_TIMEOUT" xml:space="preserve">
<value>Still waiting for the upgrade to complete.\n\nThere maybe a problem check the server console.\n\nClick Keep Waiting if the upgrade is still running or Cancel if there was an error.</value>
</data>
@ -10638,6 +10656,9 @@ The master must be upgraded first, so if you skip the master, the rolling pool u
<data name="ROLLING_UPGRADE_UPGRADE_COMPLETED" xml:space="preserve">
<value>Rolling pool upgrade is complete.</value>
</data>
<data name="ROLLING_UPGRADE_UPGRADE_IN_PROGRESS" xml:space="preserve">
<value>Rolling pool upgrade is in progress. The upgrade might take some time.</value>
</data>
<data name="ROLLING_UPGRADE_UPGRADE_NOT_COMPLETED" xml:space="preserve">
<value>Rolling pool upgrade did not complete.</value>
</data>