mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-17444: Show minimal hotfixes on General tab
Showing recommended* hotfixes for servers when the data is available (Check For Updates xml has been downloaded and has minimalPatches node in it for the given server version). *:Not applied ones from the minimal set. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
9ec512921b
commit
3e092f6d50
@ -414,15 +414,52 @@ namespace XenAdmin.Core
|
||||
return alerts;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method returns the minimal set of patches for a host if this class already has information about them. Otherwise it returns empty list.
|
||||
/// Calling this function will not initiate a download or update.
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
/// <returns></returns>
|
||||
public static List<XenServerPatch> RecommendedPatchesForHost(Host host)
|
||||
{
|
||||
var recommendedPatches = new List<XenServerPatch>();
|
||||
|
||||
if (XenServerVersions == null)
|
||||
return recommendedPatches;
|
||||
|
||||
var serverVersions = XenServerVersions.FindAll(version =>
|
||||
{
|
||||
if (version.BuildNumber != string.Empty)
|
||||
return (host.BuildNumberRaw == version.BuildNumber);
|
||||
|
||||
return Helpers.HostProductVersionWithOEM(host) == version.VersionAndOEM
|
||||
|| (version.Oem != null && Helpers.OEMName(host).StartsWith(version.Oem)
|
||||
&& Helpers.HostProductVersion(host) == version.Version.ToString());
|
||||
});
|
||||
|
||||
if (serverVersions.Count != 0)
|
||||
{
|
||||
var minimumPatches = new List<XenServerPatch>();
|
||||
minimumPatches = serverVersions[0].MinimalPatches;
|
||||
|
||||
var appliedPatches = host.AppliedPatches();
|
||||
recommendedPatches = minimumPatches.FindAll(p => !appliedPatches.Any(ap => string.Equals(ap.uuid, p.Uuid, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
}
|
||||
|
||||
return recommendedPatches;
|
||||
}
|
||||
|
||||
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn)
|
||||
{
|
||||
var uSeq = new UpgradeSequence();
|
||||
|
||||
Host master = Helpers.GetMaster(conn);
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
if (master == null)
|
||||
return null;
|
||||
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
|
||||
var serverVersions = XenServerVersions.FindAll(version =>
|
||||
{
|
||||
if (version.BuildNumber != string.Empty)
|
||||
|
@ -676,6 +676,12 @@ namespace XenAdmin.TabPages
|
||||
s.AddEntry(FriendlyName("Pool_patch.applied"), hostAppliedPatches(host));
|
||||
}
|
||||
|
||||
var recommendedPatches = RecommendedPatchesForHost(host);
|
||||
if (!string.IsNullOrEmpty(recommendedPatches))
|
||||
{
|
||||
s.AddEntry(FriendlyName("Pool_patch.recommended"), recommendedPatches);
|
||||
}
|
||||
|
||||
// add supplemental packs
|
||||
var suppPacks = hostInstalledSuppPacks(host);
|
||||
if (!string.IsNullOrEmpty(suppPacks))
|
||||
@ -1613,6 +1619,17 @@ namespace XenAdmin.TabPages
|
||||
return true;
|
||||
}
|
||||
|
||||
private string RecommendedPatchesForHost(Host host)
|
||||
{
|
||||
var result = new List<string>();
|
||||
var recommendedPatches = Updates.RecommendedPatchesForHost(host);
|
||||
|
||||
foreach (var patch in recommendedPatches)
|
||||
result.Add(patch.Name);
|
||||
|
||||
return string.Join(Environment.NewLine, result.ToArray());
|
||||
}
|
||||
|
||||
private string hostAppliedPatches(Host host)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
|
11
XenModel/FriendlyNames.Designer.cs
generated
11
XenModel/FriendlyNames.Designer.cs
generated
@ -2652,6 +2652,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Recommended Patches.
|
||||
/// </summary>
|
||||
public static string Label_Pool_patch_recommended {
|
||||
get {
|
||||
return ResourceManager.GetString("Label-Pool_patch.recommended", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disk space allocations.
|
||||
/// </summary>
|
||||
@ -4041,7 +4050,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Pool '{0}' failed to retrieve placement recommendations from WLB for VM '{1}'..
|
||||
/// Looks up a localized string similar to Pool '{0}' failed to retrieve placement recommendations from WLB for '{1}'..
|
||||
/// </summary>
|
||||
public static string Message_body_wlb_consultation_failed {
|
||||
get {
|
||||
|
@ -1859,4 +1859,7 @@
|
||||
<data name="Label-host.edition-standard" xml:space="preserve">
|
||||
<value>[Citrix] [XenServer product] Standard Edition</value>
|
||||
</data>
|
||||
<data name="Label-Pool_patch.recommended" xml:space="preserve">
|
||||
<value>Recommended Patches</value>
|
||||
</data>
|
||||
</root>
|
2
XenModel/Messages.Designer.cs
generated
2
XenModel/Messages.Designer.cs
generated
@ -25604,7 +25604,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Update process was not completed successfully. Check .
|
||||
/// Looks up a localized string similar to Update process was not completed successfully..
|
||||
/// </summary>
|
||||
public static string PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR {
|
||||
get {
|
||||
|
@ -8857,7 +8857,7 @@ However, there is not enough space to perform the repartitioning, so the current
|
||||
<value>Paste</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR" xml:space="preserve">
|
||||
<value>Update process was not completed successfully. Check </value>
|
||||
<value>Update process was not completed successfully.</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERRORS_OCCURED" xml:space="preserve">
|
||||
<value>Following errors occured while automatic upgrade was in progress:</value>
|
||||
|
Loading…
Reference in New Issue
Block a user