mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
Merge pull request #666 from GaborApatiNagy/master_CP-13786-4
CP-13786: PV drivers onto Windows update: Check all uses of GetVirtualisationStatus
This commit is contained in:
commit
0bf66a113c
@ -85,7 +85,7 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
if (vdi.type == vdi_type.system)
|
||||
return false;
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return false;
|
||||
if (vbd.currently_attached)
|
||||
return false;
|
||||
@ -121,9 +121,9 @@ namespace XenAdmin.Commands
|
||||
if (vdi.type == vdi_type.system)
|
||||
return Messages.TOOLTIP_DEACTIVATE_SYSVDI;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return string.Format(
|
||||
Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS,
|
||||
vm.HasNewVirtualisationStates ? Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS : Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS,
|
||||
Helpers.GetName(vm).Ellipsise(50));
|
||||
|
||||
if (vbd.currently_attached)
|
||||
|
@ -87,7 +87,7 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
if (vdi.type == vdi_type.system && vbd.IsOwner)
|
||||
return false;
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return false;
|
||||
if (!vbd.currently_attached)
|
||||
return false;
|
||||
@ -124,9 +124,9 @@ namespace XenAdmin.Commands
|
||||
if (vdi.type == vdi_type.system && vbd.IsOwner)
|
||||
return Messages.TOOLTIP_DEACTIVATE_SYSVDI;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return string.Format(
|
||||
Messages.CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS,
|
||||
vm.HasNewVirtualisationStates ? Messages.CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS : Messages.CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS,
|
||||
Helpers.GetName(vm).Ellipsise(50));
|
||||
|
||||
if (!vbd.currently_attached)
|
||||
|
@ -289,8 +289,8 @@ namespace XenAdmin.Commands
|
||||
public static bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && !vm.is_a_template && !vm.Locked &&
|
||||
vm.GetVirtualisationStatus != VM.VirtualisationStatus.UNKNOWN &&
|
||||
vm.GetVirtualisationStatus != VM.VirtualisationStatus.OPTIMIZED &&
|
||||
!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.UNKNOWN) &&
|
||||
(!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) || !vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)) &&
|
||||
vm.power_state == vm_power_state.Running
|
||||
&& CanViewVMConsole(vm.Connection);
|
||||
}
|
||||
|
@ -198,18 +198,8 @@ namespace XenAdmin.Commands
|
||||
case vm_power_state.unknown:
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED || vm.virtualisation_status == VM.VirtualisationStatus.UNKNOWN)
|
||||
{
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
}
|
||||
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE)
|
||||
{
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
return GetCantExecuteNoToolsOrDriversReasonCore(item) ?? base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
protected override AsyncAction BuildAction(VM vm)
|
||||
|
@ -179,15 +179,8 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.VM_NOT_SUSPENDED;
|
||||
}
|
||||
else if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED || vm.virtualisation_status == VM.VirtualisationStatus.UNKNOWN)
|
||||
{
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
}
|
||||
else if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE)
|
||||
{
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
return GetCantExecuteNoToolsOrDriversReasonCore(item) ?? base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
protected override AsyncAction BuildAction(VM vm)
|
||||
|
@ -168,17 +168,8 @@ namespace XenAdmin.Commands
|
||||
case vm_power_state.unknown:
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED || vm.virtualisation_status == VM.VirtualisationStatus.UNKNOWN)
|
||||
{
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
}
|
||||
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE)
|
||||
{
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
return GetCantExecuteNoToolsOrDriversReasonCore(item) ?? base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
protected override CommandErrorDialog GetErrorDialogCore(IDictionary<SelectedItem, string> cantExecuteReasons)
|
||||
|
@ -205,15 +205,8 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.VM_ALREADY_SUSPENDED;
|
||||
}
|
||||
else if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED || vm.virtualisation_status == VM.VirtualisationStatus.UNKNOWN)
|
||||
{
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
}
|
||||
else if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE)
|
||||
{
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
return GetCantExecuteNoToolsOrDriversReasonCore(item) ?? base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,5 +162,29 @@ namespace XenAdmin.Commands
|
||||
|
||||
return atLeastOneCanExecute;
|
||||
}
|
||||
|
||||
protected string GetCantExecuteNoToolsOrDriversReasonCore(SelectedItem item)
|
||||
{
|
||||
VM vm = item.XenObject as VM;
|
||||
if (vm == null)
|
||||
return null;
|
||||
|
||||
//trying to guess the reason
|
||||
if (vm.HasNewVirtualisationStates)
|
||||
{
|
||||
if (!vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)) //note: this will also be true when the enum is in Unknown state
|
||||
return Messages.VM_MISSING_IO_DRIVERS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm.virtualisation_status == 0 || vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (vms == null || vms.Count == 0)
|
||||
@ -100,21 +100,15 @@ namespace XenAdmin.Controls.Ballooning
|
||||
}
|
||||
if (identical)
|
||||
{
|
||||
switch (vm0.GetVirtualisationStatus)
|
||||
{
|
||||
case VM.VirtualisationStatus.OPTIMIZED:
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED_PLURAL;
|
||||
break;
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED:
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTOOLS_PLURAL;
|
||||
break;
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE:
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_OLDTOOLS_PLURAL;
|
||||
break;
|
||||
default: // VM.VirtualisationStatus.UNKNOWN
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_VMS;
|
||||
break;
|
||||
}
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
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;
|
||||
else if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_OLDTOOLS_PLURAL;
|
||||
else
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_VMS;
|
||||
}
|
||||
else
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_VMS;
|
||||
@ -127,21 +121,17 @@ namespace XenAdmin.Controls.Ballooning
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (vm0.GetVirtualisationStatus)
|
||||
{
|
||||
case VM.VirtualisationStatus.OPTIMIZED:
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED;
|
||||
break;
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED:
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTOOLS;
|
||||
break;
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE:
|
||||
else if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT : Messages.DMC_UNAVAILABLE_NOTOOLS;
|
||||
else if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_OLDTOOLS;
|
||||
break;
|
||||
default: // VM.VirtualisationStatus.UNKNOWN
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_VM;
|
||||
break;
|
||||
}
|
||||
else
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_VM;
|
||||
|
||||
linkInstallTools.Visible = InstallToolsCommand.CanExecute(vm0);
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
// So "good" VMs are ones which are halted, or running with known virtualisation status.
|
||||
editButton.Visible =
|
||||
(null == vms.Find(vm => !(vm.power_state == vm_power_state.Halted ||
|
||||
vm.power_state == vm_power_state.Running && vm.virtualisation_status != VM.VirtualisationStatus.UNKNOWN)));
|
||||
vm.power_state == vm_power_state.Running && !vm.virtualisation_status.HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN))));
|
||||
|
||||
// Shiny bar
|
||||
vmShinyBar.Initialize(vm0, vms.Count > 1, CalcMemoryUsed(), false);
|
||||
|
@ -433,16 +433,16 @@ namespace XenAdmin.Controls.NetworkingTab
|
||||
if (vm.power_state == vm_power_state.Suspended)
|
||||
{
|
||||
RemoveButtonContainer.SetToolTip(Messages.TOOLTIP_REMOVE_NETWORK_SUSPENDED);
|
||||
EditButtonContainer.SetToolTip(Messages.TOOLTIP_EDIT_NETWORK_TOOLS);
|
||||
EditButtonContainer.SetToolTip(vm.HasNewVirtualisationStates ? Messages.TOOLTIP_EDIT_NETWORK_IO_DRIVERS : Messages.TOOLTIP_EDIT_NETWORK_TOOLS);
|
||||
toolTipContainerActivateToggle.SetToolTip(vif.currently_attached
|
||||
? Messages.TOOLTIP_DEACTIVATE_VIF_SUSPENDED : Messages.TOOLTIP_ACTIVATE_VIF_SUSPENDED);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm.power_state == vm_power_state.Running && vm.GetVirtualisationStatus != XenAPI.VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (vm.power_state == vm_power_state.Running && !vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
{
|
||||
RemoveButtonContainer.SetToolTip(Messages.TOOLTIP_REMOVE_NETWORK_TOOLS);
|
||||
EditButtonContainer.SetToolTip(Messages.TOOLTIP_EDIT_NETWORK_TOOLS);
|
||||
RemoveButtonContainer.SetToolTip(vm.HasNewVirtualisationStates ? Messages.TOOLTIP_REMOVE_NETWORK_IO_DRIVERS : Messages.TOOLTIP_REMOVE_NETWORK_TOOLS);
|
||||
EditButtonContainer.SetToolTip(vm.HasNewVirtualisationStates ? Messages.TOOLTIP_EDIT_NETWORK_IO_DRIVERS : Messages.TOOLTIP_EDIT_NETWORK_TOOLS);
|
||||
toolTipContainerActivateToggle.SetToolTip(vif.currently_attached
|
||||
? Messages.TOOLTIP_DEACTIVATE_VIF_TOOLS : Messages.TOOLTIP_ACTIVATE_VIF_TOOLS);
|
||||
}
|
||||
|
12
XenAdmin/Dialogs/EvacuateHostDialog.Designer.cs
generated
12
XenAdmin/Dialogs/EvacuateHostDialog.Designer.cs
generated
@ -44,10 +44,10 @@ namespace XenAdmin.Dialogs
|
||||
this.labelMasterBlurb = new System.Windows.Forms.Label();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.dataGridViewVms = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx();
|
||||
this.lableWLBEnabled = new System.Windows.Forms.Label();
|
||||
this.columnImage = new System.Windows.Forms.DataGridViewImageColumn();
|
||||
this.columnVm = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.columnAction = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lableWLBEnabled = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewVms)).BeginInit();
|
||||
@ -164,11 +164,6 @@ namespace XenAdmin.Dialogs
|
||||
this.dataGridViewVms.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewVms_CellMouseClick);
|
||||
this.dataGridViewVms.CellMouseMove += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewVms_CellMouseMove);
|
||||
//
|
||||
// lableWLBEnabled
|
||||
//
|
||||
resources.ApplyResources(this.lableWLBEnabled, "lableWLBEnabled");
|
||||
this.lableWLBEnabled.Name = "lableWLBEnabled";
|
||||
//
|
||||
// columnImage
|
||||
//
|
||||
this.columnImage.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
@ -196,6 +191,11 @@ namespace XenAdmin.Dialogs
|
||||
resources.ApplyResources(this.columnAction, "columnAction");
|
||||
this.columnAction.Name = "columnAction";
|
||||
//
|
||||
// lableWLBEnabled
|
||||
//
|
||||
resources.ApplyResources(this.lableWLBEnabled, "lableWLBEnabled");
|
||||
this.lableWLBEnabled.Name = "lableWLBEnabled";
|
||||
//
|
||||
// EvacuateHostDialog
|
||||
//
|
||||
this.AcceptButton = this.EvacuateButton;
|
||||
|
@ -539,13 +539,13 @@ namespace XenAdmin.Dialogs
|
||||
break;
|
||||
|
||||
case Solution.InstallPVDrivers:
|
||||
error = String.Format(Messages.EVACUATE_HOST_INSTALL_TOOLS_PROMPT, message);
|
||||
error = String.Format(vm.HasNewVirtualisationStates ? Messages.EVACUATE_HOST_INSTALL_MGMNT_PROMPT : Messages.EVACUATE_HOST_INSTALL_TOOLS_PROMPT, message);
|
||||
break;
|
||||
|
||||
case Solution.InstallPVDriversNoSolution:
|
||||
// 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 != VM.VirtualisationStatus.UNKNOWN
|
||||
error = !vm.GetVirtualisationStatus.HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN)
|
||||
? vm.GetVirtualisationWarningMessages()
|
||||
: Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
break;
|
||||
|
@ -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.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
tt = 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);
|
||||
@ -184,8 +184,8 @@ namespace XenAdmin.Dialogs
|
||||
tt = Messages.INFO_DISKMEMORY_MODE_POWER_STATE.Replace("\\n", "\n");
|
||||
else if (_VM.HasVGPUs)
|
||||
tt = Messages.INFO_DISKMEMORY_MODE_GPU.Replace("\\n", "\n");
|
||||
else if (_VM.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
tt = Messages.INFO_DISKMEMORY_MODE_NO_TOOLS.Replace("\\n", "\n");
|
||||
else if (!_VM.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
tt = (_VM.HasNewVirtualisationStates ? Messages.INFO_DISKMEMORY_MODE_NO_IO_DRIVERS : Messages.INFO_DISKMEMORY_MODE_NO_TOOLS).Replace("\\n", "\n");
|
||||
else
|
||||
tt = Messages.INFO_DISKMEMORY_MODE_MISC.Replace("\\n", "\n");
|
||||
toolTip.Show(tt, CheckpointInfoPictureBox, 20, 0);
|
||||
|
@ -380,7 +380,7 @@ namespace XenAdmin.SettingsPanels
|
||||
foreach (VIF v in network.Connection.ResolveAll<VIF>(network.VIFs))
|
||||
{
|
||||
VM vm = network.Connection.Resolve<VM>(v.VM);
|
||||
if (vm.power_state != vm_power_state.Running || vm.GetVirtualisationStatus == VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (vm.power_state != vm_power_state.Running || vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
continue;
|
||||
|
||||
runningVMsWithoutTools = true;
|
||||
|
@ -1356,7 +1356,7 @@ namespace XenAdmin.TabPages
|
||||
bool canInstallManagementAgentOnly = InstallToolsCommand.CanExecute(vm) && isIoOptimized && !isManagementAgentInstalled;
|
||||
//canInstallIoDriversOnly is missing - management agent communicates with XS using the I/O drivers
|
||||
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.UNKNOWN)
|
||||
if (vm.virtualisation_status.HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN))
|
||||
{
|
||||
s.AddEntry(FriendlyName("VM.VirtualizationState"), vm.VirtualisationStatusString);
|
||||
}
|
||||
@ -1434,8 +1434,7 @@ namespace XenAdmin.TabPages
|
||||
//for everything else (All VMs on pre-Dundee hosts & All non-Windows VMs on any host)
|
||||
else
|
||||
{
|
||||
if (vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED
|
||||
|| vm.virtualisation_status == VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE)
|
||||
if (vm.virtualisation_status == 0 || vm.virtualisation_status.HasFlag(XenAPI.VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
{
|
||||
if (InstallToolsCommand.CanExecute(vm))
|
||||
{
|
||||
|
@ -94,8 +94,8 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
VM.VirtualisationStatus status = vm.virtualisation_status;
|
||||
if (vm.power_state != vm_power_state.Running ||
|
||||
status == VM.VirtualisationStatus.OPTIMIZED ||
|
||||
status == VM.VirtualisationStatus.UNKNOWN)
|
||||
status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED ) ||
|
||||
status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
return false;
|
||||
|
||||
if (property == PropertyNames.memoryValue)
|
||||
|
@ -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 == VM.VirtualisationStatus.OPTIMIZED, "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();
|
||||
});
|
||||
|
@ -302,8 +302,8 @@ namespace XenAdminTests.TabsAndMenus
|
||||
protected static bool HasTools(VM vm)
|
||||
{
|
||||
return !vm.is_a_template && vm.IsRunning&&
|
||||
vm.virtualisation_status != VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED &&
|
||||
vm.virtualisation_status != VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
vm.virtualisation_status != 0 &&
|
||||
!vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE);
|
||||
}
|
||||
|
||||
protected static bool NoTools(VM vm)
|
||||
|
99
XenModel/Messages.Designer.cs
generated
99
XenModel/Messages.Designer.cs
generated
@ -5986,6 +5986,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
return ResourceManager.GetString("CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You must install XenServer Tools on VM '{0}' before you can activate this virtual disk for the VM..
|
||||
/// </summary>
|
||||
@ -6076,6 +6085,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
return ResourceManager.GetString("CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to You must install XenServer Tools on VM '{0}' before you can deactivate this virtual disk for the VM..
|
||||
/// </summary>
|
||||
@ -10842,6 +10860,24 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A memory range cannot be set because I/O drivers are not installed on this VM..
|
||||
/// </summary>
|
||||
public static string DMC_UNAVAILABLE_NO_IO_NO_MGMNT {
|
||||
get {
|
||||
return ResourceManager.GetString("DMC_UNAVAILABLE_NO_IO_NO_MGMNT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A memory range cannot be set because I/O drivers are not installed on these VMs..
|
||||
/// </summary>
|
||||
public static string DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL {
|
||||
get {
|
||||
return ResourceManager.GetString("DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A memory range cannot be set because XenServer Tools are not installed on this VM..
|
||||
/// </summary>
|
||||
@ -13564,6 +13600,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} Install Management Agent.
|
||||
/// </summary>
|
||||
public static string EVACUATE_HOST_INSTALL_MGMNT_PROMPT {
|
||||
get {
|
||||
return ResourceManager.GetString("EVACUATE_HOST_INSTALL_MGMNT_PROMPT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} Install XenServer Tools.
|
||||
/// </summary>
|
||||
@ -18165,6 +18210,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disk and memory snapshots need I/O drivers to be installed.
|
||||
/// </summary>
|
||||
public static string INFO_DISKMEMORY_MODE_NO_IO_DRIVERS {
|
||||
get {
|
||||
return ResourceManager.GetString("INFO_DISKMEMORY_MODE_NO_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disk and memory snapshots need XenServer Tools to be installed.
|
||||
/// </summary>
|
||||
@ -18192,6 +18246,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Quiesced snapshots need Management Agent to be installed.
|
||||
/// </summary>
|
||||
public static string INFO_QUIESCE_MODE_NO_MGMNT {
|
||||
get {
|
||||
return ResourceManager.GetString("INFO_QUIESCE_MODE_NO_MGMNT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Quiesced snapshots need XenServer Tools to be installed.
|
||||
/// </summary>
|
||||
@ -32012,6 +32075,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I/O drivers must be installed to edit a network on a running VM.
|
||||
/// </summary>
|
||||
public static string TOOLTIP_EDIT_NETWORK_IO_DRIVERS {
|
||||
get {
|
||||
return ResourceManager.GetString("TOOLTIP_EDIT_NETWORK_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to XenServer Tools must be installed to edit a network on a running VM.
|
||||
/// </summary>
|
||||
@ -32048,6 +32120,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I/O drivers must be installed to remove a network on a running VM.
|
||||
/// </summary>
|
||||
public static string TOOLTIP_REMOVE_NETWORK_IO_DRIVERS {
|
||||
get {
|
||||
return ResourceManager.GetString("TOOLTIP_REMOVE_NETWORK_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Networks cannot be removed from suspended VMs.
|
||||
/// </summary>
|
||||
@ -34406,6 +34487,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I/O drivers and Management Agent installed.
|
||||
/// </summary>
|
||||
public static string VIRTUALIZATION_STATE_VM_IO_DRIVERS_AND_MANAGEMENT_AGENT_INSTALLED {
|
||||
get {
|
||||
return ResourceManager.GetString("VIRTUALIZATION_STATE_VM_IO_DRIVERS_AND_MANAGEMENT_AGENT_INSTALLED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I/O not optimized.
|
||||
/// </summary>
|
||||
@ -34730,6 +34820,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to I/O drivers not installed..
|
||||
/// </summary>
|
||||
public static string VM_MISSING_IO_DRIVERS {
|
||||
get {
|
||||
return ResourceManager.GetString("VM_MISSING_IO_DRIVERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A&ctivate.
|
||||
/// </summary>
|
||||
|
@ -2173,6 +2173,9 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
|
||||
<data name="CANNOT_ACTIVATE_VD_VM_HALTED" xml:space="preserve">
|
||||
<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 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>
|
||||
</data>
|
||||
@ -2203,6 +2206,9 @@ Deleting this bond will disrupt traffic through the secondary interface on the b
|
||||
<data name="CANNOT_DEACTIVATE_VDI_IN_USE" xml:space="preserve">
|
||||
<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 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>
|
||||
</data>
|
||||
@ -3857,6 +3863,12 @@ This will also delete its subfolders.</value>
|
||||
<data name="DMC_UNAVAILABLE_NOTSUPPORTED_PLURAL" xml:space="preserve">
|
||||
<value>A memory range cannot be set because the operating systems on these VMs do not support it.</value>
|
||||
</data>
|
||||
<data name="DMC_UNAVAILABLE_NO_IO_NO_MGMNT" xml:space="preserve">
|
||||
<value>A memory range cannot be set because I/O drivers are not installed on this VM.</value>
|
||||
</data>
|
||||
<data name="DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL" xml:space="preserve">
|
||||
<value>A memory range cannot be set because I/O drivers are not installed on these VMs.</value>
|
||||
</data>
|
||||
<data name="DMC_UNAVAILABLE_OLDTOOLS" xml:space="preserve">
|
||||
<value>A memory range cannot be set because XenServer Tools are out of date on this VM.</value>
|
||||
</data>
|
||||
@ -4761,6 +4773,9 @@ Would you like to eject these ISOs before continuing?</value>
|
||||
<data name="EVACUATE_HOST_EJECT_CD_PROMPT" xml:space="preserve">
|
||||
<value>{0} Eject the CD</value>
|
||||
</data>
|
||||
<data name="EVACUATE_HOST_INSTALL_MGMNT_PROMPT" xml:space="preserve">
|
||||
<value>{0} Install Management Agent</value>
|
||||
</data>
|
||||
<data name="EVACUATE_HOST_INSTALL_TOOLS_PROMPT" xml:space="preserve">
|
||||
<value>{0} Install XenServer Tools</value>
|
||||
</data>
|
||||
@ -6321,6 +6336,9 @@ Click Configure HA to alter the settings displayed below.</value>
|
||||
<data name="INFO_DISKMEMORY_MODE_MISC" xml:space="preserve">
|
||||
<value>Disk and memory snapshots are not currently available for this VM</value>
|
||||
</data>
|
||||
<data name="INFO_DISKMEMORY_MODE_NO_IO_DRIVERS" xml:space="preserve">
|
||||
<value>Disk and memory snapshots need I/O drivers to be installed</value>
|
||||
</data>
|
||||
<data name="INFO_DISKMEMORY_MODE_NO_TOOLS" xml:space="preserve">
|
||||
<value>Disk and memory snapshots need XenServer Tools to be installed</value>
|
||||
</data>
|
||||
@ -6333,6 +6351,9 @@ 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_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>
|
||||
</data>
|
||||
@ -11088,6 +11109,9 @@ Refer to the "XenServer Administrator's Guide" for instructions on how to manual
|
||||
<data name="TOOLTIP_DETACH_VDI_NEED_TOOLS" xml:space="preserve">
|
||||
<value>Disks cannot be removed from running VMs without XenServer Tools installed</value>
|
||||
</data>
|
||||
<data name="TOOLTIP_EDIT_NETWORK_IO_DRIVERS" xml:space="preserve">
|
||||
<value>I/O drivers must be installed to edit a network on a running VM</value>
|
||||
</data>
|
||||
<data name="TOOLTIP_EDIT_NETWORK_TOOLS" xml:space="preserve">
|
||||
<value>XenServer Tools must be installed to edit a network on a running VM</value>
|
||||
</data>
|
||||
@ -11100,6 +11124,9 @@ Refer to the "XenServer Administrator's Guide" for instructions on how to manual
|
||||
<data name="TOOLTIP_NICS_PER_BOND_LIMIT" xml:space="preserve">
|
||||
<value>XenServer only supports {0} NICs per Bond.</value>
|
||||
</data>
|
||||
<data name="TOOLTIP_REMOVE_NETWORK_IO_DRIVERS" xml:space="preserve">
|
||||
<value>I/O drivers must be installed to remove a network on a running VM</value>
|
||||
</data>
|
||||
<data name="TOOLTIP_REMOVE_NETWORK_SUSPENDED" xml:space="preserve">
|
||||
<value>Networks cannot be removed from suspended VMs</value>
|
||||
</data>
|
||||
@ -11904,6 +11931,9 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
|
||||
<data name="VIRTUALIZATION_STATE_VM_INSTALL_MANAGEMENT_AGENT" xml:space="preserve">
|
||||
<value>Install Management Agent</value>
|
||||
</data>
|
||||
<data name="VIRTUALIZATION_STATE_VM_IO_DRIVERS_AND_MANAGEMENT_AGENT_INSTALLED" xml:space="preserve">
|
||||
<value>I/O drivers and Management Agent installed</value>
|
||||
</data>
|
||||
<data name="VIRTUALIZATION_STATE_VM_IO_NOT_OPTIMIZED" xml:space="preserve">
|
||||
<value>I/O not optimized</value>
|
||||
</data>
|
||||
@ -12036,6 +12066,9 @@ To learn more about the XenServer Dynamic Workload Balancing feature or to start
|
||||
<data name="VM_LIVE_CHANGES_NOT_SUPPORTED_TITLE" xml:space="preserve">
|
||||
<value>VM General Changes</value>
|
||||
</data>
|
||||
<data name="VM_MISSING_IO_DRIVERS" xml:space="preserve">
|
||||
<value>I/O drivers not installed.</value>
|
||||
</data>
|
||||
<data name="VM_NETWORK_TAB_ACTIVATE_BUTTON_LABEL" xml:space="preserve">
|
||||
<value>A&ctivate</value>
|
||||
</data>
|
||||
|
@ -683,7 +683,13 @@ namespace XenAPI
|
||||
private Timer VirtualizationTimer = null;
|
||||
|
||||
[Flags]
|
||||
public enum VirtualisationStatus { UNKNOWN = 0, OPTIMIZED = 1, PV_DRIVERS_NOT_INSTALLED = 2, PV_DRIVERS_OUT_OF_DATE = 4 };
|
||||
public enum VirtualisationStatus
|
||||
{
|
||||
UNKNOWN = 1,
|
||||
PV_DRIVERS_OUT_OF_DATE = 2,
|
||||
IO_DRIVERS_INSTALLED = 4,
|
||||
MANAGEMENT_INSTALLED = 8,
|
||||
};
|
||||
|
||||
public VirtualisationStatus virtualisation_status
|
||||
{
|
||||
@ -710,14 +716,13 @@ namespace XenAPI
|
||||
{
|
||||
VirtualisationStatus status = GetVirtualisationStatus;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case VirtualisationStatus.OPTIMIZED:
|
||||
case VirtualisationStatus.UNKNOWN:
|
||||
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 "";
|
||||
|
||||
case VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE:
|
||||
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")
|
||||
@ -729,12 +734,91 @@ namespace XenAPI
|
||||
}
|
||||
else
|
||||
return Messages.PV_DRIVERS_OUT_OF_DATE_UNKNOWN_VERSION;
|
||||
}
|
||||
|
||||
default: // VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED:
|
||||
return Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
return HasNewVirtualisationStates ? Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_NOT_INSTALLED : Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
}
|
||||
|
||||
private VirtualisationStatus GetVirtualisationStatusOldVM
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(!HasNewVirtualisationStates);
|
||||
|
||||
VM_guest_metrics vm_guest_metrics = Connection.Resolve(guest_metrics);
|
||||
|
||||
if ((DateTime.UtcNow - BodgeStartupTime).TotalMinutes < 2)
|
||||
{
|
||||
// check to see if the metrics object has appeared, if so cancel the timer, no need to notify the property changed as this should be picked up on vm_guest_metrics being created.
|
||||
if (vm_guest_metrics != null && vm_guest_metrics.PV_drivers_installed)
|
||||
{
|
||||
if (vm_guest_metrics.PV_drivers_up_to_date)
|
||||
return VirtualisationStatus.IO_DRIVERS_INSTALLED | VirtualisationStatus.MANAGEMENT_INSTALLED;
|
||||
else
|
||||
return VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
}
|
||||
|
||||
return VirtualisationStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
if (vm_guest_metrics == null || !vm_guest_metrics.PV_drivers_installed)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (!vm_guest_metrics.PV_drivers_up_to_date)
|
||||
{
|
||||
return VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return VirtualisationStatus.IO_DRIVERS_INSTALLED | VirtualisationStatus.MANAGEMENT_INSTALLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private VirtualisationStatus GetVirtualisationStatusNewVM
|
||||
{
|
||||
get
|
||||
{
|
||||
Debug.Assert(HasNewVirtualisationStates);
|
||||
|
||||
var flags = HasRDP ? VirtualisationStatus.MANAGEMENT_INSTALLED : 0;
|
||||
|
||||
var vm_guest_metrics = Connection.Resolve(guest_metrics);
|
||||
if (vm_guest_metrics != null && vm_guest_metrics.storage_paths_optimized && vm_guest_metrics.network_paths_optimized)
|
||||
flags |= VirtualisationStatus.IO_DRIVERS_INSTALLED;
|
||||
|
||||
if ((DateTime.UtcNow - BodgeStartupTime).TotalMinutes < 2)
|
||||
{
|
||||
if (flags.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return flags;
|
||||
|
||||
return VirtualisationStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Virtualization Status of the VM
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Following states are expected:
|
||||
///
|
||||
/// For Non-Windows VMs and for Windows VMs pre-Dundee:
|
||||
/// 0 = Not installed
|
||||
/// 1 = Unknown
|
||||
/// 2 = Out of date
|
||||
/// 12 = Tools installed (Optimized)
|
||||
///
|
||||
/// For Windows VMs on Dundee or higher:
|
||||
/// 0 = Not installed
|
||||
/// 1 = Unknown
|
||||
/// 4 = I/O Optimized
|
||||
/// 12 = I/O and Management installed
|
||||
/// </remarks>
|
||||
public VirtualisationStatus GetVirtualisationStatus
|
||||
{
|
||||
get
|
||||
@ -748,38 +832,24 @@ namespace XenAPI
|
||||
return VirtualisationStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
VM_guest_metrics vm_guest_metrics = Connection.Resolve(guest_metrics);
|
||||
|
||||
if ((DateTime.UtcNow - BodgeStartupTime).TotalMinutes < 2)
|
||||
{
|
||||
// check to see if the metrics object has appeared, if so cancel the timer, no need to notify the property changed as this should be picked up on vm_guest_metrics being created.
|
||||
if (vm_guest_metrics != null && vm_guest_metrics.PV_drivers_installed)
|
||||
{
|
||||
if (vm_guest_metrics.PV_drivers_up_to_date)
|
||||
return VirtualisationStatus.OPTIMIZED;
|
||||
else
|
||||
return VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
}
|
||||
|
||||
return VirtualisationStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
if (vm_guest_metrics == null || !vm_guest_metrics.PV_drivers_installed)
|
||||
{
|
||||
return VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED;
|
||||
}
|
||||
else if (!vm_guest_metrics.PV_drivers_up_to_date)
|
||||
{
|
||||
return VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return VirtualisationStatus.OPTIMIZED;
|
||||
}
|
||||
|
||||
return HasNewVirtualisationStates ? GetVirtualisationStatusNewVM : GetVirtualisationStatusOldVM;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is this a Windows VM on Dundee or higher host?
|
||||
/// We need to know this, because for those VMs virtualization status is defined differently.
|
||||
/// This does not mean new(ly created) VM
|
||||
/// </summary>
|
||||
public bool HasNewVirtualisationStates
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsWindows && XenAdmin.Core.Helpers.DundeeOrGreater(Connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Does this VM support ballooning? I.e., are tools installed, on a ballonable OS?
|
||||
/// Doesn't check for Midnight Ride or licensing constraints.
|
||||
@ -1461,17 +1531,25 @@ namespace XenAPI
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (virtualisation_status)
|
||||
if (virtualisation_status.HasFlag(VirtualisationStatus.IO_DRIVERS_INSTALLED | VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
{
|
||||
case VM.VirtualisationStatus.OPTIMIZED:
|
||||
if (!HasNewVirtualisationStates)
|
||||
return string.Format(Messages.VIRTUALIZATION_OPTIMIZED, VirtualisationVersion);
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE:
|
||||
return string.Format(Messages.VIRTUALIZATION_OUT_OF_DATE, VirtualisationVersion);
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED:
|
||||
return Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
default:
|
||||
return Messages.VIRTUALIZATION_UNKNOWN;
|
||||
else
|
||||
return Messages.VIRTUALIZATION_STATE_VM_IO_DRIVERS_AND_MANAGEMENT_AGENT_INSTALLED;
|
||||
}
|
||||
|
||||
if (virtualisation_status.HasFlag(VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
return string.Format(Messages.VIRTUALIZATION_OUT_OF_DATE, VirtualisationVersion);
|
||||
|
||||
if (virtualisation_status == 0)
|
||||
return Messages.PV_DRIVERS_NOT_INSTALLED;
|
||||
|
||||
if (virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
|
||||
&& !virtualisation_status.HasFlag(VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
return Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_NOT_INSTALLED;
|
||||
|
||||
return Messages.VIRTUALIZATION_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,11 +230,14 @@ namespace XenAdmin.XenSearch
|
||||
foreach (SR.SRTypes type in Enum.GetValues(typeof(SR.SRTypes)))
|
||||
SRType_i18n[SR.getFriendlyTypeName(type)] = type;
|
||||
|
||||
VirtualisationStatus_i18n[Messages.OPTIMIZED] = VM.VirtualisationStatus.OPTIMIZED;
|
||||
VirtualisationStatus_i18n[Messages.PV_DRIVERS_NOT_INSTALLED] = VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED;
|
||||
VirtualisationStatus_i18n[Messages.PV_DRIVERS_NOT_INSTALLED] = 0;
|
||||
VirtualisationStatus_i18n[Messages.OUT_OF_DATE] = VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE;
|
||||
VirtualisationStatus_i18n[Messages.UNKNOWN] = VM.VirtualisationStatus.UNKNOWN;
|
||||
VirtualisationStatus_i18n[Messages.VIRTUALIZATION_STATE_VM_IO_OPTIMIZED] = VM.VirtualisationStatus.IO_DRIVERS_INSTALLED;
|
||||
VirtualisationStatus_i18n[Messages.VIRTUALIZATION_STATE_VM_MANAGEMENT_AGENT_INSTALLED] = VM.VirtualisationStatus.MANAGEMENT_INSTALLED;
|
||||
VirtualisationStatus_i18n[Messages.VIRTUALIZATION_STATE_VM_IO_DRIVERS_AND_MANAGEMENT_AGENT_INSTALLED] = VM.VirtualisationStatus.IO_DRIVERS_INSTALLED | VM.VirtualisationStatus.MANAGEMENT_INSTALLED;
|
||||
|
||||
|
||||
ObjectTypes_i18n[Messages.VMS] = ObjectTypes.VM;
|
||||
ObjectTypes_i18n[Messages.XENSERVER_TEMPLATES] = ObjectTypes.DefaultTemplate;
|
||||
ObjectTypes_i18n[Messages.CUSTOM_TEMPLATES] = ObjectTypes.UserTemplate;
|
||||
@ -646,7 +649,7 @@ namespace XenAdmin.XenSearch
|
||||
vm.power_state != vm_power_state.Running)
|
||||
return null;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return null;
|
||||
|
||||
return PropertyAccessorHelper.vmMemoryUsageString(vm);
|
||||
@ -680,7 +683,7 @@ namespace XenAdmin.XenSearch
|
||||
vm.power_state != vm_power_state.Running)
|
||||
return null;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return null;
|
||||
|
||||
return PropertyAccessorHelper.vmMemoryUsageRank(vm);
|
||||
@ -714,7 +717,7 @@ namespace XenAdmin.XenSearch
|
||||
vm.power_state != vm_power_state.Running)
|
||||
return null;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return null;
|
||||
|
||||
return PropertyAccessorHelper.vmMemoryUsageValue(vm);
|
||||
@ -748,7 +751,7 @@ namespace XenAdmin.XenSearch
|
||||
vm.power_state != vm_power_state.Running)
|
||||
return null;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return null;
|
||||
|
||||
return PropertyAccessorHelper.vmNetworkUsageString(vm);
|
||||
@ -775,7 +778,7 @@ namespace XenAdmin.XenSearch
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return null;
|
||||
|
||||
if (vm.virtualisation_status != VM.VirtualisationStatus.OPTIMIZED)
|
||||
if (!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
return null;
|
||||
|
||||
return PropertyAccessorHelper.vmDiskUsageString(vm);
|
||||
@ -1370,20 +1373,13 @@ namespace XenAdmin.XenSearch
|
||||
case PropertyNames.virtualisation_status:
|
||||
return (ImageDelegate<VM.VirtualisationStatus>)delegate(VM.VirtualisationStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case VM.VirtualisationStatus.OPTIMIZED:
|
||||
return Icons.ToolInstalled;
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED | VM.VirtualisationStatus.MANAGEMENT_INSTALLED))
|
||||
return Icons.ToolInstalled;
|
||||
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_NOT_INSTALLED:
|
||||
return Icons.ToolsNotInstalled;
|
||||
if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
return Icons.ToolsOutOfDate;
|
||||
|
||||
case VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE:
|
||||
return Icons.ToolsOutOfDate;
|
||||
|
||||
default:
|
||||
return Icons.ToolsNotInstalled;
|
||||
}
|
||||
return Icons.ToolsNotInstalled;
|
||||
};
|
||||
|
||||
case PropertyNames.sr_type:
|
||||
|
@ -36,6 +36,7 @@ using XenAdmin.Model;
|
||||
using XenAPI;
|
||||
using System.Xml;
|
||||
using XenAdmin.Core;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
namespace XenAdmin.XenSearch
|
||||
@ -277,7 +278,9 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
public override String GetGroupName(Object group)
|
||||
{
|
||||
if (!(group is T) || i18ns == null)
|
||||
Debug.Assert(i18ns == null || i18ns.ContainsKey((T)group)); //if i18ns is specified, it should contain an item for the group
|
||||
|
||||
if (!(group is T) || i18ns == null || !i18ns.ContainsKey((T)group))
|
||||
return base.GetGroupName(group);
|
||||
|
||||
return i18ns[(T)group];
|
||||
|
@ -815,7 +815,7 @@ namespace XenAdmin.XenSearch
|
||||
new GroupQuery(
|
||||
new QueryFilter[] {
|
||||
new EnumPropertyQuery<vm_power_state>(PropertyNames.power_state, vm_power_state.Running, true),
|
||||
new EnumPropertyQuery<VM.VirtualisationStatus>(PropertyNames.virtualisation_status, VM.VirtualisationStatus.OPTIMIZED, false)
|
||||
new EnumPropertyQuery<VM.VirtualisationStatus>(PropertyNames.virtualisation_status, VM.VirtualisationStatus.IO_DRIVERS_INSTALLED | VM.VirtualisationStatus.MANAGEMENT_INSTALLED, false)
|
||||
}, GroupQuery.GroupQueryType.And)),
|
||||
new PropertyGrouping<VM.VirtualisationStatus>(PropertyNames.virtualisation_status, null),
|
||||
false, Messages.DEFAULT_SEARCH_VMS_WO_XS_TOOLS, "dead-beef-1234-vmswotools", true
|
||||
|
Loading…
Reference in New Issue
Block a user