CP-39933: Show the names of the PV guests preventing upgrade if any are detected.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2022-05-25 13:31:36 +01:00
parent 1b259814bf
commit fd627e687f
4 changed files with 64 additions and 23 deletions

View File

@ -30,13 +30,14 @@
*/ */
using System.Linq; using System.Linq;
using System.Collections.Generic;
using XenAdmin.Core; using XenAdmin.Core;
using XenAPI; using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems; using XenAdmin.Diagnostics.Problems;
using XenAdmin.Diagnostics.Problems.PoolProblem; using XenAdmin.Diagnostics.Problems.PoolProblem;
using System.Collections.Generic;
using XenAdmin.Diagnostics.Hotfixing;
using XenAdmin.Diagnostics.Problems.HostProblem; using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
namespace XenAdmin.Diagnostics.Checks namespace XenAdmin.Diagnostics.Checks
{ {
@ -45,6 +46,7 @@ namespace XenAdmin.Diagnostics.Checks
private readonly Pool _pool; private readonly Pool _pool;
private readonly bool _manualUpgrade; private readonly bool _manualUpgrade;
private readonly Dictionary<string, string> _installMethodConfig; private readonly Dictionary<string, string> _installMethodConfig;
private List<VM> _pvGuests = new List<VM>();
public PVGuestsCheck(Host coordinator, bool manualUpgrade = false, Dictionary<string, string> installMethodConfig = null) public PVGuestsCheck(Host coordinator, bool manualUpgrade = false, Dictionary<string, string> installMethodConfig = null)
: base(coordinator) : base(coordinator)
@ -59,7 +61,11 @@ namespace XenAdmin.Diagnostics.Checks
if (Helpers.YangtzeOrGreater(Host)) if (Helpers.YangtzeOrGreater(Host))
return false; return false;
if (_pool == null || !_pool.Connection.Cache.VMs.Any(vm => vm.IsPvVm())) if (_pool == null)
return false;
_pvGuests = _pool.Connection.Cache.VMs.Where(vm => vm.IsPvVm()).ToList();
if (_pvGuests.Count <= 0)
return false; return false;
return true; return true;
@ -82,13 +88,13 @@ namespace XenAdmin.Diagnostics.Checks
// we don't know the upgrade version, so add warning // we don't know the upgrade version, so add warning
// (this is the case of the manual upgrade or when the rpu plugin doesn't have the function) // (this is the case of the manual upgrade or when the rpu plugin doesn't have the function)
if (string.IsNullOrEmpty(upgradePlatformVersion)) if (string.IsNullOrEmpty(upgradePlatformVersion))
return new PoolHasPVGuestWarningUrl(this, _pool); return new PoolHasPVGuestWarningUrl(this, _pool, _pvGuests);
if (Helpers.YangtzeOrGreater(upgradePlatformVersion)) if (Helpers.YangtzeOrGreater(upgradePlatformVersion))
return new PoolHasPVGuestProblem(this, _pool); return new PoolHasPVGuestProblem(this, _pool, _pvGuests);
if (Helpers.QuebecOrGreater(upgradePlatformVersion)) if (Helpers.QuebecOrGreater(upgradePlatformVersion))
return new PoolHasPVGuestWarningUrl(this, _pool); return new PoolHasPVGuestWarningUrl(this, _pool, _pvGuests);
return null; return null;
} }

View File

