mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-12-19 23:16:02 +01:00
Merge pull request #1513 from GaborApatiNagy/REQ-411_2
CP-21504: Updates wizard: Automated mode for new versions that are av…
This commit is contained in:
commit
ab89a26171
@ -568,8 +568,18 @@ namespace XenAdmin.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn, XenServerPatchAlert alert)
|
||||
/// <summary>
|
||||
/// Gets an upgrade sequence that contains a version upgrade, optionally followed by the minimal patches for the new version
|
||||
/// </summary>
|
||||
/// <param name="conn">Connection for the pool</param>
|
||||
/// <param name="alert">The alert that refers the version-update</param>
|
||||
/// <param name="updateTheNewVersion">Also add the minimum patches for the new version (true) or not (false).</param>
|
||||
/// <returns></returns>
|
||||
public static UpgradeSequence GetUpgradeSequence(IXenConnection conn, XenServerPatchAlert alert, bool updateTheNewVersion)
|
||||
{
|
||||
Debug.Assert(conn != null);
|
||||
Debug.Assert(alert != null);
|
||||
|
||||
var uSeq = new UpgradeSequence();
|
||||
|
||||
if (XenServerVersions == null)
|
||||
@ -581,27 +591,23 @@ namespace XenAdmin.Core
|
||||
|
||||
var version = GetCommonServerVersionOfHostsInAConnection(conn, XenServerVersions);
|
||||
|
||||
// the pool has to be homogeneous
|
||||
if (version != null)
|
||||
{
|
||||
//if it's a version updgrade the min sequence will be this patch (the upgrade) and the min patches for the new version
|
||||
if (alert.NewServerVersion != null)
|
||||
uSeq.MinimalPatches = new List<XenServerPatch>();
|
||||
uSeq.MinimalPatches.Add(alert.Patch);
|
||||
|
||||
// if it's a version updgrade the min sequence will be this patch (the upgrade) and the min patches for the new version
|
||||
if (updateTheNewVersion && alert.NewServerVersion != null && alert.NewServerVersion.MinimalPatches != null)
|
||||
{
|
||||
if (alert.NewServerVersion.MinimalPatches == null)
|
||||
return null;
|
||||
|
||||
uSeq.MinimalPatches = new List<XenServerPatch>();
|
||||
uSeq.MinimalPatches.Add(alert.Patch);
|
||||
uSeq.MinimalPatches.AddRange(alert.NewServerVersion.MinimalPatches);
|
||||
|
||||
List<Host> hosts = conn.Cache.Hosts.ToList();
|
||||
|
||||
foreach (Host h in hosts)
|
||||
{
|
||||
uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches);
|
||||
}
|
||||
|
||||
return uSeq;
|
||||
}
|
||||
|
||||
conn.Cache.Hosts.ToList().ForEach(h =>
|
||||
uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches)
|
||||
);
|
||||
|
||||
return uSeq;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user