mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
CP-13786: GetVirtualisationStatus
More small fixes Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
f4cd9bd97c
commit
acbc21597a
@ -50,7 +50,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (vms == null || vms.Count == 0)
|
||||
@ -101,7 +101,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
if (identical)
|
||||
{
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && status.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED_PLURAL;
|
||||
else if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL : Messages.DMC_UNAVAILABLE_NOTOOLS_PLURAL;
|
||||
@ -123,7 +123,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
{
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && status.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED;
|
||||
else if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT : Messages.DMC_UNAVAILABLE_NOTOOLS;
|
||||
|
@ -546,7 +546,7 @@ namespace XenAdmin.Dialogs
|
||||
// if the state is not unknown we have metrics and can show a detailed message.
|
||||
// Otherwise go with the server and just say they aren't installed
|
||||
error = !vm.GetVirtualisationStatus.HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN)
|
||||
? vm.GetVirtualisationWarningMessages()
|
||||
? GetVirtualisationWarningMessages(vm)
|
||||
: Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
break;
|
||||
}
|
||||
@ -554,6 +554,34 @@ namespace XenAdmin.Dialogs
|
||||
Update();
|
||||
}
|
||||
|
||||
public string GetVirtualisationWarningMessages(VM vm)
|
||||
{
|
||||
VM.VirtualisationStatus status = vm.GetVirtualisationStatus;
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
|
||||
|| vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
return "";
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
{
|
||||
VM_guest_metrics guestMetrics = vm.Connection.Resolve(vm.guest_metrics);
|
||||
if (guestMetrics != null
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("major")
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("minor"))
|
||||
{
|
||||
return String.Format(Messages.PV_DRIVERS_OUT_OF_DATE, String.Format("{0}.{1}",
|
||||
guestMetrics.PV_drivers_version["major"],
|
||||
guestMetrics.PV_drivers_version["minor"]));
|
||||
}
|
||||
else
|
||||
return Messages.PV_DRIVERS_OUT_OF_DATE_UNKNOWN_VERSION;
|
||||
}
|
||||
|
||||
return vm.HasNewVirtualisationStates
|
||||
? Messages.VIRTUALIZATION_STATE_VM_INSTALL_MANAGEMENT_AGENT //We display "Install Management Agent" even though I/O drivers are missing in this case
|
||||
: Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
public AsyncAction Solve()
|
||||
{
|
||||
AsyncAction a = null;
|
||||
|
@ -151,8 +151,8 @@ namespace XenAdmin.Dialogs
|
||||
tt = Messages.FIELD_DISABLED;
|
||||
else if (_VM.power_state != vm_power_state.Running)
|
||||
tt = Messages.INFO_QUIESCE_MODE_POWER_STATE.Replace("\\n", "\n");
|
||||
else if (!(_VM.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && _VM.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)))
|
||||
tt = (_VM.HasNewVirtualisationStates ? Messages.INFO_QUIESCE_MODE_NO_IO_MGMNT : Messages.INFO_QUIESCE_MODE_NO_TOOLS).Replace("\\n", "\n");
|
||||
else if (!_VM.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
tt = (_VM.HasNewVirtualisationStates ? Messages.INFO_QUIESCE_MODE_NO_MGMNT : Messages.INFO_QUIESCE_MODE_NO_TOOLS).Replace("\\n", "\n");
|
||||
else
|
||||
tt = Messages.INFO_QUIESCE_MODE.Replace("\\n","\n"); // This says that VSS must be enabled. This is a guess, because we can't tell whether it is or not.
|
||||
toolTip.Show(tt ,pictureBoxQuiesceInfo, 20, 0);
|
||||
|
@ -102,7 +102,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (InstallToolsCommand.CanExecute(vm))
|
||||
{
|
||||
item = new GridStringItem(vm.GetVirtualisationWarningMessages(),
|
||||
item = new GridStringItem(GetVMToolsInstallMessage(vm),
|
||||
HorizontalAlignment.Center,
|
||||
VerticalAlignment.Middle,
|
||||
false,
|
||||
@ -116,7 +116,7 @@ namespace XenAdmin.XenSearch
|
||||
}
|
||||
else
|
||||
{
|
||||
item = new GridStringItem(vm.GetVirtualisationWarningMessages(),
|
||||
item = new GridStringItem(GetVMToolsInstallMessage(vm),
|
||||
HorizontalAlignment.Center,
|
||||
VerticalAlignment.Middle,
|
||||
false,
|
||||
@ -161,6 +161,33 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetVMToolsInstallMessage(VM vm)
|
||||
{
|
||||
VM.VirtualisationStatus status = vm.GetVirtualisationStatus;
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
|
||||
|| vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
// calling function shouldn't send us here if tools are, or might be, present: used to assert here but it can sometimes happen (CA-51460)
|
||||
return "";
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
{
|
||||
VM_guest_metrics guestMetrics = vm.Connection.Resolve(vm.guest_metrics);
|
||||
if (guestMetrics != null
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("major")
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("minor"))
|
||||
{
|
||||
return String.Format(Messages.PV_DRIVERS_OUT_OF_DATE, String.Format("{0}.{1}",
|
||||
guestMetrics.PV_drivers_version["major"],
|
||||
guestMetrics.PV_drivers_version["minor"]));
|
||||
}
|
||||
else
|
||||
return Messages.PV_DRIVERS_OUT_OF_DATE_UNKNOWN_VERSION;
|
||||
}
|
||||
|
||||
return vm.HasNewVirtualisationStates ? Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_NOT_INSTALLED : Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
}
|
||||
}
|
||||
|
||||
public class NameColumn : Column
|
||||
|
@ -188,7 +188,7 @@ namespace XenAdminTests.CommandTests
|
||||
{
|
||||
var curRow = row;//closure
|
||||
VM vm = curSelection.AsXenObjects<VM>().Find(v => v.Name == curRow.Cells[1].Value.ToString());
|
||||
Assert.IsFalse(vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) && vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED), "PV drivers installed on " + vm + " but it couldn't suspend.");
|
||||
Assert.IsFalse(vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED), "PV drivers installed on " + vm + " but it couldn't suspend.");
|
||||
}
|
||||
TestUtils.GetButton(dialog, "btnClose").PerformClick();
|
||||
});
|
||||
|
10
XenModel/Messages.Designer.cs
generated
10
XenModel/Messages.Designer.cs
generated
@ -5968,7 +5968,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You must install the I/O drivers on VM '{0}' before you can activate this virtual disk for the VM..
|
||||
/// Looks up a localized string similar to You must install I/O drivers on VM '{0}' before you can activate this virtual disk for the VM..
|
||||
/// </summary>
|
||||
public static string CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS {
|
||||
get {
|
||||
@ -6067,7 +6067,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You must install the I/O drivers on VM '{0}' before you can deactivate this virtual disk for the VM..
|
||||
/// Looks up a localized string similar to You must install I/O drivers on VM '{0}' before you can deactivate this virtual disk for the VM..
|
||||
/// </summary>
|
||||
public static string CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS {
|
||||
get {
|
||||
@ -18219,11 +18219,11 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Quiesced snapshots need I/O drivers and Management Agent to be installed.
|
||||
/// Looks up a localized string similar to Quiesced snapshots need Management Agent to be installed.
|
||||
/// </summary>
|
||||
public static string INFO_QUIESCE_MODE_NO_IO_MGMNT {
|
||||
public static string INFO_QUIESCE_MODE_NO_MGMNT {
|
||||
get {
|
||||
return ResourceManager.GetString("INFO_QUIESCE_MODE_NO_IO_MGMNT", resourceCulture);
|
||||
return ResourceManager.GetString("INFO_QUIESCE_MODE_NO_MGMNT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2167,7 +2167,7 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
|
||||
<value>It is not possible to activate this virtual disk on VM '{0}' as the VM is not running.</value>
|
||||
</data>
|
||||
<data name="CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS" xml:space="preserve">
|
||||
<value>You must install the I/O drivers on VM '{0}' before you can activate this virtual disk for the VM.</value>
|
||||
<value>You must install I/O drivers on VM '{0}' before you can activate this virtual disk for the VM.</value>
|
||||
</data>
|
||||
<data name="CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS" xml:space="preserve">
|
||||
<value>You must install XenServer Tools on VM '{0}' before you can activate this virtual disk for the VM.</value>
|
||||
@ -2200,7 +2200,7 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
|
||||
<value>This virtual disk is in use and cannot be deactivated.</value>
|
||||
</data>
|
||||
<data name="CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS" xml:space="preserve">
|
||||
<value>You must install the I/O drivers on VM '{0}' before you can deactivate this virtual disk for the VM.</value>
|
||||
<value>You must install I/O drivers on VM '{0}' before you can deactivate this virtual disk for the VM.</value>
|
||||
</data>
|
||||
<data name="CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS" xml:space="preserve">
|
||||
<value>You must install XenServer Tools on VM '{0}' before you can deactivate this virtual disk for the VM.</value>
|
||||
@ -6341,8 +6341,8 @@ Click Configure HA to alter the settings displayed below.</value>
|
||||
<data name="INFO_QUIESCE_MODE" xml:space="preserve">
|
||||
<value>Quiesced snapshots need the VSS service to be enabled on the VM</value>
|
||||
</data>
|
||||
<data name="INFO_QUIESCE_MODE_NO_IO_MGMNT" xml:space="preserve">
|
||||
<value>Quiesced snapshots need I/O drivers and Management Agent to be installed</value>
|
||||
<data name="INFO_QUIESCE_MODE_NO_MGMNT" xml:space="preserve">
|
||||
<value>Quiesced snapshots need Management Agent to be installed</value>
|
||||
</data>
|
||||
<data name="INFO_QUIESCE_MODE_NO_TOOLS" xml:space="preserve">
|
||||
<value>Quiesced snapshots need XenServer Tools to be installed</value>
|
||||
|
@ -712,33 +712,6 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
public string GetVirtualisationWarningMessages()
|
||||
{
|
||||
VirtualisationStatus status = GetVirtualisationStatus;
|
||||
|
||||
if (virtualisation_status.HasFlag(VirtualisationStatus.IO_DRIVERS_INSTALLED) && virtualisation_status.HasFlag(VirtualisationStatus.MANAGEMENT_INSTALLED)
|
||||
|| virtualisation_status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
// calling function shouldn't send us here if tools are, or might be, present: used to assert here but it can sometimes happen (CA-51460)
|
||||
return "";
|
||||
|
||||
if (virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
{
|
||||
VM_guest_metrics guestMetrics = Connection.Resolve(guest_metrics);
|
||||
if (guestMetrics != null
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("major")
|
||||
&& guestMetrics.PV_drivers_version.ContainsKey("minor"))
|
||||
{
|
||||
return String.Format(Messages.PV_DRIVERS_OUT_OF_DATE, String.Format("{0}.{1}",
|
||||
guestMetrics.PV_drivers_version["major"],
|
||||
guestMetrics.PV_drivers_version["minor"]));
|
||||
}
|
||||
else
|
||||
return Messages.PV_DRIVERS_OUT_OF_DATE_UNKNOWN_VERSION;
|
||||
}
|
||||
|
||||
return HasNewVirtualisationStates ? Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_NOT_INSTALLED : Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
private VirtualisationStatus GetVirtualisationStatusOldVM
|
||||
{
|
||||
get
|
||||
|
Loading…
Reference in New Issue
Block a user