mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-6085: Per-pool overview of vGPUs (PR-1675)
# HG changeset patch # User Mihaela Stoica <Mihaela.Stoica@citrix.com> # Date 1383045574 0 # Tue Oct 29 11:19:34 2013 +0000 # Node ID 35673b51503006bbbb1e6647b1e0eb1938bd72ef # Parent bb05d6e143d7199359da1f555250d3a4ee126a5c Overview tab completely redesigned and shown only on pool and standalone hosts. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
64bfe07e78
commit
8c89f0f04f
211
XenAdmin/Controls/GPU/GpuRow.Designer.cs
generated
211
XenAdmin/Controls/GPU/GpuRow.Designer.cs
generated
@ -31,102 +31,102 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GpuRow));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
|
||||
this.panel = new XenAdmin.Controls.PanelWithBorder();
|
||||
this.allowedTypesImageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.panelWithBorder = new XenAdmin.Controls.PanelWithBorder();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.autoHeightLabel1 = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.pGPULabel = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.editPlacementPolicyButton = new System.Windows.Forms.Button();
|
||||
this.dataGridViewEx1 = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx();
|
||||
this.allowedTypesLabel = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.pGpuLabel = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.pGpuPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.allowedTypesGrid = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx();
|
||||
this.ImageColumn = new System.Windows.Forms.DataGridViewImageColumn();
|
||||
this.TextColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.gpuShinyBar1 = new XenAdmin.Controls.GPU.GpuShinyBar();
|
||||
this.panel.SuspendLayout();
|
||||
this.shinyBarsContainerPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.editButton = new System.Windows.Forms.Button();
|
||||
this.multipleSelectionPanel = new System.Windows.Forms.Panel();
|
||||
this.editSelectedGpusButton = new System.Windows.Forms.Button();
|
||||
this.clearAllButton = new System.Windows.Forms.Button();
|
||||
this.selectAllButton = new System.Windows.Forms.Button();
|
||||
this.panelWithBorder.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewEx1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pGpuPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.allowedTypesGrid)).BeginInit();
|
||||
this.multipleSelectionPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// imageList1
|
||||
// allowedTypesImageList
|
||||
//
|
||||
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
|
||||
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imageList1.Images.SetKeyName(0, "000_Abort_h32bit_16.png");
|
||||
this.imageList1.Images.SetKeyName(1, "000_Tick_h32bit_16.png");
|
||||
this.allowedTypesImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("allowedTypesImageList.ImageStream")));
|
||||
this.allowedTypesImageList.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.allowedTypesImageList.Images.SetKeyName(0, "000_Abort_h32bit_16.png");
|
||||
this.allowedTypesImageList.Images.SetKeyName(1, "000_Tick_h32bit_16.png");
|
||||
//
|
||||
// panel
|
||||
// panelWithBorder
|
||||
//
|
||||
resources.ApplyResources(this.panel, "panel");
|
||||
this.panel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panel.Controls.Add(this.tableLayoutPanel1);
|
||||
this.panel.Name = "panel";
|
||||
resources.ApplyResources(this.panelWithBorder, "panelWithBorder");
|
||||
this.panelWithBorder.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panelWithBorder.Controls.Add(this.tableLayoutPanel1);
|
||||
this.panelWithBorder.Controls.Add(this.multipleSelectionPanel);
|
||||
this.panelWithBorder.Name = "panelWithBorder";
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1");
|
||||
this.tableLayoutPanel1.Controls.Add(this.autoHeightLabel1, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.pGPULabel, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.pictureBox1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.editPlacementPolicyButton, 2, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.dataGridViewEx1, 2, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.gpuShinyBar1, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.allowedTypesLabel, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.pGpuLabel, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.pGpuPictureBox, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.allowedTypesGrid, 2, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.shinyBarsContainerPanel, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.editButton, 2, 2);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
//
|
||||
// autoHeightLabel1
|
||||
// allowedTypesLabel
|
||||
//
|
||||
resources.ApplyResources(this.autoHeightLabel1, "autoHeightLabel1");
|
||||
this.autoHeightLabel1.AutoEllipsis = true;
|
||||
this.autoHeightLabel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.autoHeightLabel1.MinimumSize = new System.Drawing.Size(0, 16);
|
||||
this.autoHeightLabel1.Name = "autoHeightLabel1";
|
||||
resources.ApplyResources(this.allowedTypesLabel, "allowedTypesLabel");
|
||||
this.allowedTypesLabel.AutoEllipsis = true;
|
||||
this.allowedTypesLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.allowedTypesLabel.MinimumSize = new System.Drawing.Size(0, 16);
|
||||
this.allowedTypesLabel.Name = "allowedTypesLabel";
|
||||
//
|
||||
// pGPULabel
|
||||
// pGpuLabel
|
||||
//
|
||||
resources.ApplyResources(this.pGPULabel, "pGPULabel");
|
||||
this.pGPULabel.AutoEllipsis = true;
|
||||
this.pGPULabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pGPULabel.MinimumSize = new System.Drawing.Size(0, 16);
|
||||
this.pGPULabel.Name = "pGPULabel";
|
||||
resources.ApplyResources(this.pGpuLabel, "pGpuLabel");
|
||||
this.pGpuLabel.AutoEllipsis = true;
|
||||
this.pGpuLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pGpuLabel.MinimumSize = new System.Drawing.Size(0, 16);
|
||||
this.pGpuLabel.Name = "pGpuLabel";
|
||||
//
|
||||
// pictureBox1
|
||||
// pGpuPictureBox
|
||||
//
|
||||
this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_GetMemoryInfo_h32bit_16;
|
||||
resources.ApplyResources(this.pictureBox1, "pictureBox1");
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pGpuPictureBox.Image = global::XenAdmin.Properties.Resources._000_GetMemoryInfo_h32bit_16;
|
||||
resources.ApplyResources(this.pGpuPictureBox, "pGpuPictureBox");
|
||||
this.pGpuPictureBox.Name = "pGpuPictureBox";
|
||||
this.pGpuPictureBox.TabStop = false;
|
||||
//
|
||||
// editPlacementPolicyButton
|
||||
// allowedTypesGrid
|
||||
//
|
||||
this.editPlacementPolicyButton.BackColor = System.Drawing.Color.Transparent;
|
||||
resources.ApplyResources(this.editPlacementPolicyButton, "editPlacementPolicyButton");
|
||||
this.editPlacementPolicyButton.Name = "editPlacementPolicyButton";
|
||||
this.editPlacementPolicyButton.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// dataGridViewEx1
|
||||
//
|
||||
this.dataGridViewEx1.AllowUserToResizeColumns = false;
|
||||
this.dataGridViewEx1.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.dataGridViewEx1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.dataGridViewEx1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
this.dataGridViewEx1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
|
||||
this.dataGridViewEx1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridViewEx1.ColumnHeadersVisible = false;
|
||||
this.dataGridViewEx1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.allowedTypesGrid.AllowUserToResizeColumns = false;
|
||||
this.allowedTypesGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.allowedTypesGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
this.allowedTypesGrid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
|
||||
this.allowedTypesGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.allowedTypesGrid.ColumnHeadersVisible = false;
|
||||
this.allowedTypesGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ImageColumn,
|
||||
this.TextColumn});
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Transparent;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dataGridViewEx1.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dataGridViewEx1.HideSelection = true;
|
||||
resources.ApplyResources(this.dataGridViewEx1, "dataGridViewEx1");
|
||||
this.dataGridViewEx1.Name = "dataGridViewEx1";
|
||||
this.dataGridViewEx1.ReadOnly = true;
|
||||
this.allowedTypesGrid.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
resources.ApplyResources(this.allowedTypesGrid, "allowedTypesGrid");
|
||||
this.allowedTypesGrid.GridColor = System.Drawing.SystemColors.Control;
|
||||
this.allowedTypesGrid.HideSelection = true;
|
||||
this.allowedTypesGrid.Name = "allowedTypesGrid";
|
||||
this.allowedTypesGrid.ReadOnly = true;
|
||||
this.allowedTypesGrid.TabStop = false;
|
||||
//
|
||||
// ImageColumn
|
||||
//
|
||||
@ -146,38 +146,85 @@
|
||||
this.TextColumn.ReadOnly = true;
|
||||
this.TextColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
|
||||
//
|
||||
// gpuShinyBar1
|
||||
// shinyBarsContainerPanel
|
||||
//
|
||||
resources.ApplyResources(this.gpuShinyBar1, "gpuShinyBar1");
|
||||
this.gpuShinyBar1.Name = "gpuShinyBar1";
|
||||
resources.ApplyResources(this.shinyBarsContainerPanel, "shinyBarsContainerPanel");
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.shinyBarsContainerPanel, 2);
|
||||
this.shinyBarsContainerPanel.Name = "shinyBarsContainerPanel";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.shinyBarsContainerPanel, 2);
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
this.editButton.BackColor = System.Drawing.Color.Transparent;
|
||||
resources.ApplyResources(this.editButton, "editButton");
|
||||
this.editButton.Name = "editButton";
|
||||
this.editButton.UseVisualStyleBackColor = false;
|
||||
this.editButton.Click += new System.EventHandler(this.editButton_Click);
|
||||
//
|
||||
// multipleSelectionPanel
|
||||
//
|
||||
this.multipleSelectionPanel.Controls.Add(this.editSelectedGpusButton);
|
||||
this.multipleSelectionPanel.Controls.Add(this.clearAllButton);
|
||||
this.multipleSelectionPanel.Controls.Add(this.selectAllButton);
|
||||
resources.ApplyResources(this.multipleSelectionPanel, "multipleSelectionPanel");
|
||||
this.multipleSelectionPanel.Name = "multipleSelectionPanel";
|
||||
//
|
||||
// editSelectedGpusButton
|
||||
//
|
||||
resources.ApplyResources(this.editSelectedGpusButton, "editSelectedGpusButton");
|
||||
this.editSelectedGpusButton.BackColor = System.Drawing.Color.Transparent;
|
||||
this.editSelectedGpusButton.Name = "editSelectedGpusButton";
|
||||
this.editSelectedGpusButton.UseVisualStyleBackColor = false;
|
||||
this.editSelectedGpusButton.Click += new System.EventHandler(this.editButton_Click);
|
||||
//
|
||||
// clearAllButton
|
||||
//
|
||||
resources.ApplyResources(this.clearAllButton, "clearAllButton");
|
||||
this.clearAllButton.Name = "clearAllButton";
|
||||
this.clearAllButton.UseVisualStyleBackColor = true;
|
||||
this.clearAllButton.Click += new System.EventHandler(this.clearAllButton_Click);
|
||||
//
|
||||
// selectAllButton
|
||||
//
|
||||
resources.ApplyResources(this.selectAllButton, "selectAllButton");
|
||||
this.selectAllButton.Name = "selectAllButton";
|
||||
this.selectAllButton.UseVisualStyleBackColor = true;
|
||||
this.selectAllButton.Click += new System.EventHandler(this.selectAllButton_Click);
|
||||
//
|
||||
// GpuRow
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.panel);
|
||||
this.Controls.Add(this.panelWithBorder);
|
||||
this.Name = "GpuRow";
|
||||
this.panel.ResumeLayout(false);
|
||||
this.panelWithBorder.ResumeLayout(false);
|
||||
this.panelWithBorder.PerformLayout();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewEx1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pGpuPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.allowedTypesGrid)).EndInit();
|
||||
this.multipleSelectionPanel.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PanelWithBorder panel;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private XenAdmin.Controls.Common.AutoHeightLabel pGPULabel;
|
||||
private System.Windows.Forms.ImageList imageList1;
|
||||
private System.Windows.Forms.Button editPlacementPolicyButton;
|
||||
private XenAdmin.Controls.DataGridViewEx.DataGridViewEx dataGridViewEx1;
|
||||
private XenAdmin.Controls.Common.AutoHeightLabel autoHeightLabel1;
|
||||
private GpuShinyBar gpuShinyBar1;
|
||||
private System.Windows.Forms.PictureBox pGpuPictureBox;
|
||||
private XenAdmin.Controls.Common.AutoHeightLabel pGpuLabel;
|
||||
private System.Windows.Forms.ImageList allowedTypesImageList;
|
||||
private XenAdmin.Controls.DataGridViewEx.DataGridViewEx allowedTypesGrid;
|
||||
private XenAdmin.Controls.Common.AutoHeightLabel allowedTypesLabel;
|
||||
private System.Windows.Forms.DataGridViewImageColumn ImageColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn TextColumn;
|
||||
private System.Windows.Forms.TableLayoutPanel shinyBarsContainerPanel;
|
||||
private System.Windows.Forms.Button clearAllButton;
|
||||
private System.Windows.Forms.Button selectAllButton;
|
||||
private PanelWithBorder panelWithBorder;
|
||||
protected System.Windows.Forms.Panel multipleSelectionPanel;
|
||||
protected System.Windows.Forms.Button editButton;
|
||||
protected System.Windows.Forms.Button editSelectedGpusButton;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls.DataGridViewEx;
|
||||
using XenAdmin.Network;
|
||||
using XenAdmin.Properties;
|
||||
using XenAPI;
|
||||
|
||||
@ -13,47 +16,156 @@ namespace XenAdmin.Controls.GPU
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public GpuRow(Host host, PGPU pGpu)
|
||||
public GpuRow(IXenConnection connection, List<PGPU> pGpuList)
|
||||
: this()
|
||||
{
|
||||
this.host = host;
|
||||
this.pGpu = pGpu;
|
||||
this.connection = connection;
|
||||
pGpuLabel.Text = pGpuList[0].Name;
|
||||
RepopulateAllowedTypes(pGpuList[0]);
|
||||
Rebuild(pGpuList);
|
||||
SetupPage();
|
||||
}
|
||||
|
||||
private Host host;
|
||||
private PGPU pGpu
|
||||
private IXenConnection connection;
|
||||
|
||||
private Dictionary<PGPU, CheckBox> pGpus = new Dictionary<PGPU, CheckBox>();
|
||||
|
||||
private void Rebuild(List<PGPU> pGpuList)
|
||||
{
|
||||
set
|
||||
Program.AssertOnEventThread();
|
||||
if (!Visible)
|
||||
return;
|
||||
|
||||
shinyBarsContainerPanel.SuspendLayout();
|
||||
|
||||
// Store a list of the current controls. We remove them at the end because it makes less flicker that way.
|
||||
var oldControls = new List<Control>(shinyBarsContainerPanel.Controls.Count);
|
||||
oldControls.AddRange(shinyBarsContainerPanel.Controls.Cast<Control>());
|
||||
|
||||
int index = 1;
|
||||
XenRef<Host> hostRef = null;
|
||||
foreach (PGPU pgpu in pGpuList)
|
||||
{
|
||||
pGPULabel.Text = value.Name;
|
||||
RepopulateAllowedTypes(value);
|
||||
// Initialize the shiny bar
|
||||
gpuShinyBar1.Initialize(host, value);
|
||||
var host = connection.Resolve(pgpu.host);
|
||||
|
||||
// add host label if needed
|
||||
if (hostRef == null || pgpu.host.opaque_ref != hostRef.opaque_ref)
|
||||
{
|
||||
AddHostLabel(new Label { Text = String.Format(Messages.GPU_ON_HOST_LABEL, host.Name)}, ref index);
|
||||
hostRef = pgpu.host;
|
||||
}
|
||||
|
||||
// add pGPU shiny bar
|
||||
var gpuShinyBar = new GpuShinyBar();
|
||||
var checkBox = pGpuList.Count > 1 ? new CheckBox { Checked = true } : null;
|
||||
AddShinyBar(gpuShinyBar, checkBox, ref index);
|
||||
gpuShinyBar.Initialize(pgpu);
|
||||
|
||||
pGpus.Add(pgpu, checkBox);
|
||||
}
|
||||
|
||||
// Remove old controls
|
||||
foreach (Control c in oldControls)
|
||||
{
|
||||
shinyBarsContainerPanel.Controls.Remove(c);
|
||||
c.Dispose();
|
||||
}
|
||||
shinyBarsContainerPanel.ResumeLayout();
|
||||
ReLayout();
|
||||
}
|
||||
|
||||
private void AddShinyBar(UserControl shinyBar, CheckBox checkBox, ref int index)
|
||||
{
|
||||
if (checkBox != null)
|
||||
{
|
||||
shinyBarsContainerPanel.Controls.Add(checkBox, 0, index);
|
||||
checkBox.Dock = DockStyle.Fill;
|
||||
checkBox.Margin = new Padding(3, 30, 0, 0);
|
||||
}
|
||||
|
||||
shinyBarsContainerPanel.Controls.Add(shinyBar, 1, index);
|
||||
shinyBar.Dock = DockStyle.Fill;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
private void AddHostLabel(Label label, ref int index)
|
||||
{
|
||||
shinyBarsContainerPanel.Controls.Add(label, 0, index);
|
||||
shinyBarsContainerPanel.SetColumnSpan(label, 2);
|
||||
label.Dock = DockStyle.Fill;
|
||||
index++;
|
||||
}
|
||||
|
||||
private void ReLayout()
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
Height = tableLayoutPanel1.Height + 2;
|
||||
}
|
||||
|
||||
private void SetupPage()
|
||||
{
|
||||
multipleSelectionPanel.Visible = (pGpus.Count > 1);
|
||||
editButton.Visible = !multipleSelectionPanel.Visible;
|
||||
}
|
||||
|
||||
private void RepopulateAllowedTypes(PGPU pGpu)
|
||||
{
|
||||
dataGridViewEx1.SuspendLayout();
|
||||
dataGridViewEx1.Rows.Clear();
|
||||
dataGridViewEx1.Cursor = Cursors.WaitCursor;
|
||||
allowedTypesGrid.SuspendLayout();
|
||||
allowedTypesGrid.Rows.Clear();
|
||||
allowedTypesGrid.Cursor = Cursors.WaitCursor;
|
||||
try
|
||||
{
|
||||
dataGridViewEx1.Rows.Clear();
|
||||
allowedTypesGrid.Rows.Clear();
|
||||
if (pGpu.supported_VGPU_types != null && pGpu.supported_VGPU_types.Count > 0)
|
||||
{
|
||||
dataGridViewEx1.Rows.AddRange((from vGpuTypeRef in pGpu.supported_VGPU_types
|
||||
allowedTypesGrid.Rows.AddRange((from vGpuTypeRef in pGpu.supported_VGPU_types
|
||||
let vGpuType = pGpu.Connection.Resolve(vGpuTypeRef)
|
||||
let enabledType = pGpu.enabled_VGPU_types.Contains(vGpuTypeRef)
|
||||
orderby vGpuType.Capacity ascending
|
||||
select new VGpuTypeRow(vGpuType, enabledType)).ToArray());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
dataGridViewEx1.ResumeLayout();
|
||||
dataGridViewEx1.Cursor = Cursors.Default;
|
||||
allowedTypesGrid.ResumeLayout();
|
||||
allowedTypesGrid.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
public List<PGPU> SelectedPGPUs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (pGpus.Count == 0)
|
||||
return null;
|
||||
|
||||
return pGpus.Count > 1
|
||||
? (from kvp in pGpus where kvp.Value != null && kvp.Value.Checked select kvp.Key).ToList()
|
||||
: new List<PGPU> {pGpus.Keys.ElementAt(0)};
|
||||
}
|
||||
}
|
||||
|
||||
private void selectAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var checkBox in pGpus.Values.Where(checkBox => checkBox != null))
|
||||
{
|
||||
checkBox.Checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var checkBox in pGpus.Values.Where(checkBox => checkBox != null))
|
||||
{
|
||||
checkBox.Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void editButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new GpuConfiguration(SelectedPGPUs).ShowDialog(Program.MainWindow);
|
||||
}
|
||||
}
|
||||
|
||||
class VGpuTypeRow : DataGridViewExRow
|
||||
@ -81,5 +193,4 @@ namespace XenAdmin.Controls.GPU
|
||||
NameCell.Value = VGpuType.Name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,15 +117,15 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="imageList1.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=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<data name="allowedTypesImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABY
|
||||
CQAAAk1TRnQBSQFMAgEBAgEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CQAAAk1TRnQBSQFMAgEBAgEAAcgBAgHIAQIBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
@ -167,143 +167,125 @@
|
||||
BAABgAEBAR8BBwQAAYABAgH/AYMEAAHAAeIB/wHDBAAB4QH7Af8B4QQAAfMC/wHhBAAD/wHxBAAL
|
||||
</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="panel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=2.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" />
|
||||
<data name="panelWithBorder.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<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" />
|
||||
<data name="autoHeightLabel1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<data name="allowedTypesLabel.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<data name="allowedTypesLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>565, 6</value>
|
||||
<data name="allowedTypesLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>460, 6</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<data name="allowedTypesLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 0</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="allowedTypesLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>217, 16</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="allowedTypesLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>22</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.Text" xml:space="preserve">
|
||||
<data name="allowedTypesLabel.Text" xml:space="preserve">
|
||||
<value>Allowed vGPU types:</value>
|
||||
</data>
|
||||
<data name="autoHeightLabel1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<data name="allowedTypesLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>autoHeightLabel1.Name" xml:space="preserve">
|
||||
<value>autoHeightLabel1</value>
|
||||
<data name=">>allowedTypesLabel.Name" xml:space="preserve">
|
||||
<value>allowedTypesLabel</value>
|
||||
</data>
|
||||
<data name=">>autoHeightLabel1.Type" xml:space="preserve">
|
||||
<data name=">>allowedTypesLabel.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>autoHeightLabel1.Parent" xml:space="preserve">
|
||||
<data name=">>allowedTypesLabel.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>autoHeightLabel1.ZOrder" xml:space="preserve">
|
||||
<data name=">>allowedTypesLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="pGPULabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<data name="pGpuLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="pGPULabel.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<data name="pGpuLabel.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt</value>
|
||||
</data>
|
||||
<data name="pGPULabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<data name="pGpuLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pGPULabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="pGpuLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>34, 6</value>
|
||||
</data>
|
||||
<data name="pGPULabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<data name="pGpuLabel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
</data>
|
||||
<data name="pGPULabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>519, 16</value>
|
||||
<data name="pGpuLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>414, 16</value>
|
||||
</data>
|
||||
<data name="pGPULabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="pGpuLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name=">>pGPULabel.Name" xml:space="preserve">
|
||||
<value>pGPULabel</value>
|
||||
<data name=">>pGpuLabel.Name" xml:space="preserve">
|
||||
<value>pGpuLabel</value>
|
||||
</data>
|
||||
<data name=">>pGPULabel.Type" xml:space="preserve">
|
||||
<data name=">>pGpuLabel.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pGPULabel.Parent" xml:space="preserve">
|
||||
<data name=">>pGpuLabel.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>pGPULabel.ZOrder" xml:space="preserve">
|
||||
<data name=">>pGpuLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 6</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>16, 16</value>
|
||||
</data>
|
||||
<data name="pictureBox1.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>AutoSize</value>
|
||||
</data>
|
||||
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Name" xml:space="preserve">
|
||||
<value>pictureBox1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<data name="pGpuPictureBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>565, 137</value>
|
||||
<data name="pGpuPictureBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 6</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<data name="pGpuPictureBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>66, 22</value>
|
||||
<data name="pGpuPictureBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>16, 16</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>19</value>
|
||||
<data name="pGpuPictureBox.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>AutoSize</value>
|
||||
</data>
|
||||
<data name="editPlacementPolicyButton.Text" xml:space="preserve">
|
||||
<value>&Edit...</value>
|
||||
<data name="pGpuPictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>editPlacementPolicyButton.Name" xml:space="preserve">
|
||||
<value>editPlacementPolicyButton</value>
|
||||
<data name=">>pGpuPictureBox.Name" xml:space="preserve">
|
||||
<value>pGpuPictureBox</value>
|
||||
</data>
|
||||
<data name=">>editPlacementPolicyButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>editPlacementPolicyButton.Parent" xml:space="preserve">
|
||||
<data name=">>pGpuPictureBox.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>editPlacementPolicyButton.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<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">
|
||||
<value>True</value>
|
||||
@ -323,65 +305,116 @@
|
||||
<data name="TextColumn.Width" type="System.Int32, mscorlib">
|
||||
<value>190</value>
|
||||
</data>
|
||||
<data name="dataGridViewEx1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>565, 28</value>
|
||||
</data>
|
||||
<data name="dataGridViewEx1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 0, 6, 0</value>
|
||||
</data>
|
||||
<data name="dataGridViewEx1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>217, 103</value>
|
||||
</data>
|
||||
<data name="dataGridViewEx1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>21</value>
|
||||
</data>
|
||||
<data name=">>dataGridViewEx1.Name" xml:space="preserve">
|
||||
<value>dataGridViewEx1</value>
|
||||
</data>
|
||||
<data name=">>dataGridViewEx1.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>dataGridViewEx1.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>dataGridViewEx1.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="gpuShinyBar1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<data name="allowedTypesGrid.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="gpuShinyBar1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>31, 31</value>
|
||||
<data name="allowedTypesGrid.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>460, 28</value>
|
||||
</data>
|
||||
<data name="gpuShinyBar1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>525, 97</value>
|
||||
<data name="allowedTypesGrid.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 0, 6, 0</value>
|
||||
</data>
|
||||
<data name="gpuShinyBar1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>23</value>
|
||||
<data name="allowedTypesGrid.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>217, 93</value>
|
||||
</data>
|
||||
<data name=">>gpuShinyBar1.Name" xml:space="preserve">
|
||||
<value>gpuShinyBar1</value>
|
||||
<data name="allowedTypesGrid.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>21</value>
|
||||
</data>
|
||||
<data name=">>gpuShinyBar1.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.GPU.GpuShinyBar, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<data name=">>allowedTypesGrid.Name" xml:space="preserve">
|
||||
<value>allowedTypesGrid</value>
|
||||
</data>
|
||||
<data name=">>gpuShinyBar1.Parent" xml:space="preserve">
|
||||
<data name=">>allowedTypesGrid.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>allowedTypesGrid.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>gpuShinyBar1.ZOrder" xml:space="preserve">
|
||||
<data name=">>allowedTypesGrid.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 31</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>1, 1, 1, 1</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>448, 121</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>23</value>
|
||||
</data>
|
||||
<data name=">>shinyBarsContainerPanel.Name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>shinyBarsContainerPanel.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>shinyBarsContainerPanel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="shinyBarsContainerPanel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls /><Columns Styles="Absolute,24,AutoSize,0" /><Rows Styles="AutoSize,0" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="editButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="editButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>460, 127</value>
|
||||
</data>
|
||||
<data name="editButton.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
</data>
|
||||
<data name="editButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>66, 22</value>
|
||||
</data>
|
||||
<data name="editButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="editButton.Text" xml:space="preserve">
|
||||
<value>&Edit...</value>
|
||||
</data>
|
||||
<data name=">>editButton.Name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>editButton.Parent" xml:space="preserve">
|
||||
<value>tableLayoutPanel1</value>
|
||||
</data>
|
||||
<data name=">>editButton.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
<value>1, 1</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>788, 171</value>
|
||||
<value>683, 155</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
@ -393,51 +426,174 @@
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.Parent" xml:space="preserve">
|
||||
<value>panel</value>
|
||||
<value>panelWithBorder</value>
|
||||
</data>
|
||||
<data name=">>tableLayoutPanel1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="tableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="autoHeightLabel1" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pGPULabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="editPlacementPolicyButton" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="dataGridViewEx1" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="gpuShinyBar1" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Absolute,12" /></TableLayoutSettings></value>
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="allowedTypesLabel" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="pGpuLabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="pGpuPictureBox" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="allowedTypesGrid" Row="1" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="shinyBarsContainerPanel" Row="1" RowSpan="2" Column="0" ColumnSpan="2" /><Control Name="editButton" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="panel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
<data name="editSelectedGpusButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Right</value>
|
||||
</data>
|
||||
<data name="panel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 0, 0, 0</value>
|
||||
<data name="editSelectedGpusButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="panel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>788, 171</value>
|
||||
<data name="editSelectedGpusButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>460, 4</value>
|
||||
</data>
|
||||
<data name="panel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
<data name="editSelectedGpusButton.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
</data>
|
||||
<data name=">>panel.Name" xml:space="preserve">
|
||||
<value>panel</value>
|
||||
<data name="editSelectedGpusButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>130, 22</value>
|
||||
</data>
|
||||
<data name=">>panel.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.PanelWithBorder, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<data name="editSelectedGpusButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>27</value>
|
||||
</data>
|
||||
<data name=">>panel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
<data name="editSelectedGpusButton.Text" xml:space="preserve">
|
||||
<value>&Edit Selected GPUs...</value>
|
||||
</data>
|
||||
<data name=">>panel.ZOrder" xml:space="preserve">
|
||||
<data name=">>editSelectedGpusButton.Name" xml:space="preserve">
|
||||
<value>editSelectedGpusButton</value>
|
||||
</data>
|
||||
<data name=">>editSelectedGpusButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>editSelectedGpusButton.Parent" xml:space="preserve">
|
||||
<value>multipleSelectionPanel</value>
|
||||
</data>
|
||||
<data name=">>editSelectedGpusButton.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="clearAllButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="clearAllButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>84, 3</value>
|
||||
</data>
|
||||
<data name="clearAllButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
</data>
|
||||
<data name="clearAllButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>26</value>
|
||||
</data>
|
||||
<data name="clearAllButton.Text" xml:space="preserve">
|
||||
<value>&Clear All</value>
|
||||
</data>
|
||||
<data name=">>clearAllButton.Name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>clearAllButton.Parent" xml:space="preserve">
|
||||
<value>multipleSelectionPanel</value>
|
||||
</data>
|
||||
<data name=">>clearAllButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="selectAllButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="selectAllButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 3</value>
|
||||
</data>
|
||||
<data name="selectAllButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
</data>
|
||||
<data name="selectAllButton.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>25</value>
|
||||
</data>
|
||||
<data name="selectAllButton.Text" xml:space="preserve">
|
||||
<value>&Select All</value>
|
||||
</data>
|
||||
<data name=">>selectAllButton.Name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>selectAllButton.Parent" xml:space="preserve">
|
||||
<value>multipleSelectionPanel</value>
|
||||
</data>
|
||||
<data name=">>selectAllButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="multipleSelectionPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="multipleSelectionPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>1, 156</value>
|
||||
</data>
|
||||
<data name="multipleSelectionPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>683, 31</value>
|
||||
</data>
|
||||
<data name="multipleSelectionPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>26</value>
|
||||
</data>
|
||||
<data name=">>multipleSelectionPanel.Name" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>multipleSelectionPanel.Parent" xml:space="preserve">
|
||||
<value>panelWithBorder</value>
|
||||
</data>
|
||||
<data name=">>multipleSelectionPanel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>1, 1, 1, 1</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>685, 188</value>
|
||||
</data>
|
||||
<data name="panelWithBorder.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name=">>panelWithBorder.Name" xml:space="preserve">
|
||||
<value>panelWithBorder</value>
|
||||
</data>
|
||||
<data name=">>panelWithBorder.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.PanelWithBorder, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>panelWithBorder.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<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">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>788, 171</value>
|
||||
<value>685, 188</value>
|
||||
</data>
|
||||
<data name=">>imageList1.Name" xml:space="preserve">
|
||||
<value>imageList1</value>
|
||||
<data name=">>allowedTypesImageList.Name" xml:space="preserve">
|
||||
<value>allowedTypesImageList</value>
|
||||
</data>
|
||||
<data name=">>imageList1.Type" xml:space="preserve">
|
||||
<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>
|
||||
</data>
|
||||
<data name=">>ImageColumn.Name" xml:space="preserve">
|
||||
|
@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls.Ballooning;
|
||||
using XenAPI;
|
||||
@ -21,23 +16,14 @@ namespace XenAdmin.Controls.GPU
|
||||
private PGPU pGPU;
|
||||
|
||||
private List<VGPU> vGPUs;
|
||||
Dictionary<VGPU, VM> vms;
|
||||
private long capacity;
|
||||
private Dictionary<VGPU, VM> vms;
|
||||
|
||||
private Host host;
|
||||
private Host_metrics host_metrics;
|
||||
|
||||
public void Initialize(Host host, PGPU pGPU)
|
||||
public void Initialize(PGPU pGPU)
|
||||
{
|
||||
this.pGPU = pGPU;
|
||||
this.host = host;
|
||||
this.host_metrics = host.Connection.Resolve(host.metrics);
|
||||
|
||||
vGPUs = pGPU.Connection.ResolveAll(pGPU.resident_VGPUs);
|
||||
|
||||
var capacities = pGPU.supported_VGPU_max_capacities;
|
||||
capacity = capacities.Sum(pair => pair.Value);
|
||||
|
||||
vms = new Dictionary<VGPU, VM>();
|
||||
foreach (VGPU vgpu in vGPUs)
|
||||
vms[vgpu] = vgpu.Connection.Resolve(vgpu.VM);
|
||||
@ -45,66 +31,70 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (host == null || pGPU == null || vGPUs == null/* || capacity == 0*/)
|
||||
if (pGPU == null || vGPUs == null)
|
||||
return;
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
Rectangle barArea = barRect;
|
||||
double bytesPerPixel = (double)host_metrics.memory_total / (double)barArea.Width;
|
||||
|
||||
// Grid
|
||||
//DrawGrid(g, barArea, bytesPerPixel, host_metrics.memory_total);
|
||||
DrawGrid(g, barArea, barArea.Width);
|
||||
|
||||
double left = (double)barArea.Left;
|
||||
double left = barArea.Left;
|
||||
|
||||
// A bar for each vGPU
|
||||
int i = 0;
|
||||
vGPUs.Sort();
|
||||
long length = host_metrics.memory_total / 4;
|
||||
long length = barArea.Width / 8;
|
||||
foreach (VGPU vgpu in vGPUs)
|
||||
{
|
||||
VM vm = vms[vgpu];
|
||||
if (vm != null)
|
||||
{
|
||||
DrawSegment(g, length, bytesPerPixel, vm.Name, vm,
|
||||
BallooningColors.HostShinyBar_VMs[i++ % BallooningColors.HostShinyBar_VMs.Length],
|
||||
var vGpuType = pGPU.Connection.Resolve(vgpu.type);
|
||||
|
||||
DrawSegment(g, length, vm.Name, vGpuType != null ? vGpuType.model_name : "",
|
||||
GpuShinyBarColors.GpuShinyBar_VMs[i++ % GpuShinyBarColors.GpuShinyBar_VMs.Length],
|
||||
ref left);
|
||||
}
|
||||
}
|
||||
|
||||
// One final bar for free space
|
||||
Rectangle rectFree = new Rectangle((int)left, barArea.Top, barArea.Right - (int)left, barArea.Height);
|
||||
DrawToTarget(g, barArea, rectFree, BallooningColors.HostShinyBar_Unused);
|
||||
DrawToTarget(g, barArea, rectFree, GpuShinyBarColors.GpuShinyBar_Unused);
|
||||
}
|
||||
|
||||
private void DrawSegment(Graphics g, long mem, double bytesPerPixel, string name, VM vm, Color color, ref double left)
|
||||
private void DrawGrid(Graphics g, Rectangle barArea, long max)
|
||||
{
|
||||
// This should never happen, but actually does happen in older server dbs because
|
||||
// we didn't used to have the amount of free memory accurately (see CA-31223).
|
||||
if (mem < 0)
|
||||
const int line_height = 12;
|
||||
|
||||
int line_bottom = barArea.Top + barArea.Height / 2;
|
||||
int line_top = barArea.Top - line_height;
|
||||
|
||||
long incr = max / 8;
|
||||
|
||||
// Draw the grid
|
||||
using (Pen pen = new Pen(GpuShinyBarColors.Grid))
|
||||
{
|
||||
for (long x = 0; x <= max; x += incr)
|
||||
{
|
||||
// Tick
|
||||
int pos = barArea.Left + (int)((double)x);
|
||||
g.DrawLine(pen, pos, line_top, pos, line_bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSegment(Graphics g, long width, string name, string description, Color color, ref double left)
|
||||
{
|
||||
if (width < 0)
|
||||
return;
|
||||
|
||||
Rectangle barArea = barRect;
|
||||
double width = mem / bytesPerPixel;
|
||||
Rectangle rect = new Rectangle((int)left, barArea.Top,
|
||||
var rect = new Rectangle((int)left, barRect.Top,
|
||||
(int)(left + width) - (int)left, // this is not necessarily the same as (int)width, which can leave a 1 pixel gap
|
||||
barArea.Height);
|
||||
string bytesString = Util.SuperiorSizeString(mem, 0);
|
||||
string caption = name + "\n" + bytesString;
|
||||
string toolTip = name + "\n" + string.Format(Messages.CURRENT_MEMORY_USAGE, bytesString);
|
||||
if (vm != null && vm.has_ballooning)
|
||||
{
|
||||
if (vm.memory_dynamic_max == vm.memory_static_max)
|
||||
toolTip += string.Format("\n{0}: {1}\n{2}: {3}",
|
||||
Messages.DYNAMIC_MIN, Util.SuperiorSizeString(vm.memory_dynamic_min, 0),
|
||||
Messages.DYNAMIC_MAX, Util.SuperiorSizeString(vm.memory_dynamic_max, 0));
|
||||
else
|
||||
toolTip += string.Format("\n{0}: {1}\n{2}: {3}\n{4}: {5}",
|
||||
Messages.DYNAMIC_MIN, Util.SuperiorSizeString(vm.memory_dynamic_min, 0),
|
||||
Messages.DYNAMIC_MAX, Util.SuperiorSizeString(vm.memory_dynamic_max, 0),
|
||||
Messages.STATIC_MAX, Util.SuperiorSizeString(vm.memory_static_max, 0));
|
||||
}
|
||||
DrawToTarget(g, barArea, rect, color, caption, BallooningColors.HostShinyBar_Text, HorizontalAlignment.Center, toolTip);
|
||||
barRect.Height);
|
||||
var caption = name + "\n" + description;
|
||||
DrawToTarget(g, barRect, rect, color, caption, GpuShinyBarColors.GpuShinyBar_Text, HorizontalAlignment.Center, caption);
|
||||
left += width;
|
||||
}
|
||||
|
||||
@ -116,4 +106,13 @@ namespace XenAdmin.Controls.GPU
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class GpuShinyBarColors
|
||||
{
|
||||
public static Color[] GpuShinyBar_VMs = { Color.FromArgb(83, 39, 139), Color.FromArgb(157, 115, 215) };
|
||||
public static Color GpuShinyBar_Unused = Color.Black;
|
||||
public static Color GpuShinyBar_Text = Color.White;
|
||||
|
||||
public static Color Grid = Color.DarkGray;
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,9 @@
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>500, 77</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>GpuShinyBar</value>
|
||||
</data>
|
||||
|
@ -1267,6 +1267,12 @@ namespace XenAdmin
|
||||
ShowTab(TabPageNetwork, !multi && !SearchMode && (isVMSelected || (isHostSelected && isHostLive) || isPoolSelected));
|
||||
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);
|
||||
|
||||
ShowTab(TabPageGPU, !multi && !SearchMode && isPoolOrLiveStandaloneHost && showGpu);
|
||||
|
||||
pluginManager.SetSelectedXenObject(SelectionManager.Selection.FirstAsXenObject);
|
||||
|
||||
bool shownConsoleReplacement = false;
|
||||
@ -1287,11 +1293,6 @@ namespace XenAdmin
|
||||
|
||||
ShowTab(TabPageAD, !multi && !SearchMode && (isPoolSelected || isHostSelected && isHostLive) && george_or_greater);
|
||||
|
||||
bool showGPU = SelectionManager.Selection.All(s => Helpers.ClearwaterOrGreater(s.Connection)) &&
|
||||
!Helpers.FeatureForbidden(SelectionManager.Selection.FirstAsXenObject, Host.RestrictVgpu);
|
||||
|
||||
ShowTab(TabPageGPU, !multi && !SearchMode && ((isHostSelected && isHostLive) || isPoolSelected) && showGPU);
|
||||
|
||||
foreach (TabPageFeature f in pluginManager.GetAllFeatures<TabPageFeature>(f => !f.IsConsoleReplacement && !multi && f.ShowTab))
|
||||
ShowTab(f.TabPage, true);
|
||||
|
||||
|
1
XenAdmin/TabPages/GpuPage.Designer.cs
generated
1
XenAdmin/TabPages/GpuPage.Designer.cs
generated
@ -50,6 +50,7 @@
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.gpuPlacementPolicyPanel1);
|
||||
this.Name = "GpuPage";
|
||||
this.VisibleChanged += new System.EventHandler(this.GpuPage_VisibleChanged);
|
||||
this.Controls.SetChildIndex(this.gpuPlacementPolicyPanel1, 0);
|
||||
this.Controls.SetChildIndex(this.pageContainerPanel, 0);
|
||||
this.ResumeLayout(false);
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Controls.GPU;
|
||||
using XenAPI;
|
||||
@ -8,15 +10,20 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
public partial class GpuPage : BaseTabPage
|
||||
{
|
||||
private const int ROW_GAP = 10;
|
||||
private const int ROW_GAP = 5;
|
||||
|
||||
public GpuPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Messages.GPU;
|
||||
PGPU_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(PGPU_CollectionChanged);
|
||||
}
|
||||
|
||||
|
||||
private readonly CollectionChangeEventHandler PGPU_CollectionChangedWithInvoke;
|
||||
|
||||
private IXenObject xenObject;
|
||||
List<PGPU> pGPUs = new List<PGPU>();
|
||||
|
||||
/// <summary>
|
||||
/// The object that the panel is displaying GPU info for.
|
||||
@ -34,14 +41,12 @@ namespace XenAdmin.TabPages
|
||||
}
|
||||
}
|
||||
|
||||
private bool _rebuild_needed;
|
||||
private bool _rebuilding = false;
|
||||
private bool _rebuilding;
|
||||
|
||||
private void Rebuild()
|
||||
{
|
||||
Program.AssertOnEventThread();
|
||||
_rebuild_needed = false;
|
||||
if (!this.Visible)
|
||||
if (!Visible)
|
||||
return;
|
||||
_rebuilding = true;
|
||||
pageContainerPanel.SuspendLayout();
|
||||
@ -53,17 +58,56 @@ namespace XenAdmin.TabPages
|
||||
oldControls.Add(c);
|
||||
}
|
||||
|
||||
|
||||
// Group pGPUs with the same settings
|
||||
Dictionary<GpuSettings, List<PGPU>> settingsToPGPUs = new Dictionary<GpuSettings, List<PGPU>>(); // all PGPUs with a particular setting
|
||||
List<GpuSettings> listSettings = new List<GpuSettings>(); // also make a list of GpuSettings to preserve the order
|
||||
|
||||
pGPUs.Clear();
|
||||
|
||||
var allPgpus = xenObject.Connection.Cache.PGPUs;
|
||||
pGPUs.AddRange(from pGpu in allPgpus
|
||||
let host = xenObject.Connection.Resolve(pGpu.host)
|
||||
orderby host, pGpu.Name ascending
|
||||
select pGpu
|
||||
);
|
||||
|
||||
foreach (PGPU pGpu in pGPUs)
|
||||
{
|
||||
RegisterPgpuHandlers(pGpu);
|
||||
|
||||
var enabledTypes = pGpu.Connection.ResolveAll(pGpu.enabled_VGPU_types);
|
||||
|
||||
if (enabledTypes.Count > 1)
|
||||
{
|
||||
enabledTypes.Sort((t1, t2) =>
|
||||
{
|
||||
int result = t1.Capacity.CompareTo(t2.Capacity);
|
||||
return result != 0 ? result : t1.Name.CompareTo(t2.Name);
|
||||
});
|
||||
}
|
||||
|
||||
var newSettings = new GpuSettings(enabledTypes.ToArray());
|
||||
|
||||
var existingSettings = settingsToPGPUs.Keys.FirstOrDefault(ss => ss.Equals(newSettings));
|
||||
|
||||
if (existingSettings == null) // we've not seen these settings on another pGPU
|
||||
{
|
||||
settingsToPGPUs.Add(newSettings, new List<PGPU>());
|
||||
listSettings.Add(newSettings);
|
||||
existingSettings = newSettings;
|
||||
}
|
||||
settingsToPGPUs[existingSettings].Add(pGpu);
|
||||
}
|
||||
|
||||
int initScroll = pageContainerPanel.VerticalScroll.Value;
|
||||
int top = pageContainerPanel.Padding.Top - initScroll;
|
||||
|
||||
foreach (Host host in xenObject.Connection.Cache.Hosts)
|
||||
foreach (GpuSettings settings in listSettings)
|
||||
{
|
||||
foreach (var pGpu in host.Connection.ResolveAll(host.PGPUs))
|
||||
{
|
||||
AddRowToPanel(new GpuRow(host, pGpu), ref top);
|
||||
}
|
||||
AddRowToPanel(new GpuRow(xenObject.Connection, settingsToPGPUs[settings]), ref top);
|
||||
}
|
||||
|
||||
|
||||
// Remove old controls
|
||||
foreach (Control c in oldControls)
|
||||
{
|
||||
@ -120,5 +164,109 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
row.Width = pageContainerPanel.Width - pageContainerPanel.Padding.Left - 25; // It won't drop below row.MinimumSize.Width though
|
||||
}
|
||||
|
||||
private void PGPU_CollectionChanged(object sender, CollectionChangeEventArgs e)
|
||||
{
|
||||
if (e.Action == CollectionChangeAction.Remove)
|
||||
{
|
||||
PGPU pgpu = e.Element as PGPU;
|
||||
UnregisterPgpuHandlers(pgpu);
|
||||
}
|
||||
XenObject = xenObject;
|
||||
}
|
||||
|
||||
private void pgpu_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "resident_VGPUs" || e.PropertyName == "enabled_VGPU_types")
|
||||
{
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
}
|
||||
private void RegisterPgpuHandlers(PGPU pgpu)
|
||||
{
|
||||
pgpu.PropertyChanged -= pgpu_PropertyChanged;
|
||||
pgpu.PropertyChanged += pgpu_PropertyChanged;
|
||||
}
|
||||
|
||||
private void UnregisterPgpuHandlers(PGPU pgpu)
|
||||
{
|
||||
pgpu.PropertyChanged -= pgpu_PropertyChanged;
|
||||
}
|
||||
|
||||
private void RegisterHandlers()
|
||||
{
|
||||
if (xenObject == null)
|
||||
return;
|
||||
|
||||
xenObject.Connection.Cache.DeregisterCollectionChanged<PGPU>(PGPU_CollectionChangedWithInvoke);
|
||||
xenObject.Connection.Cache.RegisterCollectionChanged<PGPU>(PGPU_CollectionChangedWithInvoke);
|
||||
|
||||
foreach (PGPU pgpu in xenObject.Connection.Cache.PGPUs)
|
||||
{
|
||||
UnregisterPgpuHandlers(pgpu);
|
||||
RegisterPgpuHandlers(pgpu);
|
||||
}
|
||||
}
|
||||
|
||||
private void GpuPage_VisibleChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Visible)
|
||||
RegisterHandlers();
|
||||
else
|
||||
UnregisterHandlers();
|
||||
}
|
||||
|
||||
private void UnregisterHandlers()
|
||||
{
|
||||
if (xenObject == null)
|
||||
return;
|
||||
|
||||
xenObject.Connection.Cache.DeregisterCollectionChanged<PGPU>(PGPU_CollectionChangedWithInvoke);
|
||||
|
||||
foreach (PGPU pgpu in xenObject.Connection.Cache.PGPUs)
|
||||
{
|
||||
UnregisterPgpuHandlers(pgpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal class GpuSettings : IEquatable<GpuSettings>
|
||||
{
|
||||
public readonly VGPU_type[] EnabledVgpuTypes;
|
||||
|
||||
public GpuSettings(VGPU_type[] vgpuTypes)
|
||||
{
|
||||
EnabledVgpuTypes = vgpuTypes;
|
||||
}
|
||||
|
||||
public bool Equals(GpuSettings other)
|
||||
{
|
||||
if ((EnabledVgpuTypes == null || EnabledVgpuTypes.Length == 0) &&
|
||||
(other.EnabledVgpuTypes == null || other.EnabledVgpuTypes.Length == 0))
|
||||
return true;
|
||||
|
||||
if ((EnabledVgpuTypes == null || EnabledVgpuTypes.Length == 0) ||
|
||||
(other.EnabledVgpuTypes == null || other.EnabledVgpuTypes.Length == 0))
|
||||
return false;
|
||||
|
||||
if (EnabledVgpuTypes.Length != other.EnabledVgpuTypes.Length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < EnabledVgpuTypes.Length; i++)
|
||||
{
|
||||
if (!EnabledVgpuTypes[i].Equals(other.EnabledVgpuTypes[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Join(",", EnabledVgpuTypes.Select(t => t.model_name).ToArray());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -13929,6 +13929,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to On {0}:.
|
||||
/// </summary>
|
||||
public static string GPU_ON_HOST_LABEL {
|
||||
get {
|
||||
return ResourceManager.GetString("GPU_ON_HOST_LABEL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Placement policy: {0}.
|
||||
/// </summary>
|
||||
|
@ -4880,6 +4880,9 @@ Would you like to eject these ISOs before continuing?</value>
|
||||
<data name="GPU_NONE" xml:space="preserve">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="GPU_ON_HOST_LABEL" xml:space="preserve">
|
||||
<value>On {0}:</value>
|
||||
</data>
|
||||
<data name="GPU_PLACEMENT_POLICY_DESCRIPTION" xml:space="preserve">
|
||||
<value>Placement policy: {0}</value>
|
||||
</data>
|
||||
|
@ -6,12 +6,8 @@
|
||||
{
|
||||
get
|
||||
{
|
||||
Host host = Connection.Resolve(this.host);
|
||||
|
||||
PCI pci = Connection.Resolve(PCI);
|
||||
var name = pci != null ? pci.device_name : uuid;
|
||||
|
||||
return string.Format("{0}: {1}", host != null ? host.Name : "", name);
|
||||
return pci != null ? pci.device_name : uuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user