From 9359f5d98b671cbd38169aed62cdae38eb7ae2b8 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Fri, 24 Mar 2017 13:53:21 +0000 Subject: [PATCH 1/2] CP-21504: Updates wizard: Automated mode for new versions that are available as updates Signed-off-by: Gabor Apati-Nagy --- XenAdmin/Core/Updates.cs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs index a1805317e..6860f94c0 100644 --- a/XenAdmin/Core/Updates.cs +++ b/XenAdmin/Core/Updates.cs @@ -581,27 +581,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) - { - if (alert.NewServerVersion.MinimalPatches == null) - return null; + uSeq.MinimalPatches = new List(); + uSeq.MinimalPatches.Add(alert.Patch); - 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 (alert.NewServerVersion != null && alert.NewServerVersion.MinimalPatches != null) + { 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; From d29510d5af7ee367ab45a5ebc67dcd989e330250 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Fri, 24 Mar 2017 14:11:06 +0000 Subject: [PATCH 2/2] CP-21504: Updates wizard: Automated mode for new versions that are available as updates Signed-off-by: Gabor Apati-Nagy --- XenAdmin/Core/Updates.cs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs index 6860f94c0..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) @@ -588,15 +598,15 @@ namespace XenAdmin.Core 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 (alert.NewServerVersion != null && alert.NewServerVersion.MinimalPatches != null) + if (updateTheNewVersion && alert.NewServerVersion != null && alert.NewServerVersion.MinimalPatches != null) { uSeq.MinimalPatches.AddRange(alert.NewServerVersion.MinimalPatches); - - conn.Cache.Hosts.ToList().ForEach(h => - uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches) - ); } - + + conn.Cache.Hosts.ToList().ForEach(h => + uSeq[h] = GetUpgradeSequenceForHost(h, uSeq.MinimalPatches) + ); + return uSeq; }