CP-15712: Add Automatic mode (internal parameter)

Removed Contained

Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
Gabor Apati-Nagy 2016-03-16 13:41:10 +00:00
parent 2a474b01d9
commit 25e83b72bf
4 changed files with 7 additions and 23 deletions

View File

@ -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);
}
// by now the patch has either been added to the upgrade sequence or something already contains it among the installed patches
neededPatches.RemoveAt(ii);

View File

@ -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<XenServerPatch>(), new DateTime(2011,4,1).ToString(), "123");
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), 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<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123");
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123");
var alert = new XenServerVersionAlert(ver);
alert.IncludeHosts(new List<Host> { 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<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123");
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), 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<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123");
XenServerVersion ver = new XenServerVersion("1.2.3", "name", true, "http://url", new List<XenServerPatch>(), new List<XenServerPatch>(), new DateTime(2011, 4, 1).ToString(), "123");
var alert = new XenServerVersionAlert(ver);
IUnitTestVerifier validator = new VerifyGetters(alert);

View File

@ -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<XenCenterVersion> 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));
}
}
}

View File

@ -49,7 +49,6 @@ namespace XenAdmin.Core
public readonly List<string> ConflictingPatches;
public readonly List<string> RequiredPatches;
public readonly List<string> 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<string> conflictingPatches, List<string> requiredPatches, List<string> containedPatches)
string patchUrl, string timestamp, string priority, string installationSize, List<string> conflictingPatches, List<string> requiredPatches)
: this(uuid, name, description, guidance, version, url, patchUrl, timestamp, priority, installationSize)
{
ConflictingPatches = conflictingPatches;
RequiredPatches = requiredPatches;
ContainedPatches = containedPatches;
}
public string Uuid