Example #1
0
        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;
            }
        }
        private bool FiberChannelScan(List<FibreChannelDevice> devices)
        {
            Host master = Helpers.GetMaster(Connection);
            if (master == null)
                return false;

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

            if (!action.Succeeded)
                return false;

            try
            {
                FibreChannelProbeParsing.ProcessXML(action.Result, devices);
                return true;
            }
            catch (Exception e)
            {
                log.Debug("Exception parsing result of fibre channel scan", e);
                log.Debug(e, e);
                return false;
            }
        }