Example #1
0
        private void PopulateDataGridView(List <PIF> pifs)
        {
            try
            {
                dataGridView1.SuspendLayout();
                dataGridView1.Rows.Clear();
                m_numberOfCheckedNics = 0;

                foreach (PIF pif in pifs)
                {
                    string         description = PIFDescription(pif);
                    XenAPI.Network network     = Connection.Resolve <XenAPI.Network>(pif.network);
                    PIF_metrics    metrics     = pif.PIFMetrics();

                    int rowIndex = dataGridView1.Rows.Add(new object[]
                    {
                        false,
                        String.Format("{0} {1}", pif.Name(), description),
                        pif.MAC,
                        (network.PIFs.Count > 1) ? network.LinkStatusString() : pif.LinkStatusString(),
                        pif.Carrier() ? pif.Speed() : Messages.HYPHEN,
                        pif.Carrier() ? pif.Duplex() : Messages.HYPHEN,
                        metrics == null ? "" : metrics.vendor_name,
                        metrics == null ? "" : metrics.device_name,
                        metrics == null ? "" : metrics.pci_bus_path
                    });

                    DataGridViewRow row = dataGridView1.Rows[rowIndex];
                    row.Tag = pif;
                    ToggleNICRowCheckable(row);
                }

                //CA-47050: the ColumnPci should be autosized to Fill, but should not become smaller than a minimum
                //width, which is chosen to be the column's contents (including header) width. To find what this is
                //set temporarily the column's autosize mode to AllCells.
                ColumnPci.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                int storedWidth = ColumnPci.Width;
                ColumnPci.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                ColumnPci.MinimumWidth = storedWidth;
            }
            finally
            {
                dataGridView1.ResumeLayout();
            }

            SetValid();
        }
Example #2
0
            public void UpdateDetails()
            {
                Enabled = !Network.IsSlave();

                DeregisterPifEvents();

                Pif = Helpers.FindPIF(Network, Xmo as Host);

                RegisterPifEvents();

                ImageCell.Value       = Properties.Resources._000_Network_h32bit_16;
                NameCell.Value        = NetworkName();
                DescriptionCell.Value = Network.Description();
                NicCell.Value         = Helpers.GetName(Pif);
                VlanCell.Value        = Helpers.VlanString(Pif);
                AutoCell.Value        = Network.GetAutoPlug() ? Messages.YES : Messages.NO;
                LinkStatusCell.Value  = Xmo is Pool?Network.LinkStatusString() :
                                            Pif == null ? Messages.NONE : Pif.LinkStatusString();

                MacCell.Value = Pif != null && Pif.IsPhysical() ? Pif.MAC : Messages.SPACED_HYPHEN;
                MtuCell.Value = Network.CanUseJumboFrames() ? Network.MTU.ToString() : Messages.SPACED_HYPHEN;
            }
Example #3
0
            public void UpdateDetails()
            {
                Enabled = !Network.IsSlave();

                DeregisterPifEvents();

                Pif = Helpers.FindPIF(Network, Xmo as Host);

                RegisterPifEvents();

                ImageCell.Value       = Properties.Resources._000_Network_h32bit_16;
                NameCell.Value        = NetworkName();
                DescriptionCell.Value = Network.Description();
                NicCell.Value         = Helpers.GetName(Pif);
                VlanCell.Value        = Helpers.VlanString(Pif);
                AutoCell.Value        = Network.GetAutoPlug() ? Messages.YES : Messages.NO;
                LinkStatusCell.Value  = Xmo is Pool?Network.LinkStatusString() :
                                            Pif == null ? Messages.NONE : Pif.LinkStatusString();

                MacCell.Value = Pif != null && Pif.IsPhysical() ? Pif.MAC : Messages.SPACED_HYPHEN;
                MtuCell.Value = Network.CanUseJumboFrames() ? Network.MTU.ToString() : Messages.SPACED_HYPHEN;

                var networkSriov = Pif != null?Pif.NetworkSriov() : null;

                if (networkSriov == null)
                {
                    SriovCell.Value = Messages.NO;
                }
                else
                {
                    var sriov = Pif.Connection.Resolve(networkSriov);
                    SriovCell.Value = sriov == null
                        ? Messages.NO
                        : sriov.requires_reboot
                            ? Messages.HOST_NEEDS_REBOOT_ENABLE_SRIOV
                            : Messages.YES;
                }
            }