mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-217862: Batch updates: Install dundee released hotfixes in Batch fails when pool slave is not reachable and pool partially upgraded
Partially upgraded pools are not supported. If the versions of servers mismatch in a pool, Automatic updating will be disabled with the appropriate info message. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
4046ce0f95
commit
f9d8b4dea9
@ -439,8 +439,7 @@ namespace XenAdmin.Core
|
||||
|
||||
if (serverVersions.Count != 0)
|
||||
{
|
||||
var minimumPatches = new List<XenServerPatch>();
|
||||
minimumPatches = serverVersions[0].MinimalPatches;
|
||||
var minimumPatches = serverVersions[0].MinimalPatches;
|
||||
|
||||
if (minimumPatches == null) //unknown
|
||||
return recommendedPatches;
|
||||
@ -461,33 +460,19 @@ namespace XenAdmin.Core
|
||||
if (master == null)
|
||||
return null;
|
||||
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
var version = GetCommonServerVersionOfHostsInAConnection(conn);
|
||||
|
||||
var serverVersions = XenServerVersions.FindAll(version =>
|
||||
if (version != null)
|
||||
{
|
||||
if (version.BuildNumber != string.Empty)
|
||||
return (master.BuildNumberRaw == version.BuildNumber);
|
||||
|
||||
return Helpers.HostProductVersionWithOEM(master) == version.VersionAndOEM
|
||||
|| (version.Oem != null && Helpers.OEMName(master).StartsWith(version.Oem)
|
||||
&& 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);
|
||||
|
||||
if (serverVersions[0].MinimalPatches == null)
|
||||
if (version.MinimalPatches == null)
|
||||
return null;
|
||||
|
||||
uSeq.MinimalPatches = serverVersions[0].MinimalPatches;
|
||||
uSeq.MinimalPatches = version.MinimalPatches;
|
||||
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
foreach (Host h in hosts)
|
||||
{
|
||||
uSeq[h] = GetUpgradeSequenceForHost(h, allPatches, uSeq.MinimalPatches);
|
||||
uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -498,7 +483,56 @@ namespace XenAdmin.Core
|
||||
return uSeq;
|
||||
}
|
||||
|
||||
private static List<XenServerPatch> GetUpgradeSequenceForHost(Host h, List<XenServerPatch> allPatches, List<XenServerPatch> latestPatches)
|
||||
/// <summary>
|
||||
/// Returns a XenServerVersion if all hosts of the pool has the same version
|
||||
/// Returns null if it is unknown or they don't match
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static XenServerVersion GetCommonServerVersionOfHostsInAConnection(IXenConnection connection)
|
||||
{
|
||||
XenServerVersion xenServerVersion = null;
|
||||
|
||||
if (connection == null)
|
||||
return null;
|
||||
|
||||
List<Host> hosts = connection.Cache.Hosts.ToList();
|
||||
|
||||
foreach (Host host in hosts)
|
||||
{
|
||||
var hostVersions = 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());
|
||||
});
|
||||
|
||||
var foundVersion = hostVersions.FirstOrDefault();
|
||||
|
||||
if (foundVersion == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xenServerVersion == null)
|
||||
{
|
||||
xenServerVersion = foundVersion;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xenServerVersion != foundVersion)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return xenServerVersion;
|
||||
}
|
||||
|
||||
private static List<XenServerPatch> GetUpgradeSequenceForHost(Host h, List<XenServerPatch> latestPatches)
|
||||
{
|
||||
var sequence = new List<XenServerPatch>();
|
||||
var appliedPatches = h.AppliedPatches();
|
||||
|
@ -193,6 +193,15 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
return;
|
||||
}
|
||||
|
||||
var pool = Helpers.GetPool(host.Connection);
|
||||
if (pool != null && !pool.IsPoolFullyUpgraded) //partially upgraded pool is not supported
|
||||
{
|
||||
row.Enabled = false;
|
||||
row.Cells[3].ToolTipText = Messages.PATCHINGWIZARD_SELECTSERVERPAGE_AUTO_UPDATE_NOT_SUPPORTED_PARTIALLY_UPGRADED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//if there is a host missing from the upgrade sequence
|
||||
if (host.Connection.Cache.Hosts.Any(h => !us.Keys.Contains(h)))
|
||||
{
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -26080,6 +26080,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatic update is not supported on partially upgraded [XenServer] pools..
|
||||
/// </summary>
|
||||
public static string PATCHINGWIZARD_SELECTSERVERPAGE_AUTO_UPDATE_NOT_SUPPORTED_PARTIALLY_UPGRADED {
|
||||
get {
|
||||
return ResourceManager.GetString("PATCHINGWIZARD_SELECTSERVERPAGE_AUTO_UPDATE_NOT_SUPPORTED_PARTIALLY_UPGRADED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot install supplemental packs on this [XenServer] version.
|
||||
/// </summary>
|
||||
|
@ -9015,6 +9015,9 @@ However, there is not enough space to perform the repartitioning, so the current
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_AUTO_UPDATE_NOT_SUPPORTED_HOST_VERSION" xml:space="preserve">
|
||||
<value>Automatic update is not supported on this [XenServer] version</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_AUTO_UPDATE_NOT_SUPPORTED_PARTIALLY_UPGRADED" xml:space="preserve">
|
||||
<value>Automatic update is not supported on partially upgraded [XenServer] pools.</value>
|
||||
</data>
|
||||
<data name="PATCHINGWIZARD_SELECTSERVERPAGE_CANNOT_INSTALL_SUPP_PACKS" xml:space="preserve">
|
||||
<value>Cannot install supplemental packs on this [XenServer] version</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user