Example #1
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 #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;

                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;
                }
            }
Example #3
0
        public void Repopulate()
        {
            if (network == null || host == null)
            {
                return;
            }

            populateHostNicList();

            //set minimum value for VLAN
            numUpDownVLAN.Minimum = Helpers.VLAN0Allowed(network.Connection) ? 0 : 1;

            PIF pif = GetNetworksPIF();

            if (pif != null)
            {
                bool editable = Editable(pif);

                HostVLanLabel.Visible = editable;
                HostNicLabel.Visible  = editable;
                numUpDownVLAN.Visible = editable;
                HostPNICList.Visible  = editable;
                nicHelpLabel.Visible  = editable;

                if (editable)
                {
                    // virtual pif (external network on VLAN)
                    numUpDownVLAN.Value = pif.VLAN;
                    PIF ThePhysicalPIF = FindAssociatedPhysicalPIF();
                    if (ThePhysicalPIF != null)
                    {
                        HostPNICList.SelectedItem = ThePhysicalPIF.Name();
                    }
                    else
                    {
                        HostPNICList.SelectedItem = pif.Name();
                    }
                }

                bool hasBondMode = network.IsBond();
                groupBoxBondMode.Visible = hasBondMode;

                bool supportsLinkAggregation = Helpers.SupportsLinkAggregationBond(network.Connection);
                radioButtonLacpSrcMac.Visible = radioButtonLacpTcpudpPorts.Visible = supportsLinkAggregation;

                if (hasBondMode)
                {
                    switch (NetworkBondMode)
                    {
                    case bond_mode.balance_slb:
                        radioButtonBalanceSlb.Checked = true;
                        break;

                    case bond_mode.active_backup:
                        radioButtonActiveBackup.Checked = true;
                        break;

                    case bond_mode.lacp:
                        if (supportsLinkAggregation)
                        {
                            switch (HashingAlgorithm)
                            {
                            case Bond.hashing_algoritm.tcpudp_ports:
                                radioButtonLacpTcpudpPorts.Checked = true;
                                break;

                            default:
                                radioButtonLacpSrcMac.Checked = true;
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            else
            {
                // internal network
                HostVLanLabel.Visible = true;
                HostNicLabel.Visible  = true;
                numUpDownVLAN.Visible = true;
                HostVLanLabel.Visible = true;
                HostPNICList.Visible  = true;
                nicHelpLabel.Visible  = true;

                groupBoxBondMode.Visible  = false;
                numUpDownVLAN.Enabled     = false;
                HostPNICList.SelectedItem = HostPNICList.Items[0];
            }

            foreach (VIF v in network.Connection.ResolveAll <VIF>(network.VIFs))
            {
                VM vm = network.Connection.Resolve <VM>(v.VM);
                if (vm.power_state != vm_power_state.Running || vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
                {
                    continue;
                }

                runningVMsWithoutTools = true;
                break;
            }

            // Populate Automatic checkbox
            autoCheckBox.Checked = network.GetAutoPlug();
            autoCheckBox.Enabled = !network.IsGuestInstallerNetwork();
            // in case some odd value has been set on the CLI
            numericUpDownMTU.Maximum = Math.Max(network.MTU, XenAPI.Network.MTU_MAX);
            numericUpDownMTU.Minimum = Math.Min(network.MTU, XenAPI.Network.MTU_MIN);
            numericUpDownMTU.Value   = network.MTU;
            numericUpDownMTU.Visible = network.CanUseJumboFrames();
        }