From 25e83b72bf4a687280265e245698193a2222a870 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Wed, 16 Mar 2016 13:41:10 +0000 Subject: [PATCH] CP-15712: Add Automatic mode (internal parameter) Removed Contained Signed-off-by: Gabor Apati-Nagy --- XenAdmin/Core/Updates.cs | 13 +------------ .../AlertTests/XenServerUpdateAlertTests.cs | 8 ++++---- .../Actions/Updates/DownloadUpdatesXmlAction.cs | 5 +---- XenModel/Actions/Updates/XenServerPatch.cs | 4 +--- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs index 43c2060f4..e20143278 100644 --- a/XenAdmin/Core/Updates.cs +++ b/XenAdmin/Core/Updates.cs @@ -468,22 +468,11 @@ namespace XenAdmin.Core //the required-patch has already been applied || (appliedPatches.Count != 0 && appliedPatches.Any(ap => ap.uuid == rp)) - - //a patch that contains the required-patch is already in the update sequence - || sequence.Any(useqp => useqp.ContainedPatches != null && useqp.ContainedPatches.Any(useqpc => useqpc == rp)) - - //a patch that contains the required-patch has already been applied - || appliedPatches.Any(applp => allPatches.Any(p1 => p1.Uuid == applp.uuid && p1.ContainedPatches != null && p1.ContainedPatches.Any(p1cp => p1cp == rp))) ) ) { // this patch can be added to the upgrade sequence now - - // however it will only be added if nothing is already installed on the host that contains this patch - if (!appliedPatches.Any(applp => allPatches.Any(p1 => p1.Uuid == applp.uuid && p1.ContainedPatches != null && p1.ContainedPatches.Any(p1cp => p1cp == p.Uuid)))) - { - sequence.Add(p); - } + sequence.Add(p); // by now the patch has either been added to the upgrade sequence or something already contains it among the installed patches neededPatches.RemoveAt(ii); diff --git a/XenAdminTests/UnitTests/AlertTests/XenServerUpdateAlertTests.cs b/XenAdminTests/UnitTests/AlertTests/XenServerUpdateAlertTests.cs index 262a77446..d64b446cf 100644 --- a/XenAdminTests/UnitTests/AlertTests/XenServerUpdateAlertTests.cs +++ b/XenAdminTests/UnitTests/AlertTests/XenServerUpdateAlertTests.cs @@ -55,7 +55,7 @@ namespace XenAdminTests.UnitTests.AlertTests [Test] public void TestAlertWithConnectionAndHosts() { - XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new DateTime(2011,4,1).ToString(), "123"); + XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new List(), new DateTime(2011, 4, 1).ToString(), "123"); var alert = new XenServerVersionAlert(ver); alert.IncludeConnection(connA.Object); alert.IncludeConnection(connB.Object); @@ -83,7 +83,7 @@ namespace XenAdminTests.UnitTests.AlertTests [Test] public void TestAlertWithHostsAndNoConnection() { - XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new DateTime(2011, 4, 1).ToString(), "123"); + XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new List(), new DateTime(2011, 4, 1).ToString(), "123"); var alert = new XenServerVersionAlert(ver); alert.IncludeHosts(new List { hostA.Object, hostB.Object }); @@ -109,7 +109,7 @@ namespace XenAdminTests.UnitTests.AlertTests [Test] public void TestAlertWithConnectionAndNoHosts() { - XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new DateTime(2011, 4, 1).ToString(), "123"); + XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new List(), new DateTime(2011, 4, 1).ToString(), "123"); var alert = new XenServerVersionAlert(ver); alert.IncludeConnection(connA.Object); alert.IncludeConnection(connB.Object); @@ -136,7 +136,7 @@ namespace XenAdminTests.UnitTests.AlertTests [Test] public void TestAlertWithNoConnectionAndNoHosts() { - XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new DateTime(2011, 4, 1).ToString(), "123"); + XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List(), new List(), new DateTime(2011, 4, 1).ToString(), "123"); var alert = new XenServerVersionAlert(ver); IUnitTestVerifier validator = new VerifyGetters(alert); diff --git a/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs b/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs index deab6c3c7..b90501fed 100644 --- a/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs +++ b/XenModel/Actions/Updates/DownloadUpdatesXmlAction.cs @@ -48,10 +48,8 @@ namespace XenAdmin.Actions private const string PatchesNode = "patches"; private const string ConflictingPatchesNode = "conflictingpatches"; private const string RequiredPatchesNode = "requiredpatches"; - private const string ContainedPatchesNode = "containedpatches"; private const string ConflictingPatchNode = "conflictingpatch"; private const string RequiredPatchNode = "requiredpatch"; - private const string ContainedPatchNode = "containedpatch"; public List XenCenterVersions { get; private set; } @@ -184,10 +182,9 @@ namespace XenAdmin.Actions var conflictingPatches = GetPatchDependencies(version, ConflictingPatchesNode, ConflictingPatchNode); var requiredPatches = GetPatchDependencies(version, RequiredPatchesNode, RequiredPatchNode); - var containedPatches = GetPatchDependencies(version, ContainedPatchesNode, ContainedPatchNode); XenServerPatches.Add(new XenServerPatch(uuid, name, description, guidance, patchVersion, url, - patchUrl, timestamp, priority, installationSize, conflictingPatches, requiredPatches, containedPatches)); + patchUrl, timestamp, priority, installationSize, conflictingPatches, requiredPatches)); } } } diff --git a/XenModel/Actions/Updates/XenServerPatch.cs b/XenModel/Actions/Updates/XenServerPatch.cs index 720dbf3ef..ba1d02a0b 100644 --- a/XenModel/Actions/Updates/XenServerPatch.cs +++ b/XenModel/Actions/Updates/XenServerPatch.cs @@ -49,7 +49,6 @@ namespace XenAdmin.Core public readonly List ConflictingPatches; public readonly List RequiredPatches; - public readonly List ContainedPatches; private const int DEFAULT_PRIORITY = 2; @@ -73,12 +72,11 @@ namespace XenAdmin.Core } public XenServerPatch(string uuid, string name, string description, string guidance, string version, string url, - string patchUrl, string timestamp, string priority, string installationSize, List conflictingPatches, List requiredPatches, List containedPatches) + string patchUrl, string timestamp, string priority, string installationSize, List conflictingPatches, List requiredPatches) : this(uuid, name, description, guidance, version, url, patchUrl, timestamp, priority, installationSize) { ConflictingPatches = conflictingPatches; RequiredPatches = requiredPatches; - ContainedPatches = containedPatches; } public string Uuid