diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs index f19211a8a..1190f7039 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectServers.cs @@ -190,69 +190,90 @@ namespace XenAdmin.Wizards.PatchingWizard : CanEnableRowNonAutomated(host, out tooltipText); } - private bool CanEnableRowAutomatedUpdates(Host host, out string tooltipText) + private bool CanEnableRowAutomatedUpdates(Host host, out string cannotEnableReason) { var poolOfOne = Helpers.GetPoolOfOne(host.Connection); // This check is first because it generally can't be fixed, it's a property of the host if (poolOfOne != null && poolOfOne.IsAutoUpdateRestartsForbidden()) // Forbids update auto restarts { - tooltipText = Messages.POOL_FORBIDS_AUTOMATED_UPDATES; + cannotEnableReason = Messages.POOL_FORBIDS_AUTOMATED_UPDATES; return false; } var pool = Helpers.GetPool(host.Connection); if (WizardMode != WizardMode.NewVersion && pool != null && !pool.IsPoolFullyUpgraded()) //partially upgraded pool is not supported { - tooltipText = string.Format(Messages.PATCHINGWIZARD_SELECTSERVERPAGE_AUTOMATED_UPDATES_NOT_SUPPORTED_PARTIALLY_UPGRADED, BrandManager.ProductBrand); + cannotEnableReason = string.Format(Messages.PATCHINGWIZARD_SELECTSERVERPAGE_AUTOMATED_UPDATES_NOT_SUPPORTED_PARTIALLY_UPGRADED, BrandManager.ProductBrand); return false; } if (Helpers.CloudOrGreater(host)) { + if (poolOfOne?.repositories.Count == 0) + { + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_CDN_REPOS_NOT_CONFIGURED; + return false; + } + + if (Helpers.XapiEqualOrGreater_23_18_0(host.Connection)) + { + if (poolOfOne?.last_update_sync == Util.GetUnixMinDateTime()) + { + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_CDN_NOT_SYNCHRONIZED; + return false; + } + + if (host.latest_synced_updates_applied == latest_synced_updates_applied_state.yes) + { + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_CDN_UPDATES_APPLIED; + return false; + } + } + if (!Updates.CdnUpdateInfoPerConnection.TryGetValue(host.Connection, out var updateInfo) || updateInfo.HostsWithUpdates.FirstOrDefault(u => u.HostOpaqueRef == host.opaque_ref) == null) { - tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_UP_TO_DATE; + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_CDN_UPDATES_APPLIED; return false; } } else { - //check updgrade sequences + //check upgrade sequences var minimalPatches = WizardMode == WizardMode.NewVersion ? Updates.GetMinimalPatches(host) : Updates.GetMinimalPatches(host.Connection); if (minimalPatches == null) //version not supported or too new to have automated updates available { - tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_UP_TO_DATE; + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_UP_TO_DATE; return false; } //check all hosts are licensed for automated updates (there may be restrictions on individual hosts) if (host.Connection.Cache.Hosts.Any(Host.RestrictBatchHotfixApply)) { - tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNLICENSED_FOR_AUTOMATED_UPDATES; + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_HOST_UNLICENSED_FOR_AUTOMATED_UPDATES; return false; } var us = Updates.GetPatchSequenceForHost(host, minimalPatches); if (us == null) { - tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_NOT_AUTO_UPGRADABLE; + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_NOT_AUTO_UPGRADABLE; return false; } //if host is up to date if (us.Count == 0) { - tooltipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_UP_TO_DATE; + cannotEnableReason = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_SERVER_UP_TO_DATE; return false; } } - tooltipText = null; + cannotEnableReason = null; return true; } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 248164ed1..1e3a72e7b 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -30247,6 +30247,33 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to You have never synchronized with the update channel.. + /// + public static string PATCHINGWIZARD_SELECTSERVERPAGE_CDN_NOT_SYNCHRONIZED { + get { + return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_CDN_NOT_SYNCHRONIZED", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You have not configured an update channel.. + /// + public static string PATCHINGWIZARD_SELECTSERVERPAGE_CDN_REPOS_NOT_CONFIGURED { + get { + return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_CDN_REPOS_NOT_CONFIGURED", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All updates available at the last synchronization have been applied.. + /// + public static string PATCHINGWIZARD_SELECTSERVERPAGE_CDN_UPDATES_APPLIED { + get { + return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_CDN_UPDATES_APPLIED", resourceCulture); + } + } + /// /// Looks up a localized string similar to Subscription Advantage required. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index d25392cab..4e79a4f21 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -10486,6 +10486,15 @@ This will cancel the update process and may leave your system in an unstable sta Cannot install updates on this host because the coordinator is running a version higher than {0} + + You have never synchronized with the update channel. + + + You have not configured an update channel. + + + All updates available at the last synchronization have been applied. + Subscription Advantage required