mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Corrected the logic deciding whether a supplemental pack is applicable on a host.
(This looks like a better fix for CA-236547 too). Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
c11b692958
commit
624a228715
@ -116,12 +116,14 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
var existPatch = wizardIsInAutomatedUpdatesMode ? null : PatchingWizard_SelectPatchPage.SelectedExistingPatch;
|
||||
var alertPatch = wizardIsInAutomatedUpdatesMode ? null : PatchingWizard_SelectPatchPage.SelectedUpdateAlert;
|
||||
var fileFromDiskAlertPatch = wizardIsInAutomatedUpdatesMode ? null : PatchingWizard_SelectPatchPage.FileFromDiskAlert;
|
||||
var fileFromDiskHasUpdateXml = !wizardIsInAutomatedUpdatesMode && PatchingWizard_SelectPatchPage.FileFromDiskHasUpdateXml;
|
||||
|
||||
PatchingWizard_SelectServers.WizardMode = wizardMode;
|
||||
PatchingWizard_SelectServers.SelectedUpdateType = updateType;
|
||||
PatchingWizard_SelectServers.Patch = existPatch;
|
||||
PatchingWizard_SelectServers.SelectedUpdateAlert = alertPatch;
|
||||
PatchingWizard_SelectServers.FileFromDiskAlert = fileFromDiskAlertPatch;
|
||||
PatchingWizard_SelectServers.FileFromDiskHasUpdateXml = fileFromDiskHasUpdateXml;
|
||||
|
||||
RemovePage(PatchingWizard_UploadPage);
|
||||
RemovePage(PatchingWizard_ModePage);
|
||||
|
@ -56,6 +56,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
private bool CheckForUpdatesInProgress;
|
||||
public XenServerPatchAlert SelectedUpdateAlert;
|
||||
public XenServerPatchAlert FileFromDiskAlert;
|
||||
public bool FileFromDiskHasUpdateXml { get; private set; }
|
||||
private bool firstLoad = true;
|
||||
private string unzippedUpdateFilePath;
|
||||
|
||||
@ -224,9 +225,11 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
? ((PatchGridViewRow)dataGridViewPatches.SelectedRows[0]).UpdateAlert
|
||||
: null;
|
||||
|
||||
FileFromDiskAlert = selectFromDiskRadioButton.Checked
|
||||
? GetAlertFromFile(fileName)
|
||||
: null;
|
||||
bool hasUpdateXml = false;
|
||||
FileFromDiskAlert = selectFromDiskRadioButton.Checked
|
||||
? GetAlertFromFile(fileName, out hasUpdateXml)
|
||||
: null;
|
||||
FileFromDiskHasUpdateXml = hasUpdateXml;
|
||||
|
||||
if (downloadUpdateRadioButton.Checked)
|
||||
{
|
||||
@ -281,9 +284,9 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
}
|
||||
}
|
||||
|
||||
private XenServerPatchAlert GetAlertFromFile(string fileName)
|
||||
private XenServerPatchAlert GetAlertFromFile(string fileName, out bool hasUpdateXml)
|
||||
{
|
||||
var alertFromIso = GetAlertFromIsoFile(fileName);
|
||||
var alertFromIso = GetAlertFromIsoFile(fileName, out hasUpdateXml);
|
||||
if (alertFromIso != null)
|
||||
return alertFromIso;
|
||||
|
||||
@ -291,8 +294,10 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
return Updates.FindPatchAlertByName(Path.GetFileNameWithoutExtension(fileName));
|
||||
}
|
||||
|
||||
private XenServerPatchAlert GetAlertFromIsoFile(string fileName)
|
||||
private XenServerPatchAlert GetAlertFromIsoFile(string fileName, out bool hasUpdateXml)
|
||||
{
|
||||
hasUpdateXml = false;
|
||||
|
||||
if (!fileName.EndsWith(Branding.UpdateIso))
|
||||
return null;
|
||||
|
||||
@ -308,6 +313,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
using (var fileStream = cd.OpenFile("Update.xml", FileMode.Open))
|
||||
{
|
||||
xmlDoc.Load(fileStream);
|
||||
hasUpdateXml = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
public XenServerPatchAlert SelectedUpdateAlert { private get; set; }
|
||||
public XenServerPatchAlert FileFromDiskAlert { private get; set; }
|
||||
public bool FileFromDiskHasUpdateXml { private get; set; }
|
||||
public WizardMode WizardMode { private get; set; }
|
||||
|
||||
public PatchingWizard_SelectServers()
|
||||
@ -288,30 +289,23 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
return false;
|
||||
}
|
||||
|
||||
if (poolSelectionOnly)
|
||||
if (WizardMode == WizardMode.AutomatedUpdates || SelectedUpdateAlert != null || FileFromDiskAlert != null)
|
||||
return IsHostAmongApplicable(host, out tooltipText);
|
||||
|
||||
var firstCheckedHost = GetFirstCheckedHost();
|
||||
if (firstCheckedHost != null && (Helpers.ElyOrGreater(firstCheckedHost) != Helpers.ElyOrGreater(host)))
|
||||
|
||||
// here a file from disk was selected, but it was not an update (FileFromDiskAlert == null)
|
||||
if ((!Helpers.ElyOrGreater(host.Connection) && FileFromDiskHasUpdateXml) ||
|
||||
(Helpers.ElyOrGreater(host.Connection) && !FileFromDiskHasUpdateXml))
|
||||
{
|
||||
tooltipText = string.Format(Messages.PATCHINGWIZARD_SELECTSERVERPAGE_MIXED_VERSIONS, firstCheckedHost.ProductVersionTextShort(), host.ProductVersionTextShort());
|
||||
tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_PATCH_NOT_APPLICABLE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Host GetFirstCheckedHost()
|
||||
{
|
||||
var firstCheckedRow = dataGridViewHosts.Rows.Cast<PatchingHostsDataGridViewRow>().FirstOrDefault(row => row.CheckValue > UNCHECKED);
|
||||
if (firstCheckedRow == null)
|
||||
return null;
|
||||
return firstCheckedRow.Tag as Host ?? Helpers.GetMaster(firstCheckedRow.Tag as Pool);
|
||||
}
|
||||
|
||||
private bool IsHostAmongApplicable(Host host, out string tooltipText)
|
||||
{
|
||||
string patchUuidFromAlert = null;
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -27677,15 +27677,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The same update cannot be applied to {0} and {1} versions of [XenServer].
|
||||
/// </summary>
|
||||
public static string PATCHINGWIZARD_SELECTSERVERPAGE_MIXED_VERSIONS {
|
||||
get {
|
||||
return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_MIXED_VERSIONS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to One or more servers in the pool have to be upgraded before [XenCenter] can apply the selected new version..
|
||||
/// </summary>
|
||||
|
@ -9543,9 +9543,6 @@ However, there is not enough space to perform the repartitioning, so the current
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNREACHABLE" xml:space="preserve">
|
||||
<value>The server is unreachable</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_MIXED_VERSIONS" xml:space="preserve">
|
||||
<value>The same update cannot be applied to {0} and {1} versions of [XenServer]</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_NEW_VERSION_UPGRADE_SLAVES_FIRST" xml:space="preserve">
|
||||
<value>One or more servers in the pool have to be upgraded before [XenCenter] can apply the selected new version.</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user