private void RegisterPifEvents() { if (Pif != null) { Pif.PropertyChanged += Server_PropertyChanged; // Listen for Tunnel and PIF_metrics changes which is necessary for Link Status updates (CA-46103) if (Pif.IsTunnelAccessPIF()) { Tunnel tunnel = Pif.Connection.Resolve(Pif.tunnel_access_PIF_of[0]); if (tunnel != null) { tunnel.PropertyChanged += Pif_PropertyChanged; } } else { PIF_metrics metrics = Pif.PIFMetrics(); if (metrics != null) { metrics.PropertyChanged += Pif_PropertyChanged; } } } }
private void UnregisterPIFEventHandlers(PIF pif) { pif.PropertyChanged -= PIF_PropertyChangedEventHandler; var pifMetrics = pif.PIFMetrics(); if (pifMetrics != null) { pifMetrics.PropertyChanged -= PropertyChangedEventHandler; } }
public PIFRow(PIF pif) { this.pif = pif; PIF_metrics PIFMetrics = pif.PIFMetrics(); if (PIFMetrics != null) { vendor = PIFMetrics.vendor_name; device = PIFMetrics.device_name; busPath = PIFMetrics.pci_bus_path; } for (int i = 0; i < 10; i++) { Cells.Add(new DataGridViewTextBoxCell()); updateCell(i); } }
private void Update() { _cellName.Value = Pif.Name(); _cellMac.Value = Pif.MAC; _cellConnected.Value = Pif.Carrier() ? Messages.CONNECTED : Messages.DISCONNECTED; _cellSpeed.Value = Pif.Carrier() ? Pif.Speed() : Messages.HYPHEN; _cellDuplex.Value = Pif.Carrier() ? Pif.Duplex() : Messages.HYPHEN; var pifMetrics = Pif.PIFMetrics(); _cellVendor.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.vendor_name; _cellDevice.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.device_name; _cellBusPath.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.pci_bus_path; _cellFcoe.Value = Pif.FCoECapable().ToYesNoStringI18n(); if (!Pif.SriovCapable()) { _cellSriov.Value = Messages.NO; } else if (!Pif.IsSriovPhysicalPIF()) { _cellSriov.Value = Messages.SRIOV_NETWORK_SHOULD_BE_CREATED; } else { var networkSriov = Pif.Connection.Resolve(Pif.sriov_physical_PIF_of[0]); if (networkSriov == null || networkSriov.requires_reboot) { _cellSriov.Value = Messages.HOST_NEEDS_REBOOT_ENABLE_SRIOV; return; } PIF sriovLogicalPif = Pif.Connection.Resolve(networkSriov.logical_PIF); if (sriovLogicalPif == null || !sriovLogicalPif.currently_attached) { _cellSriov.Value = Messages.SRIOV_LOGICAL_PIF_UNPLUGGED; return; } var sriovSupported = ""; var action = new DelegatedAsyncAction(Pif.Connection, "", "", "", delegate(Session session) { try { var remainingCapacity = Network_sriov.get_remaining_capacity(session, Pif.sriov_physical_PIF_of[0].opaque_ref); sriovSupported = string.Format(Messages.REMAINING_VFS, remainingCapacity); } catch { sriovSupported = Messages.YES; } }, true); action.Completed += delegate { Program.Invoke(Program.MainWindow, () => _cellSriov.Value = sriovSupported); }; action.RunAsync(); } }