diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs
index a1805317e..7061ef337 100644
--- a/XenAdmin/Core/Updates.cs
+++ b/XenAdmin/Core/Updates.cs
@@ -568,8 +568,18 @@ namespace XenAdmin.Core
}
}
- public static UpgradeSequence GetUpgradeSequence(IXenConnection conn, XenServerPatchAlert alert)
+ ///
+ /// Gets an upgrade sequence that contains a version upgrade, optionally followed by the minimal patches for the new version
+ ///
+ /// Connection for the pool
+ /// The alert that refers the version-update
+ /// Also add the minimum patches for the new version (true) or not (false).
+ ///
+ 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();
+ 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();
- uSeq.MinimalPatches.Add(alert.Patch);
uSeq.MinimalPatches.AddRange(alert.NewServerVersion.MinimalPatches);
-
- List 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;