@ -29,55 +29,70 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
using XenAdmin.Diagnostics.Checks; using System.Collections.Generic;
using System; using System.Linq;
using XenAdmin.Core; using XenAdmin.Core;
using XenAdmin.Diagnostics.Checks;
using XenAPI; using XenAPI;
namespace XenAdmin.Diagnostics.Problems.PoolProblem namespace XenAdmin.Diagnostics.Problems.PoolProblem
{ {
class PoolHasPVGuestWarningUrl : WarningWithInformationUrl class PoolHasPVGuestWarningUrl : WarningWithMoreInfo
{ {
private readonly Pool _pool; private readonly Pool _pool;
private readonly List<VM> _pvGuests;
public PoolHasPVGuestWarningUrl(Check check, Pool pool) public PoolHasPVGuestWarningUrl(Check check, Pool pool, List<VM> pvGuests)
: base(check) : base(check)
{ {
_pool = pool; _pool = pool;
_pvGuests = pvGuests;
} }
private string PVGuestCheckUrl => string.Format(InvisibleMessages.PV_GUESTS_CHECK_URL); public override string Title => Check.Description;
public override Uri UriToLaunch => new Uri(PVGuestCheckUrl);
public override string Title => Description;
public override string Description => public override string Description =>
string.Format(Messages.POOL_HAS_PV_GUEST_WARNING, _pool.Name(), string.Format(Messages.POOL_HAS_PV_GUEST_WARNING, _pool.Name(),
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81)); string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81));
public override string HelpMessage => LinkText; public override string HelpMessage => Messages.MORE_INFO;
public override string Message =>
string.Format(Messages.POOL_HAS_PV_GUEST_WARNING_DETAIL,
string.Join(", ", _pvGuests.Select(g => g.Name())),
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81));
public override string LinkText => Messages.LEARN_MORE; public override string LinkText => Messages.LEARN_MORE;
public override string LinkData => InvisibleMessages.PV_GUESTS_CHECK_URL;
} }
class PoolHasPVGuestProblem : ProblemWithInformationUrl class PoolHasPVGuestProblem : ProblemWithMoreInfo
{ {
private readonly Pool _pool; private readonly Pool _pool;
private readonly List<VM> _pvGuests;
public PoolHasPVGuestProblem(Check check, Pool pool) public PoolHasPVGuestProblem(Check check, Pool pool, List<VM> pvGuests)
: base(check) : base(check)
{ {
_pool = pool; _pool = pool;
_pvGuests = pvGuests;
} }
private string PVGuestCheckUrl => string.Format(InvisibleMessages.PV_GUESTS_CHECK_URL); public override string Title => Check.Description;
public override Uri UriToLaunch => new Uri(PVGuestCheckUrl);
public override string Title => Description;
public override string Description => public override string Description =>
string.Format(Messages.POOL_HAS_PV_GUEST_WARNING, _pool.Name(), string.Format(Messages.POOL_HAS_PV_GUEST_WARNING, _pool.Name(),
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81)); string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81));
public override string HelpMessage => LinkText; public override string HelpMessage => Messages.MORE_INFO;
public override string Message =>
string.Format(Messages.POOL_HAS_PV_GUEST_WARNING_DETAIL,
string.Join(", ", _pvGuests.Select(g => g.Name())),
string.Format(Messages.STRING_SPACE_STRING, BrandManager.ProductBrand, BrandManager.ProductVersion81));
public override string LinkText => Messages.LEARN_MORE; public override string LinkText => Messages.LEARN_MORE;
public override string LinkData => InvisibleMessages.PV_GUESTS_CHECK_URL;
} }
} }

View File

@ -31082,7 +31082,7 @@ namespace XenAdmin {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to {0}: Support for paravirtualized (PV) guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems.. /// Looks up a localized string similar to {0}: Support for paravirtualized (PV) guests has been removed in {1}..
/// </summary> /// </summary>
public static string POOL_HAS_PV_GUEST_WARNING { public static string POOL_HAS_PV_GUEST_WARNING {
get { get {
@ -31090,6 +31090,19 @@ namespace XenAdmin {
} }
} }
/// <summary>
/// Looks up a localized string similar to The following VMs are paravirtualized (PV):
///
///{0}
///
///Support for PV guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems..
/// </summary>
public static string POOL_HAS_PV_GUEST_WARNING_DETAIL {
get {
return ResourceManager.GetString("POOL_HAS_PV_GUEST_WARNING_DETAIL", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to The pool is partially licensed. /// Looks up a localized string similar to The pool is partially licensed.
/// </summary> /// </summary>

View File

@ -10787,7 +10787,14 @@ Please reconnect the host and try again</value>
<value>This pool has no shared storage</value> <value>This pool has no shared storage</value>
</data> </data>
<data name="POOL_HAS_PV_GUEST_WARNING" xml:space="preserve"> <data name="POOL_HAS_PV_GUEST_WARNING" xml:space="preserve">
<value>{0}: Support for paravirtualized (PV) guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems.</value> <value>{0}: Support for paravirtualized (PV) guests has been removed in {1}.</value>
</data>
<data name="POOL_HAS_PV_GUEST_WARNING_DETAIL" xml:space="preserve">
<value>The following VMs are paravirtualized (PV):
{0}
Support for PV guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems.</value>
</data> </data>
<data name="POOL_IS_PARTIALLY_LICENSED" xml:space="preserve"> <data name="POOL_IS_PARTIALLY_LICENSED" xml:space="preserve">
<value>The pool is partially licensed</value> <value>The pool is partially licensed</value>