mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
Merge pull request #293 from MihaelaStoica/CA-157501
CA-157501: Fixing inconsistent GPU dialogs in XS "Standard" when compare...
This commit is contained in:
commit
f756339b0e
@ -126,7 +126,7 @@ namespace XenAdmin.Controls
|
||||
if (vgpuType != null)
|
||||
{
|
||||
IsVgpuSubitem = gpuGroup.supported_VGPU_types.Count > 1;
|
||||
IsFractionalVgpu = vgpuType.max_heads != 0;
|
||||
IsFractionalVgpu = !vgpuType.IsPassthrough;
|
||||
if (disabledVGpuTypes != null && disabledVGpuTypes.Select(t => t.opaque_ref).Contains(vgpuType.opaque_ref))
|
||||
IsNotEnabledVgpu = true;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
private void SetCells()
|
||||
{
|
||||
bool isPassThru = VGpuType.max_heads == 0;
|
||||
bool isPassThru = VGpuType.IsPassthrough;
|
||||
|
||||
nameColumn.Value = isPassThru ? Messages.VGPU_PASSTHRU_TOSTRING : VGpuType.model_name;
|
||||
|
||||
|
@ -34,7 +34,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls.DataGridViewEx;
|
||||
using XenAdmin.Network;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Properties;
|
||||
using XenAPI;
|
||||
|
||||
@ -53,6 +53,7 @@ namespace XenAdmin.Controls.GPU
|
||||
this.xenObject = xenObject;
|
||||
pGpuLabel.Text = pGpuList[0].Name;
|
||||
RepopulateAllowedTypes(pGpuList[0]);
|
||||
vGpuCapability = !Helpers.FeatureForbidden(xenObject, Host.RestrictVgpu) && pGpuList[0].HasVGpu;
|
||||
Rebuild(pGpuList);
|
||||
SetupPage();
|
||||
}
|
||||
@ -61,6 +62,8 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
private Dictionary<PGPU, CheckBox> pGpus = new Dictionary<PGPU, CheckBox>();
|
||||
|
||||
private readonly bool vGpuCapability;
|
||||
|
||||
private void Rebuild(List<PGPU> pGpuList)
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
@ -91,7 +94,7 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
// add pGPU shiny bar
|
||||
var gpuShinyBar = new GpuShinyBar();
|
||||
var checkBox = pGpuList.Count > 1 ? new CheckBox() : null;
|
||||
var checkBox = (pGpuList.Count > 1 && vGpuCapability) ? new CheckBox() : null;
|
||||
AddShinyBar(gpuShinyBar, checkBox, ref index);
|
||||
gpuShinyBar.Initialize(pgpu);
|
||||
|
||||
@ -141,8 +144,9 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
private void SetupPage()
|
||||
{
|
||||
multipleSelectionPanel.Visible = (pGpus.Count > 1);
|
||||
multipleSelectionPanel.Visible = (pGpus.Count > 1) && vGpuCapability;
|
||||
editButton.Text = (pGpus.Count > 1) ? Messages.GPU_EDIT_ALLOWED_TYPES_MULTIPLE : Messages.GPU_EDIT_ALLOWED_TYPES_SINGLE;
|
||||
editButton.Visible = vGpuCapability;
|
||||
}
|
||||
|
||||
private GpuShinyBar FindGpuShinyBar(PGPU pGpu)
|
||||
|
@ -112,20 +112,20 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="allowedTypesImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="allowedTypesImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="allowedTypesImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABY
|
||||
CQAAAk1TRnQBSQFMAgEBAgEAARgBAwEYAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CQAAAk1TRnQBSQFMAgEBAgEAASABAwEgAQMBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
@ -167,11 +167,11 @@
|
||||
BAABgAEBAR8BBwQAAYABAgH/AYMEAAHAAeIB/wHDBAAB4QH7Af8B4QQAAfMC/wHhBAAD/wHxBAAL
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="panelWithBorder.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="panelWithBorder.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
@ -187,7 +187,7 @@
|
||||
<data name="allowedTypesLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="allowedTypesLabel.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt</value>
|
||||
</data>
|
||||
@ -200,6 +200,9 @@
|
||||
<data name="allowedTypesLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 0, 3</value>
|
||||
</data>
|
||||
<data name="allowedTypesLabel.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 16</value>
|
||||
</data>
|
||||
<data name="allowedTypesLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>217, 16</value>
|
||||
</data>
|
||||
@ -207,7 +210,7 @@
|
||||
<value>22</value>
|
||||
</data>
|
||||
<data name="allowedTypesLabel.Text" xml:space="preserve">
|
||||
<value>Allowed vGPU types:</value>
|
||||
<value>vGPU types:</value>
|
||||
</data>
|
||||
<data name="allowedTypesLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
@ -239,6 +242,9 @@
|
||||
<data name="pGpuLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 6, 3, 3</value>
|
||||
</data>
|
||||
<data name="pGpuLabel.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 16</value>
|
||||
</data>
|
||||
<data name="pGpuLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>436, 16</value>
|
||||
</data>
|
||||
@ -279,7 +285,7 @@
|
||||
<value>pGpuPictureBox</value>
|
||||
</data>
|
||||
<data name=">>pGpuPictureBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pGpuPictureBox.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
@ -287,7 +293,7 @@
|
||||
<data name=">>pGpuPictureBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<metadata name="ImageColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="ImageColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="ImageColumn.HeaderText" xml:space="preserve">
|
||||
@ -296,7 +302,7 @@
|
||||
<data name="ImageColumn.Width" type="System.Int32, mscorlib">
|
||||
<value>20</value>
|
||||
</data>
|
||||
<metadata name="TextColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="TextColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="TextColumn.HeaderText" xml:space="preserve">
|
||||
@ -363,7 +369,7 @@
|
||||
<value>shinyBarsContainerPanel</value>
|
||||
</data>
|
||||
<data name=">>shinyBarsContainerPanel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>shinyBarsContainerPanel.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
@ -399,7 +405,7 @@
|
||||
<value>editButton</value>
|
||||
</data>
|
||||
<data name=">>editButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>editButton.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
@ -426,7 +432,7 @@
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Parent" xml:space="preserve">
|
||||
<value>panelWithBorder</value>
|
||||
@ -456,7 +462,7 @@
|
||||
<value>clearAllButton</value>
|
||||
</data>
|
||||
<data name=">>clearAllButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>clearAllButton.Parent" xml:space="preserve">
|
||||
<value>multipleSelectionPanel</value>
|
||||
@ -483,7 +489,7 @@
|
||||
<value>selectAllButton</value>
|
||||
</data>
|
||||
<data name=">>selectAllButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>selectAllButton.Parent" xml:space="preserve">
|
||||
<value>multipleSelectionPanel</value>
|
||||
@ -507,7 +513,7 @@
|
||||
<value>multipleSelectionPanel</value>
|
||||
</data>
|
||||
<data name=">>multipleSelectionPanel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>multipleSelectionPanel.Parent" xml:space="preserve">
|
||||
<value>panelWithBorder</value>
|
||||
@ -545,12 +551,12 @@
|
||||
<data name=">>panelWithBorder.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>112</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>112</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
@ -564,24 +570,24 @@
|
||||
<value>allowedTypesImageList</value>
|
||||
</data>
|
||||
<data name=">>allowedTypesImageList.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>ImageColumn.Name" xml:space="preserve">
|
||||
<value>ImageColumn</value>
|
||||
</data>
|
||||
<data name=">>ImageColumn.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewImageColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.DataGridViewImageColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>TextColumn.Name" xml:space="preserve">
|
||||
<value>TextColumn</value>
|
||||
</data>
|
||||
<data name=">>TextColumn.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>GpuRow</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
@ -33,6 +33,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls.Ballooning;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
namespace XenAdmin.Controls.GPU
|
||||
@ -49,6 +50,7 @@ namespace XenAdmin.Controls.GPU
|
||||
private List<VGPU> vGPUs;
|
||||
private Dictionary<VGPU, VM> vms;
|
||||
private long capacity;
|
||||
private long maxCapacity;
|
||||
|
||||
public void Initialize(PGPU pGPU)
|
||||
{
|
||||
@ -60,8 +62,9 @@ namespace XenAdmin.Controls.GPU
|
||||
foreach (VGPU vgpu in vGPUs)
|
||||
vms[vgpu] = vgpu.Connection.Resolve(vgpu.VM);
|
||||
|
||||
capacity = vGPUs.Count > 0 && pGPU.supported_VGPU_max_capacities.ContainsKey(vGPUs[0].type)
|
||||
? pGPU.supported_VGPU_max_capacities[vGPUs[0].type] : 8;
|
||||
maxCapacity = !Helpers.FeatureForbidden(pGPU, Host.RestrictVgpu) && pGPU.HasVGpu ? 8 : 1;
|
||||
capacity = vGPUs.Count > 0 && pGPU.supported_VGPU_max_capacities.ContainsKey(vGPUs[0].type)
|
||||
? pGPU.supported_VGPU_max_capacities[vGPUs[0].type] : maxCapacity;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
@ -73,7 +76,8 @@ namespace XenAdmin.Controls.GPU
|
||||
Rectangle barArea = barRect;
|
||||
|
||||
// Grid
|
||||
DrawGrid(g, barArea, barArea.Width);
|
||||
if (maxCapacity > 1)
|
||||
DrawGrid(g, barArea, barArea.Width);
|
||||
|
||||
double left = barArea.Left;
|
||||
|
||||
@ -81,7 +85,7 @@ namespace XenAdmin.Controls.GPU
|
||||
int i = 0;
|
||||
vGPUs.Sort();
|
||||
|
||||
long segmentLength = barArea.Width / (capacity > 0 ? capacity : 8);
|
||||
long segmentLength = barArea.Width / (capacity > 0 ? capacity : maxCapacity);
|
||||
foreach (VGPU vgpu in vGPUs)
|
||||
{
|
||||
VM vm = vms[vgpu];
|
||||
@ -107,7 +111,7 @@ namespace XenAdmin.Controls.GPU
|
||||
int line_bottom = barArea.Top + barArea.Height / 2;
|
||||
int line_top = barArea.Top - line_height;
|
||||
|
||||
long incr = max / (capacity > 0 ? capacity : 8);
|
||||
long incr = max / (capacity > 0 ? capacity : maxCapacity);
|
||||
|
||||
// Draw the grid
|
||||
using (Pen pen = new Pen(GpuShinyBarColors.Grid))
|
||||
|
@ -207,10 +207,8 @@ namespace XenAdmin.Dialogs
|
||||
|
||||
if (is_pool_or_standalone)
|
||||
{
|
||||
if (Helpers.ClearwaterOrGreater(xenObject.Connection)
|
||||
&& !Helpers.FeatureForbidden(xenObjectCopy, Host.RestrictVgpu)
|
||||
&& Helpers.VgpuCapability(xenObjectCopy.Connection))
|
||||
ShowTab(PoolGpuEditPage = new PoolGpuEditPage());
|
||||
if (Helpers.VGpuCapability(xenObjectCopy.Connection))
|
||||
ShowTab(PoolGpuEditPage = new PoolGpuEditPage());
|
||||
}
|
||||
|
||||
if (is_network)
|
||||
@ -219,7 +217,7 @@ namespace XenAdmin.Dialogs
|
||||
if (is_vm && !wlb_enabled)
|
||||
ShowTab(HomeServerPage = new HomeServerEditPage());
|
||||
|
||||
if (is_hvm)
|
||||
if (is_vm && ((VM)xenObjectCopy).CanHaveGpu)
|
||||
{
|
||||
if (Helpers.BostonOrGreater(xenObject.Connection))
|
||||
{
|
||||
@ -234,7 +232,10 @@ namespace XenAdmin.Dialogs
|
||||
ShowTab(GpuEditPage = new GpuEditPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_hvm)
|
||||
{
|
||||
ShowTab(VMAdvancedEditPage = new VMAdvancedEditPage());
|
||||
}
|
||||
|
||||
|
@ -1294,11 +1294,8 @@ namespace XenAdmin
|
||||
ShowTab(TabPageNICs, !multi && !SearchMode && ((isHostSelected && isHostLive)));
|
||||
|
||||
bool isPoolOrLiveStandaloneHost = isPoolSelected || (isHostSelected && isHostLive && selectionPool == null);
|
||||
bool showGpu = SelectionManager.Selection.All(s => Helpers.ClearwaterOrGreater(s.Connection)) &&
|
||||
!Helpers.FeatureForbidden(SelectionManager.Selection.FirstAsXenObject, Host.RestrictVgpu) &&
|
||||
Helpers.VgpuCapability(selectionConnection);
|
||||
|
||||
ShowTab(TabPageGPU, !multi && !SearchMode && ((isHostSelected && isHostLive) || isPoolOrLiveStandaloneHost) && showGpu);
|
||||
ShowTab(TabPageGPU, !multi && !SearchMode && ((isHostSelected && isHostLive) || isPoolOrLiveStandaloneHost) && Helpers.ClearwaterSp1OrGreater(selectionConnection) && Helpers.GpuCapability(selectionConnection));
|
||||
|
||||
pluginManager.SetSelectedXenObject(SelectionManager.Selection.FirstAsXenObject);
|
||||
|
||||
|
@ -200,7 +200,7 @@ namespace XenAdmin.SettingsPanels
|
||||
{
|
||||
var vgpuGroup = Connection.Resolve(vgpu.GPU_group);
|
||||
|
||||
if (Helpers.FeatureForbidden(Connection, Host.RestrictVgpu))
|
||||
if (Helpers.FeatureForbidden(Connection, Host.RestrictVgpu) || !vm.CanHaveVGpu)
|
||||
currentGpuTuple = new GpuTuple(vgpuGroup, null, null);
|
||||
else
|
||||
{
|
||||
@ -243,7 +243,7 @@ namespace XenAdmin.SettingsPanels
|
||||
Array.Sort(gpu_groups);
|
||||
foreach (GPU_group gpu_group in gpu_groups)
|
||||
{
|
||||
if (Helpers.FeatureForbidden(Connection, Host.RestrictVgpu))
|
||||
if (Helpers.FeatureForbidden(Connection, Host.RestrictVgpu) || !vm.CanHaveVGpu)
|
||||
{
|
||||
comboBoxGpus.Items.Add(new GpuTuple(gpu_group, null, null)); //GPU pass-through item
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls;
|
||||
using XenAdmin.Controls.Common;
|
||||
using XenAdmin.Controls.GPU;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
namespace XenAdmin.TabPages
|
||||
@ -125,13 +127,17 @@ namespace XenAdmin.TabPages
|
||||
int initScroll = pageContainerPanel.VerticalScroll.Value;
|
||||
int top = pageContainerPanel.Padding.Top - initScroll;
|
||||
|
||||
AddRowToPanel(CreateGpuPlacementPolicyPanel(), ref top);
|
||||
if (Helpers.VGpuCapability(xenObject.Connection))
|
||||
AddRowToPanel(CreateGpuPlacementPolicyPanel(), ref top);
|
||||
|
||||
foreach (GpuSettings settings in listSettings)
|
||||
{
|
||||
AddRowToPanel(new GpuRow(xenObject, settingsToPGPUs[settings]), ref top);
|
||||
}
|
||||
|
||||
if (listSettings.Count == 0)
|
||||
AddRowToPanel(CreateNoGpuPanel(), ref top);
|
||||
|
||||
// Remove old controls
|
||||
foreach (Control c in oldControls)
|
||||
{
|
||||
@ -157,6 +163,15 @@ namespace XenAdmin.TabPages
|
||||
};
|
||||
}
|
||||
|
||||
private AutoHeightLabel CreateNoGpuPanel()
|
||||
{
|
||||
return new AutoHeightLabel
|
||||
{
|
||||
Name = "noGpuPanel1",
|
||||
Text = Messages.NO_GPU_ON_SERVER
|
||||
};
|
||||
}
|
||||
|
||||
private void ReLayout()
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
@ -172,7 +187,7 @@ namespace XenAdmin.TabPages
|
||||
}
|
||||
}
|
||||
|
||||
private void AddRowToPanel(UserControl row, ref int top)
|
||||
private void AddRowToPanel(Control row, ref int top)
|
||||
{
|
||||
row.Top = top;
|
||||
row.Left = pageContainerPanel.Padding.Left - pageContainerPanel.HorizontalScroll.Value;
|
||||
|
@ -63,7 +63,7 @@ namespace XenAdmin.Wizards.NewVMWizard
|
||||
|
||||
private Host m_affinity;
|
||||
private bool BlockAffinitySelection = false;
|
||||
private bool vgpuCapability;
|
||||
private bool gpuCapability;
|
||||
|
||||
public AsyncAction Action;
|
||||
|
||||
@ -86,9 +86,6 @@ namespace XenAdmin.Wizards.NewVMWizard
|
||||
page_6b_LunPerVdi = new LunPerVdiNewVMMappingPage { Connection = xenConnection };
|
||||
pageVgpu = new GpuEditPage();
|
||||
|
||||
if (!Helpers.FeatureForbidden(connection, Host.RestrictVgpu))
|
||||
vgpuCapability = Helpers.VgpuCapability(connection);
|
||||
|
||||
#region RBAC Warning Page Checks
|
||||
if (connection.Session.IsLocalSuperuser || Helpers.GetMaster(connection).external_auth_type == Auth.AUTH_TYPE_NONE)
|
||||
{
|
||||
@ -124,7 +121,7 @@ namespace XenAdmin.Wizards.NewVMWizard
|
||||
|
||||
page_RbacWarning.AddPermissionChecks(xenConnection, createCheck, affinityCheck, memCheck);
|
||||
|
||||
if (vgpuCapability)
|
||||
if (Helpers.ClearwaterSp1OrGreater(xenConnection) && Helpers.GpuCapability(xenConnection))
|
||||
{
|
||||
var vgpuCheck = new RBACWarningPage.WizardPermissionCheck(Messages.RBAC_WARNING_VM_WIZARD_GPU);
|
||||
vgpuCheck.ApiCallsToCheck.Add("vgpu.create");
|
||||
@ -180,8 +177,8 @@ namespace XenAdmin.Wizards.NewVMWizard
|
||||
page_8_Finish.StartImmediately,
|
||||
VMOperationCommand.WarningDialogHAInvalidConfig,
|
||||
VMOperationCommand.StartDiagnosisForm,
|
||||
vgpuCapability ? pageVgpu.GpuGroup : null,
|
||||
vgpuCapability ? pageVgpu.VgpuType : null,
|
||||
gpuCapability ? pageVgpu.GpuGroup : null,
|
||||
gpuCapability ? pageVgpu.VgpuType : null,
|
||||
page_5_CpuMem.SelectedCoresPerSocket);
|
||||
Action.RunAsync();
|
||||
|
||||
@ -206,7 +203,8 @@ namespace XenAdmin.Wizards.NewVMWizard
|
||||
page_7_Networking.SelectedTemplate = selectedTemplate;
|
||||
|
||||
RemovePage(pageVgpu);
|
||||
if (vgpuCapability && selectedTemplate.CanHaveVGpu)
|
||||
gpuCapability = Helpers.ClearwaterSp1OrGreater(xenConnection) && Helpers.GpuCapability(xenConnection) && selectedTemplate.CanHaveGpu;
|
||||
if (gpuCapability)
|
||||
AddAfterPage(page_5_CpuMem, pageVgpu);
|
||||
|
||||
RemovePage(page_1b_BiosLocking);
|
||||
|
@ -147,8 +147,7 @@ namespace XenAdmin.Actions.VMActions
|
||||
AppliesTo.Add(HomeServer != null ? HomeServer.opaque_ref : pool_of_one.opaque_ref);
|
||||
|
||||
assignOrRemoveVgpu = (GpuGroup != null && VgpuType != null)
|
||||
|| (!Helpers.FeatureForbidden(Connection, Host.RestrictVgpu)
|
||||
&& Helpers.VgpuCapability(Connection));
|
||||
|| Helpers.GpuCapability(Connection);
|
||||
|
||||
#region RBAC Dependencies
|
||||
|
||||
|
11
XenModel/Messages.Designer.cs
generated
11
XenModel/Messages.Designer.cs
generated
@ -23127,6 +23127,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to There are no GPUs on this server..
|
||||
/// </summary>
|
||||
public static string NO_GPU_ON_SERVER {
|
||||
get {
|
||||
return ResourceManager.GetString("NO_GPU_ON_SERVER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to There are no halted or suspended VMs to export.
|
||||
/// </summary>
|
||||
@ -31744,7 +31753,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Update succesfully uploaded to selected server(s).
|
||||
/// Looks up a localized string similar to Update successfully uploaded to selected server(s).
|
||||
/// </summary>
|
||||
public static string UPLOAD_PATCH_END_DESCRIPTION {
|
||||
get {
|
||||
|
@ -12325,5 +12325,7 @@ Desktop features enabled</value>
|
||||
<value>Eligible for support
|
||||
Desktop+ features enabled</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
<data name="NO_GPU_ON_SERVER" xml:space="preserve">
|
||||
<value>There are no GPUs on this server.</value>
|
||||
</data>
|
||||
</root>
|
@ -487,6 +487,16 @@ namespace XenAdmin.Core
|
||||
HostBuildNumber(host) == CUSTOM_BUILD_NUMBER;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clearwater SP1 has API version 2.1
|
||||
/// </summary>
|
||||
/// <param name="conn">May be null, in which case true is returned.</param>
|
||||
/// <returns></returns>
|
||||
public static bool ClearwaterSp1OrGreater(IXenConnection conn)
|
||||
{
|
||||
return conn == null || conn.Session == null || conn.Session.APIVersion >= API_Version.API_2_1;
|
||||
}
|
||||
|
||||
// CP-3435: Disable Check for Updates in Common Criteria Certification project
|
||||
public static bool CommonCriteriaCertificationRelease
|
||||
{
|
||||
@ -1908,12 +1918,23 @@ namespace XenAdmin.Core
|
||||
return connection.Cache.Hosts.Any(h => h.enabled);
|
||||
}
|
||||
|
||||
public static bool VgpuCapability(IXenConnection connection)
|
||||
public static bool GpuCapability(IXenConnection connection)
|
||||
{
|
||||
return connection != null && connection.Cache.GPU_groups.Any(g => g.PGPUs.Count > 0 && g.supported_VGPU_types.Count > 0);
|
||||
if (FeatureForbidden(connection, Host.RestrictGpu))
|
||||
return false;
|
||||
var pool = GetPoolOfOne(connection);
|
||||
return pool != null && pool.HasGpu;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
public static bool VGpuCapability(IXenConnection connection)
|
||||
{
|
||||
if (FeatureForbidden(connection, Host.RestrictVgpu))
|
||||
return false;
|
||||
var pool = GetPoolOfOne(connection);
|
||||
return pool != null && pool.HasVGpu;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether creation of VLAN 0 is allowed.
|
||||
/// </summary>
|
||||
public static bool VLAN0Allowed(IXenConnection connection)
|
||||
|
@ -29,6 +29,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
|
||||
namespace XenAPI
|
||||
{
|
||||
partial class PGPU
|
||||
@ -41,5 +43,16 @@ namespace XenAPI
|
||||
return pci != null ? pci.device_name : uuid;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Has at least one supported_VGPU_type that is not passthrough
|
||||
/// </summary>
|
||||
public bool HasVGpu
|
||||
{
|
||||
get
|
||||
{
|
||||
var supportedTypes = Connection.ResolveAll(supported_VGPU_types);
|
||||
return supportedTypes.Any(supportedType => !supportedType.IsPassthrough);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -389,6 +389,16 @@ namespace XenAPI
|
||||
{
|
||||
get { return Connection.Cache.Hosts.Sum(h => h.CpuSockets); }
|
||||
}
|
||||
|
||||
public bool HasGpu
|
||||
{
|
||||
get { return Connection.Cache.PGPUs.Length > 0; }
|
||||
}
|
||||
|
||||
public bool HasVGpu
|
||||
{
|
||||
get { return HasGpu && Connection.Cache.PGPUs.Any(pGpu => pGpu.HasVGpu); }
|
||||
}
|
||||
|
||||
#region IEquatable<Pool> Members
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace XenAPI
|
||||
get
|
||||
{
|
||||
var vGPUType = Connection.Resolve(type);
|
||||
return vGPUType == null || vGPUType.max_heads == 0;
|
||||
return vGPUType == null || vGPUType.IsPassthrough;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace XenAPI
|
||||
{
|
||||
get
|
||||
{
|
||||
if (max_heads == 0)
|
||||
if (IsPassthrough)
|
||||
return Messages.VGPU_PASSTHRU_TOSTRING;
|
||||
|
||||
return string.Format(Messages.VGPU_TOSTRING, model_name, Capacity);
|
||||
@ -52,7 +52,7 @@ namespace XenAPI
|
||||
{
|
||||
get
|
||||
{
|
||||
if (max_heads == 0)
|
||||
if (IsPassthrough)
|
||||
return Messages.VGPU_PASSTHRU_TOSTRING;
|
||||
|
||||
var videoRam = framebuffer_size != 0 ? Util.SuperiorSizeString(framebuffer_size, 0): string.Empty;
|
||||
@ -104,6 +104,10 @@ namespace XenAPI
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool IsPassthrough
|
||||
{
|
||||
get { return max_heads == 0; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ namespace XenAPI
|
||||
/// 2a) the allow-gpu-passthrough restriction is absent or
|
||||
/// 2b) the allow-gpu-passthrough restriction is non-zero
|
||||
///</summary>
|
||||
public bool CanHaveVGpu
|
||||
public bool CanHaveGpu
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -476,6 +476,11 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanHaveVGpu
|
||||
{
|
||||
get { return CanHaveGpu; }
|
||||
}
|
||||
|
||||
void set_other_config(string key, string value)
|
||||
{
|
||||
Dictionary<string, string> new_other_config =
|
||||
|
Loading…
Reference in New Issue
Block a user