mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-271864: Add the host name to the precheck problem description for more Problem classes.
Also changed two classes to inherit from the VMProblem class. Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
8b2ab5f79d
commit
20dfd74375
@ -34,40 +34,26 @@ using System.Threading;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Diagnostics.Checks;
|
||||
using XenAdmin.Network;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
{
|
||||
public class AutoStartEnabled : Problem
|
||||
public class AutoStartEnabled : VMProblem
|
||||
{
|
||||
private XenRef<VM> _VMref;
|
||||
private IXenConnection _connection;
|
||||
public AutoStartEnabled(Check check, VM vm)
|
||||
: base(check)
|
||||
{
|
||||
_VMref = new XenRef<VM>(vm);
|
||||
_connection = vm.Connection;
|
||||
}
|
||||
: base(check, vm)
|
||||
{ }
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return string.Format(Messages.AUTOSTART_ENABLED_CHECK_DESCRIPTION, Helpers.GetName(VM).Ellipsise(30)); }
|
||||
get { return string.Format(Messages.AUTOSTART_ENABLED_CHECK_DESCRIPTION, ServerName, Helpers.GetName(VM).Ellipsise(30)); }
|
||||
}
|
||||
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
{
|
||||
cancelled = false;
|
||||
return new DelegatedAsyncAction(_connection, Messages.ACTION_DISABLE_AUTOSTART_ON_VM, string.Format(Messages.ACTION_DISABLING_AUTOSTART_ON_VM, Helpers.GetName(VM)), null, ActionDelegate(false));
|
||||
}
|
||||
|
||||
private VM VM
|
||||
{
|
||||
get
|
||||
{
|
||||
return _connection.Resolve(_VMref);
|
||||
}
|
||||
return new DelegatedAsyncAction(VM.Connection, Messages.ACTION_DISABLE_AUTOSTART_ON_VM, string.Format(Messages.ACTION_DISABLING_AUTOSTART_ON_VM, Helpers.GetName(VM)), null, ActionDelegate(false));
|
||||
}
|
||||
|
||||
public override string HelpMessage
|
||||
@ -75,18 +61,12 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
get { return Messages.DISABLE_NOAMP; }
|
||||
}
|
||||
|
||||
public sealed override string Title
|
||||
{
|
||||
get { return string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, Helpers.GetName(VM).Ellipsise(30)); }
|
||||
}
|
||||
|
||||
private Action<Session> ActionDelegate(bool autostartValue)
|
||||
{
|
||||
return delegate(Session session)
|
||||
{
|
||||
var vm = _connection.Resolve(_VMref);
|
||||
var vmclone = (VM)vm.Clone();
|
||||
vm.Locked = true;
|
||||
var vmclone = (VM)VM.Clone();
|
||||
VM.Locked = true;
|
||||
vmclone.SetAutoPowerOn(autostartValue);
|
||||
try
|
||||
{
|
||||
@ -94,10 +74,10 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
}
|
||||
finally
|
||||
{
|
||||
vm.Locked = false;
|
||||
VM.Locked = false;
|
||||
}
|
||||
int wait = 5000; // wait up to 5 seconds for the cache to be updated
|
||||
while (wait > 0 && vm.GetAutoPowerOn() != autostartValue)
|
||||
while (wait > 0 && VM.GetAutoPowerOn() != autostartValue)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
wait -= 100;
|
||||
@ -108,7 +88,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
public override AsyncAction CreateUnwindChangesAction()
|
||||
{
|
||||
return new DelegatedAsyncAction(
|
||||
_connection,
|
||||
VM.Connection,
|
||||
Messages.ACTION_ENABLE_AUTOSTART_ON_VM,
|
||||
string.Format(Messages.ACTION_ENABLING_AUTOSTART_ON_VM, Helpers.GetName(VM)),
|
||||
null,
|
||||
|
@ -46,7 +46,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return String.Format(Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS, VM.Name()); }
|
||||
get { return String.Format(Messages.UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS, ServerName, VM.Name()); }
|
||||
}
|
||||
|
||||
public override string HelpMessage
|
||||
|
@ -39,14 +39,12 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
{
|
||||
public class LocalCD : VMProblem
|
||||
{
|
||||
private VDI LoadedCD;
|
||||
|
||||
public LocalCD(Check check, VM vm)
|
||||
: base(check, vm) { }
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, VM.Name().Ellipsise(25)); }
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_LOCAL_CD, ServerName, VM.Name().Ellipsise(25)); }
|
||||
}
|
||||
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
@ -54,11 +52,6 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
cancelled = false;
|
||||
VBD cddrive = VM.FindVMCDROM();
|
||||
|
||||
if (cddrive != null)
|
||||
{
|
||||
LoadedCD = VM.Connection.Resolve(cddrive.VDI);
|
||||
}
|
||||
|
||||
return new ChangeVMISOAction(VM.Connection, VM, null, cddrive);
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Diagnostics.Checks;
|
||||
using XenAPI;
|
||||
@ -37,23 +38,15 @@ using XenAPI;
|
||||
|
||||
namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
{
|
||||
public class NoPVDrivers:Problem
|
||||
public class NoPVDrivers: VMProblem
|
||||
{
|
||||
protected readonly VM _vm;
|
||||
|
||||
public NoPVDrivers(Check check, VM vm):base(check)
|
||||
{
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
public override string Title
|
||||
{
|
||||
get { return string.Format(Messages.PROBLEM_VMPROBLEM_TITLE, Helpers.GetName(_vm).Ellipsise(30)); }
|
||||
}
|
||||
public NoPVDrivers(Check check, VM vm)
|
||||
: base(check, vm)
|
||||
{ }
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return String.Format(Messages.UPDATES_WIZARD_NO_TOOLS,_vm.Name()); }
|
||||
get { return String.Format(Messages.UPDATES_WIZARD_NO_TOOLS, ServerName, VM.Name()); }
|
||||
}
|
||||
|
||||
public override string HelpMessage
|
||||
@ -63,5 +56,15 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
return Messages.INSTALL_XENSERVER_TOOLS;
|
||||
}
|
||||
}
|
||||
protected override AsyncAction CreateAction(out bool cancelled)
|
||||
{
|
||||
cancelled = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override AsyncAction CreateUnwindChangesAction()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_OUT_OF_DATE_TOOLS, _vm.Name()); }
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_OUT_OF_DATE_TOOLS, ServerName, VM.Name()); }
|
||||
}
|
||||
|
||||
public override string HelpMessage
|
||||
|
@ -44,7 +44,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_TOOLS_CD, VM.Name()); }
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_TOOLS_CD, ServerName, VM.Name()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return String.Format(Messages.UPDATES_WIZARD_CANNOT_SEE_NETWORK, VM.Name(), Network.Name()); }
|
||||
get { return String.Format(Messages.UPDATES_WIZARD_CANNOT_SEE_NETWORK, ServerName, VM.Name(), Network.Name()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace XenAdmin.Diagnostics.Problems.VMProblem
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_VM_HAS_VGPU, VM.Name()); }
|
||||
get { return string.Format(Messages.UPDATES_WIZARD_VM_HAS_VGPU, ServerName, VM.Name()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
XenModel/Messages.Designer.cs
generated
16
XenModel/Messages.Designer.cs
generated
@ -5588,7 +5588,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VM {0} has autostart enabled.
|
||||
/// Looks up a localized string similar to {0}: VM {1} has autostart enabled.
|
||||
/// </summary>
|
||||
public static string AUTOSTART_ENABLED_CHECK_DESCRIPTION {
|
||||
get {
|
||||
@ -34727,7 +34727,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The VM '{0}' uses the network '{1}', which cannot be seen from all servers..
|
||||
/// Looks up a localized string similar to {0}: The VM '{1}' uses the network '{2}', which cannot be seen from all servers..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_CANNOT_SEE_NETWORK {
|
||||
get {
|
||||
@ -34882,7 +34882,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VM '{0}' has a local CD/DVD in its drive..
|
||||
/// Looks up a localized string similar to {0}: VM '{1}' has a local CD/DVD in its drive..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_LOCAL_CD {
|
||||
get {
|
||||
@ -34972,7 +34972,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The VM {0} does not have [XenServer product] Tools installed..
|
||||
/// Looks up a localized string similar to {0}: The VM {1} does not have [XenServer product] Tools installed..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_NO_TOOLS {
|
||||
get {
|
||||
@ -34999,7 +34999,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The VM {0} cannot be suspended until it has up to date [XenServer product] Tools..
|
||||
/// Looks up a localized string similar to {0}: The VM {1} cannot be suspended until it has up to date [XenServer product] Tools..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_OUT_OF_DATE_TOOLS {
|
||||
get {
|
||||
@ -35244,7 +35244,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VM '{0}' has the tools CD in its drive..
|
||||
/// Looks up a localized string similar to {0}: VM '{1}' has the tools CD in its drive..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_TOOLS_CD {
|
||||
get {
|
||||
@ -35262,7 +35262,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The VM '{0}' has one or more virtual GPUs..
|
||||
/// Looks up a localized string similar to {0}: The VM '{1}' has one or more virtual GPUs..
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_VM_HAS_VGPU {
|
||||
get {
|
||||
@ -35460,7 +35460,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VM '{0}' has invalid vCPU settings..
|
||||
/// Looks up a localized string similar to {0}: VM '{1}' has invalid vCPU settings..
|
||||
/// </summary>
|
||||
public static string UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS {
|
||||
get {
|
||||
|
@ -2039,7 +2039,7 @@ Warning: you must ensure that the SR is not in use by any server not connected t
|
||||
<value>Auto-start on server boot</value>
|
||||
</data>
|
||||
<data name="AUTOSTART_ENABLED_CHECK_DESCRIPTION" xml:space="preserve">
|
||||
<value>VM {0} has autostart enabled</value>
|
||||
<value>{0}: VM {1} has autostart enabled</value>
|
||||
</data>
|
||||
<data name="AVAILABLE" xml:space="preserve">
|
||||
<value>available</value>
|
||||
@ -11978,7 +11978,7 @@ Check your settings and try again.</value>
|
||||
<value>{0}: Cannot migrate VM '{1}' for an unknown reason. See application logs for more details.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_CANNOT_SEE_NETWORK" xml:space="preserve">
|
||||
<value>The VM '{0}' uses the network '{1}', which cannot be seen from all servers.</value>
|
||||
<value>{0}: The VM '{1}' uses the network '{2}', which cannot be seen from all servers.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_CONNECTION_LOST" xml:space="preserve">
|
||||
<value>The connections to your selected servers have been lost. Select alternate servers or reconnect to your selected servers.</value>
|
||||
@ -12031,7 +12031,7 @@ Check your settings and try again.</value>
|
||||
<value>{0}: Check skipped because the server is unreachable.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_LOCAL_CD" xml:space="preserve">
|
||||
<value>VM '{0}' has a local CD/DVD in its drive.</value>
|
||||
<value>{0}: VM '{1}' has a local CD/DVD in its drive.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_LOCAL_STORAGE" xml:space="preserve">
|
||||
<value>{0}: The VM '{1}' uses local storage and cannot be migrated.</value>
|
||||
@ -12067,10 +12067,10 @@ Check your settings and try again.</value>
|
||||
<value>{0}: This server does not need to be rebooted because live patching is used.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_NO_TOOLS" xml:space="preserve">
|
||||
<value>The VM {0} does not have [XenServer product] Tools installed.</value>
|
||||
<value>{0}: The VM {1} does not have [XenServer product] Tools installed.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_OUT_OF_DATE_TOOLS" xml:space="preserve">
|
||||
<value>The VM {0} cannot be suspended until it has up to date [XenServer product] Tools.</value>
|
||||
<value>{0}: The VM {1} cannot be suspended until it has up to date [XenServer product] Tools.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_PAGE1_TOPTEXT" xml:space="preserve">
|
||||
<value>Select the checkboxes for each server you want to update. Select a pool checkbox to select all the available servers in the pool.</value>
|
||||
@ -12153,13 +12153,13 @@ Check your settings and try again.</value>
|
||||
<value>Storage repository '{0}'</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_TOOLS_CD" xml:space="preserve">
|
||||
<value>VM '{0}' has the tools CD in its drive.</value>
|
||||
<value>{0}: VM '{1}' has the tools CD in its drive.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_UPLOADING_UPDATE" xml:space="preserve">
|
||||
<value>Uploading update {0} to {1}...</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_VM_HAS_VGPU" xml:space="preserve">
|
||||
<value>The VM '{0}' has one or more virtual GPUs.</value>
|
||||
<value>{0}: The VM '{1}' has one or more virtual GPUs.</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_WLB_ON_WARNING" xml:space="preserve">
|
||||
<value>{0}: Check skipped because WLB is enabled on pool {1}.</value>
|
||||
@ -12240,7 +12240,7 @@ Note that if RBAC is enabled, only updates which you have privileges to dismiss
|
||||
<value>Shut down all VMs</value>
|
||||
</data>
|
||||
<data name="UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS" xml:space="preserve">
|
||||
<value>VM '{0}' has invalid vCPU settings.</value>
|
||||
<value>{0}: VM '{1}' has invalid vCPU settings.</value>
|
||||
</data>
|
||||
<data name="UPGRADEWIZARD_PROBLEM_INVALID_VCPU_SETTINGS_HELPMESSAGE" xml:space="preserve">
|
||||
<value>Fix vCPU configuration</value>
|
||||
|
Loading…
Reference in New Issue
Block a user