diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs index 8a61d6afb..23a4338fc 100644 --- a/XenAdmin/Core/Updates.cs +++ b/XenAdmin/Core/Updates.cs @@ -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 xsVersions) + { + if (xsVersions == null) + return null; Host master = Helpers.GetMaster(conn); if (master == null) @@ -463,7 +469,7 @@ namespace XenAdmin.Core List 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 allPatches = new List(); - 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 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 GetUpgradeSequenceForHost(Host h, List allPatches, List latestPatches) diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs index bcabca699..a04ffd0a4 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard.cs @@ -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)) { diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs index c92eebd1e..942d1492e 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs @@ -164,6 +164,8 @@ namespace XenAdmin.Wizards.PatchingWizard public bool IsInAutomaticMode { get { return AutomaticRadioButton.Visible && AutomaticRadioButton.Checked; } } + public List 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; } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs index 6f48cb9ce..4b60f482b 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs @@ -167,6 +167,8 @@ namespace XenAdmin.Wizards.PatchingWizard public bool IsInAutomaticMode { set; get; } + public List 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 diff --git a/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs b/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs index 08601240d..e084f9afe 100644 --- a/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs +++ b/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs @@ -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;