mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-02 01:00:15 +01:00
Merge pull request #1014 from GaborApatiNagy/master_batch_new2
CP-15790, CP-17444
This commit is contained in:
commit
247a44d7ab
@ -379,6 +379,11 @@ namespace XenAdmin.Core
|
|||||||
get { return ReadInstalledKey(ADDITIONAL_FEATURES); }
|
get { return ReadInstalledKey(ADDITIONAL_FEATURES); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string CustomUpdatesXmlLocation
|
||||||
|
{
|
||||||
|
get { return ReadKey(CUSTOM_UPDATES_XML_LOCATION); }
|
||||||
|
}
|
||||||
|
|
||||||
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
|
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
|
||||||
private const string SSL_CERTIFICATES_ALL = "ALL";
|
private const string SSL_CERTIFICATES_ALL = "ALL";
|
||||||
private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates";
|
private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates";
|
||||||
@ -402,6 +407,7 @@ namespace XenAdmin.Core
|
|||||||
private const string HEALTH_CHECK_PRODUCT_KEY = "HealthCheckProductKey";
|
private const string HEALTH_CHECK_PRODUCT_KEY = "HealthCheckProductKey";
|
||||||
private const string HIDDEN_FEATURES = "HiddenFeatures";
|
private const string HIDDEN_FEATURES = "HiddenFeatures";
|
||||||
private const string ADDITIONAL_FEATURES = "AdditionalFeatures";
|
private const string ADDITIONAL_FEATURES = "AdditionalFeatures";
|
||||||
|
private const string CUSTOM_UPDATES_XML_LOCATION = "CheckForUpdatesXmlLocationOverride";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SSLCertificateTypes { None, Changed, All }
|
public enum SSLCertificateTypes { None, Changed, All }
|
||||||
|
@ -197,7 +197,7 @@ namespace XenAdmin.Core
|
|||||||
Properties.Settings.Default.AllowXenCenterUpdates || force,
|
Properties.Settings.Default.AllowXenCenterUpdates || force,
|
||||||
Properties.Settings.Default.AllowXenServerUpdates || force,
|
Properties.Settings.Default.AllowXenServerUpdates || force,
|
||||||
Properties.Settings.Default.AllowPatchesUpdates || force,
|
Properties.Settings.Default.AllowPatchesUpdates || force,
|
||||||
Branding.CheckForUpdatesUrl);
|
Updates.CheckForUpdatesUrl);
|
||||||
{
|
{
|
||||||
action.Completed += actionCompleted;
|
action.Completed += actionCompleted;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,15 @@ namespace XenAdmin.Core
|
|||||||
action.RunAsync();
|
action.RunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string CheckForUpdatesUrl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Registry.CustomUpdatesXmlLocation ?? Branding.CheckForUpdatesUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void actionCompleted(ActionBase sender)
|
private static void actionCompleted(ActionBase sender)
|
||||||
{
|
{
|
||||||
Program.AssertOffEventThread();
|
Program.AssertOffEventThread();
|
||||||
@ -406,15 +414,52 @@ namespace XenAdmin.Core
|
|||||||
return alerts;
|
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)
|
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn)
|
||||||
{
|
{
|
||||||
var uSeq = new UpgradeSequence();
|
var uSeq = new UpgradeSequence();
|
||||||
|
|
||||||
Host master = Helpers.GetMaster(conn);
|
Host master = Helpers.GetMaster(conn);
|
||||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
|
||||||
if (master == null)
|
if (master == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||||
|
|
||||||
var serverVersions = XenServerVersions.FindAll(version =>
|
var serverVersions = XenServerVersions.FindAll(version =>
|
||||||
{
|
{
|
||||||
if (version.BuildNumber != string.Empty)
|
if (version.BuildNumber != string.Empty)
|
||||||
|
@ -676,6 +676,12 @@ namespace XenAdmin.TabPages
|
|||||||
s.AddEntry(FriendlyName("Pool_patch.applied"), hostAppliedPatches(host));
|
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
|
// add supplemental packs
|
||||||
var suppPacks = hostInstalledSuppPacks(host);
|
var suppPacks = hostInstalledSuppPacks(host);
|
||||||
if (!string.IsNullOrEmpty(suppPacks))
|
if (!string.IsNullOrEmpty(suppPacks))
|
||||||
@ -1613,6 +1619,17 @@ namespace XenAdmin.TabPages
|
|||||||
return true;
|
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)
|
private string hostAppliedPatches(Host host)
|
||||||
{
|
{
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
|
@ -184,7 +184,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
|||||||
}
|
}
|
||||||
else //In Automatic Mode
|
else //In Automatic Mode
|
||||||
{
|
{
|
||||||
var downloadUpdatesAction = new DownloadUpdatesXmlAction(false, true, true);
|
var downloadUpdatesAction = new DownloadUpdatesXmlAction(false, true, true, Updates.CheckForUpdatesUrl);
|
||||||
var dialog = new ActionProgressDialog(downloadUpdatesAction, ProgressBarStyle.Marquee);
|
var dialog = new ActionProgressDialog(downloadUpdatesAction, ProgressBarStyle.Marquee);
|
||||||
|
|
||||||
dialog.ShowDialog(this.Parent); //Will block until dialog closes, action completed
|
dialog.ShowDialog(this.Parent); //Will block until dialog closes, action completed
|
||||||
|
@ -36,6 +36,7 @@ using XenAPI;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using XenAdmin.Core;
|
using XenAdmin.Core;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
|
||||||
namespace XenAdmin.Actions
|
namespace XenAdmin.Actions
|
||||||
@ -76,6 +77,8 @@ namespace XenAdmin.Actions
|
|||||||
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string checkForUpdatesUrl)
|
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches, string checkForUpdatesUrl)
|
||||||
: base(null, "_get_updates", "_get_updates", true)
|
: 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.");
|
||||||
|
|
||||||
XenServerPatches = new List<XenServerPatch>();
|
XenServerPatches = new List<XenServerPatch>();
|
||||||
XenServerVersions = new List<XenServerVersion>();
|
XenServerVersions = new List<XenServerVersion>();
|
||||||
XenCenterVersions = new List<XenCenterVersion>();
|
XenCenterVersions = new List<XenCenterVersion>();
|
||||||
@ -83,10 +86,10 @@ namespace XenAdmin.Actions
|
|||||||
_checkForXenCenter = checkForXenCenter;
|
_checkForXenCenter = checkForXenCenter;
|
||||||
_checkForServerVersion = checkForServerVersion;
|
_checkForServerVersion = checkForServerVersion;
|
||||||
_checkForPatches = checkForPatches;
|
_checkForPatches = checkForPatches;
|
||||||
_checkForUpdatesUrl = string.IsNullOrEmpty(checkForUpdatesUrl) ? InvisibleMessages.XENSERVER_UPDATE_URL : checkForUpdatesUrl;
|
_checkForUpdatesUrl = checkForUpdatesUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches)
|
protected DownloadUpdatesXmlAction(bool checkForXenCenter, bool checkForServerVersion, bool checkForPatches)
|
||||||
: this(checkForXenCenter, checkForServerVersion, checkForPatches, null)
|
: this(checkForXenCenter, checkForServerVersion, checkForPatches, null)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -288,10 +291,19 @@ namespace XenAdmin.Actions
|
|||||||
|
|
||||||
protected virtual XmlDocument FetchCheckForUpdatesXml(string location)
|
protected virtual XmlDocument FetchCheckForUpdatesXml(string location)
|
||||||
{
|
{
|
||||||
XmlDocument xdoc;
|
var xdoc = new XmlDocument();
|
||||||
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false, true))
|
var uri = new Uri(location);
|
||||||
|
|
||||||
|
if (uri.IsFile)
|
||||||
{
|
{
|
||||||
xdoc = Helpers.LoadXmlDocument(xmlstream);
|
xdoc.Load(location);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (Stream xmlstream = HTTPHelper.GET(new Uri(location), Connection, false, true))
|
||||||
|
{
|
||||||
|
xdoc = Helpers.LoadXmlDocument(xmlstream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return xdoc;
|
return xdoc;
|
||||||
}
|
}
|
||||||
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Disk space allocations.
|
/// Looks up a localized string similar to Disk space allocations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -4041,7 +4050,7 @@ namespace XenAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public static string Message_body_wlb_consultation_failed {
|
public static string Message_body_wlb_consultation_failed {
|
||||||
get {
|
get {
|
||||||
|
@ -1859,4 +1859,7 @@
|
|||||||
<data name="Label-host.edition-standard" xml:space="preserve">
|
<data name="Label-host.edition-standard" xml:space="preserve">
|
||||||
<value>[Citrix] [XenServer product] Standard Edition</value>
|
<value>[Citrix] [XenServer product] Standard Edition</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Label-Pool_patch.recommended" xml:space="preserve">
|
||||||
|
<value>Recommended Patches</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
2
XenModel/Messages.Designer.cs
generated
2
XenModel/Messages.Designer.cs
generated
@ -25604,7 +25604,7 @@ namespace XenAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
public static string PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR {
|
public static string PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR {
|
||||||
get {
|
get {
|
||||||
|
@ -8857,7 +8857,7 @@ However, there is not enough space to perform the repartitioning, so the current
|
|||||||
<value>Paste</value>
|
<value>Paste</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERROR" xml:space="preserve">
|
<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>
|
||||||
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERRORS_OCCURED" xml:space="preserve">
|
<data name="PATCHINGWIZARD_AUTOUPDATINGPAGE_ERRORS_OCCURED" xml:space="preserve">
|
||||||
<value>Following errors occured while automatic upgrade was in progress:</value>
|
<value>Following errors occured while automatic upgrade was in progress:</value>
|
||||||
|
Loading…
Reference in New Issue
Block a user