XenAdmin.Wizards.NewSRWizard_Pages.Frontends.LVMoHBA.FiberChannelScan C# (CSharp) Method

FiberChannelScan() public method

public FiberChannelScan ( IWin32Window owner, IXenConnection connection, List &devices ) : bool
owner IWin32Window
connection IXenConnection
devices List
return bool
        public bool FiberChannelScan(IWin32Window owner, IXenConnection connection, out List<FibreChannelDevice> devices)
        {
            devices = new List<FibreChannelDevice>();

            Host master = Helpers.GetMaster(connection);
            if (master == null)
                return false;

            FibreChannelProbeAction action = new FibreChannelProbeAction(master, SrType);
            using (var  dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee))
                dialog.ShowDialog(owner); //Will block until dialog closes, action completed

            if (!action.Succeeded)
                return false;

            try
            {
                devices = FibreChannelProbeParsing.ProcessXML(action.Result);

                if (devices.Count == 0)
                {
                    using (var dlg = new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_NO_RESULTS, Messages.XENCENTER)))
                    {
                        dlg.ShowDialog();
                    }

                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                log.Debug("Exception parsing result of fibre channel scan", e);
                log.Debug(e, e);
                using (var dlg = new ThreeButtonDialog(
                    new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.FIBRECHANNEL_XML_ERROR, Messages.XENCENTER)))
                {
                    dlg.ShowDialog();
                }

                return false;
            }
        }

Usage Example

コード例 #1
0
ファイル: NewSRWizard.cs プロジェクト: agimofcarmen/xenadmin
 private bool SetFCDevicesOnLVMoHBAPage(LVMoHBA page)
 {
     List<FibreChannelDevice> devices;
     var success = page.FiberChannelScan(this, xenConnection, out devices);
     page.FCDevices = devices;
     return success;
 }