mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-29 02:18:07 +01:00
CA-217847: Fixed issue where servers were marked as unable to be updated automatically
even when automatic mode was supported for them. The problem was that the xenserver versions were not retrieved from the DownloadUpdatesXmlAction once the latter had run. Also, minor refactoring. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
4046ce0f95
commit
5f75c0dd74
@ -455,7 +455,13 @@ namespace XenAdmin.Core
|
||||
|
||||
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn)
|
||||
{
|
||||
var uSeq = new UpgradeSequence();
|
||||
return GetUpgradeSequence(conn, XenServerVersions);
|
||||
}
|
||||
|
||||
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn, List<XenServerVersion> xsVersions)
|
||||
{
|
||||
if (xsVersions == null)
|
||||
return null;
|
||||
|
||||
Host master = Helpers.GetMaster(conn);
|
||||
if (master == null)
|
||||
@ -463,7 +469,7 @@ namespace XenAdmin.Core
|
||||
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
|
||||
var serverVersions = XenServerVersions.FindAll(version =>
|
||||
var serverVersions = xsVersions.FindAll(version =>
|
||||
{
|
||||
if (version.BuildNumber != string.Empty)
|
||||
return (master.BuildNumberRaw == version.BuildNumber);
|
||||
@ -473,29 +479,28 @@ namespace XenAdmin.Core
|
||||
&& Helpers.HostProductVersion(master) == version.Version.ToString());
|
||||
});
|
||||
|
||||
List<XenServerPatch> allPatches = new List<XenServerPatch>();
|
||||
|
||||
if (serverVersions.Count > 0)
|
||||
{
|
||||
// Take all the hotfixes for this version
|
||||
allPatches.AddRange(serverVersions[0].Patches);
|
||||
var uSeq = new UpgradeSequence();
|
||||
|
||||
if (serverVersions[0].MinimalPatches == null)
|
||||
return null;
|
||||
|
||||
uSeq.MinimalPatches = serverVersions[0].MinimalPatches;
|
||||
|
||||
List<XenServerPatch> allPatches = serverVersions[0].Patches;
|
||||
|
||||
foreach (Host h in hosts)
|
||||
{
|
||||
uSeq[h] = GetUpgradeSequenceForHost(h, allPatches, uSeq.MinimalPatches);
|
||||
}
|
||||
|
||||
return uSeq;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return uSeq;
|
||||
}
|
||||
|
||||
private static List<XenServerPatch> GetUpgradeSequenceForHost(Host h, List<XenServerPatch> allPatches, List<XenServerPatch> latestPatches)
|
||||
|
@ -113,6 +113,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
var fileFromDiskAlertPatch = wizardModeAutomatic ? null : PatchingWizard_SelectPatchPage.FileFromDiskAlert;
|
||||
|
||||
PatchingWizard_SelectServers.IsInAutomaticMode = wizardModeAutomatic;
|
||||
PatchingWizard_SelectServers.AutoDownloadedXenServerVersions = PatchingWizard_SelectPatchPage.AutoDownloadedXenServerVersions;
|
||||
PatchingWizard_SelectServers.SelectedUpdateType = updateType;
|
||||
PatchingWizard_SelectServers.Patch = existPatch;
|
||||
PatchingWizard_SelectServers.SelectedUpdateAlert = alertPatch;
|
||||
@ -155,19 +156,21 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
else if (prevPageType == typeof(PatchingWizard_SelectServers))
|
||||
{
|
||||
var selectedServers = PatchingWizard_SelectServers.SelectedServers;
|
||||
|
||||
var selectedPools = PatchingWizard_SelectServers.SelectedPools;
|
||||
var selectedMasters = PatchingWizard_SelectServers.SelectedMasters;
|
||||
|
||||
PatchingWizard_PrecheckPage.SelectedServers = selectedServers;
|
||||
|
||||
PatchingWizard_ModePage.SelectedServers = selectedServers;
|
||||
|
||||
PatchingWizard_PatchingPage.SelectedMasters = PatchingWizard_SelectServers.SelectedMasters;
|
||||
PatchingWizard_PatchingPage.SelectedMasters = selectedMasters;
|
||||
PatchingWizard_PatchingPage.SelectedServers = selectedServers;
|
||||
PatchingWizard_PatchingPage.SelectedPools = PatchingWizard_SelectServers.SelectedPools;
|
||||
PatchingWizard_PatchingPage.SelectedPools = selectedPools;
|
||||
|
||||
PatchingWizard_UploadPage.SelectedMasters = PatchingWizard_SelectServers.SelectedMasters;
|
||||
PatchingWizard_UploadPage.SelectedMasters = selectedMasters;
|
||||
PatchingWizard_UploadPage.SelectedServers = selectedServers;
|
||||
|
||||
PatchingWizard_AutoUpdatingPage.SelectedPools = PatchingWizard_SelectServers.SelectedPools;
|
||||
PatchingWizard_AutoUpdatingPage.SelectedPools = selectedPools;
|
||||
}
|
||||
else if (prevPageType == typeof(PatchingWizard_UploadPage))
|
||||
{
|
||||
|
@ -164,6 +164,8 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
public bool IsInAutomaticMode { get { return AutomaticRadioButton.Visible && AutomaticRadioButton.Checked; } }
|
||||
|
||||
public List<XenServerVersion> AutoDownloadedXenServerVersions { get; private set; }
|
||||
|
||||
public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
|
||||
{
|
||||
if (direction == PageLoadedDirection.Forward)
|
||||
@ -218,6 +220,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
{
|
||||
cancel = true;
|
||||
}
|
||||
AutoDownloadedXenServerVersions = downloadUpdatesAction.XenServerVersions;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,6 +167,8 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
|
||||
public bool IsInAutomaticMode { set; get; }
|
||||
|
||||
public List<XenServerVersion> AutoDownloadedXenServerVersions { private get; set; }
|
||||
|
||||
private void EnabledRow(Host host, UpdateType type, int index)
|
||||
{
|
||||
var row = (PatchingHostsDataGridViewRow)dataGridViewHosts.Rows[index];
|
||||
@ -174,7 +176,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
if (IsInAutomaticMode)
|
||||
{
|
||||
//check updgrade sequences
|
||||
Updates.UpgradeSequence us = Updates.GetUpgradeSequence(host.Connection);
|
||||
Updates.UpgradeSequence us = Updates.GetUpgradeSequence(host.Connection, AutoDownloadedXenServerVersions);
|
||||
|
||||
if (us == null) //version not supported
|
||||
{
|
||||
@ -199,7 +201,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
row.Enabled = false;
|
||||
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_NOT_AUTO_UPGRADABLE;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
//if all hosts are up-to-date
|
||||
|
@ -74,7 +74,7 @@ namespace XenAdmin.Actions
|
||||
private readonly bool _checkForPatches;
|
||||
private readonly string _checkForUpdatesUrl;
|
||||
|
||||
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string checkForUpdatesUrl)
|
||||
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string checkForUpdatesUrl = null)
|
||||
: base(null, "_get_updates", "_get_updates", true)
|
||||
{
|
||||
Debug.Assert(checkForUpdatesUrl != null, "Parameter checkForUpdatesUrl should not be null. This class does not default its value anymore.");
|
||||
@ -89,10 +89,6 @@ namespace XenAdmin.Actions
|
||||
_checkForUpdatesUrl = checkForUpdatesUrl;
|
||||
}
|
||||
|
||||
protected DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches)
|
||||
: this(checkForXenCenter, checkForServerVersion, checkForPatches, null)
|
||||
{ }
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
this.Description = Messages.AVAILABLE_UPDATES_SEARCHING;
|
||||
|
Loading…
Reference in New Issue
Block a user