Skip to content

Commit

Permalink
Removed old and compacted remaining RPU hotfix code:
Browse files Browse the repository at this point in the history
- Removed obsolete MultipleHotfix class.
- Merged HotfixFactory, SingleHotfix, and Hotfix classes to one RpuHotfix class.
- Create a dedicated action for applying RPU hotfixes.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
  • Loading branch information
kc284 committed Nov 3, 2023
1 parent 9743c46 commit 53bfc7b
Show file tree
Hide file tree
Showing 22 changed files with 237 additions and 395 deletions.
11 changes: 5 additions & 6 deletions XenAdmin/Diagnostics/Checks/CertificateKeyLengthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
*/

using System;
using XenAdmin.Core;
using XenAPI;
using XenAdmin.Diagnostics.Problems;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;

namespace XenAdmin.Diagnostics.Checks
{
Expand All @@ -62,8 +62,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
61 changes: 30 additions & 31 deletions XenAdmin/Diagnostics/Checks/HostHasHotfixCheck.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Actions.Updates;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
Expand All @@ -45,9 +45,8 @@ public HostHasHotfixCheck(Host host)

protected override Problem RunHostCheck()
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfix(this, Host);
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfix(this, Host, hotfix);

return null;
}
Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/HostMemoryPostUpgradeCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
Expand All @@ -54,8 +54,7 @@ public HostMemoryPostUpgradeCheck(Host host, Dictionary<string, string> installM

protected override Problem RunHostCheck()
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);

if (TryGetDom0MemoryPostUpgrade(out var dom0MemoryPostUpgrade))
Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PVGuestsCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
using System;
using System.Linq;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.PoolProblem;
using XenAdmin.Diagnostics.Problems.HostProblem;
Expand Down Expand Up @@ -97,8 +97,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PoolContainerManagementCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.PoolProblem;
Expand Down Expand Up @@ -85,8 +85,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PoolHasDeprecatedSrsCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System.Collections.Generic;
using System.Linq;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.PoolProblem;
Expand Down Expand Up @@ -59,8 +59,7 @@ protected override Problem RunHostCheck()
{
if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PoolLegacySslCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.PoolProblem;
Expand Down Expand Up @@ -94,8 +94,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PowerOniLoCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
Expand Down Expand Up @@ -89,8 +89,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/PrepareToUpgradeCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

using System;
using System.Collections.Generic;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Actions.Updates;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
Expand All @@ -54,8 +54,7 @@ public PrepareToUpgradeCheck(Host host, Dictionary<string, string> installMethod

protected override Problem RunHostCheck()
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);

try
Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/SafeToUpgradeCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
Expand All @@ -54,8 +54,7 @@ public SafeToUpgradeCheck(Host host, Dictionary<string, string> installMethodCon

protected override Problem RunHostCheck()
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);

try
Expand Down
7 changes: 3 additions & 4 deletions XenAdmin/Diagnostics/Checks/UpgradeRequiresEUA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAPI;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.UtilityProblem;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;

namespace XenAdmin.Diagnostics.Checks
{
Expand Down Expand Up @@ -103,8 +103,7 @@ protected override Problem RunCheck()

foreach (var host in Hosts)
{
var hotfix = HotfixFactory.Hotfix(host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(host))
if (RpuHotfix.Exists(host, out var hotfix) && hotfix.ShouldBeAppliedTo(host))
return new HostDoesNotHaveHotfixWarning(this, host);
}

Expand Down
5 changes: 2 additions & 3 deletions XenAdmin/Diagnostics/Checks/VSwitchControllerCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

using System;
using System.Collections.Generic;
using XenAdmin.Actions.Updates;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAdmin.Diagnostics.Problems.PoolProblem;
Expand Down Expand Up @@ -91,8 +91,7 @@ protected override Problem RunHostCheck()

if (!_manualUpgrade)
{
var hotfix = HotfixFactory.Hotfix(Host);
if (hotfix != null && hotfix.ShouldBeAppliedTo(Host))
if (RpuHotfix.Exists(Host, out var hotfix) && hotfix.ShouldBeAppliedTo(Host))
return new HostDoesNotHaveHotfixWarning(this, Host);
}

Expand Down
43 changes: 0 additions & 43 deletions XenAdmin/Diagnostics/Hotfixing/Hotfix.cs

This file was deleted.

Loading

0 comments on commit 53bfc7b

Please sign in to comment.