예제 #1
0
        private void buttonIscsiPopulateIQNs_Click(object sender, EventArgs e)
        {
            buttonIscsiPopulateIQNs.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Disable the Discover LUNs button because we have no IQNs
            buttonIscsiPopulateLUNs.Enabled = false;
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(connection,
                                                                      getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(connection,
                                                                      getIscsiHost(), getIscsiPort(), null, null);
            }

            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;
            Dialogs.ActionProgressDialog dialog = new Dialogs.ActionProgressDialog(
                IscsiPopulateIqnsAction, ProgressBarStyle.Marquee);
            dialog.ShowCancel = true;
            dialog.ShowDialog(this);
        }
예제 #2
0
        private void buttonIscsiPopulateIQNs_Click(object sender, EventArgs e)
        {
            buttonIscsiPopulateIQNs.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Disable the Discover LUNs button because we have no IQNs
            buttonIscsiPopulateLUNs.Enabled = false;
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                                                                      getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                                                                      getIscsiHost(), getIscsiPort(), null, null);
            }

            ActionProgressDialog dialog = new ActionProgressDialog(IscsiPopulateIqnsAction, ProgressBarStyle.Marquee);

            //CA-80178: need to register Completed after the action has been added to the dialog, otherwise
            //the handler will be called before the dialog is closed and the focus won't be set on the right control.
            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;
            dialog.ShowCancel = true;
            dialog.ShowDialog(this);
        }
예제 #3
0
        private void PopulateIqnsAction_Completed_(ISCSIPopulateIQNsAction action)
        {
            if (action == null)
            {
                return;
            }

            Program.AssertOnEventThread();

            _populateIqnsAction = null;
            EnableInputControls();

            if (!action.Succeeded)
            {
                spinnerIconAtScanTargetHostButton.StopSpinning();
                HandleFailure(action);
                UpdateButtons();
                return;
            }

            // If no IQNs are found do nothing; the ActionProgressDialog will have shown Messages.NEWSR_NO_IQNS_FOUND
            var validIqns = action.IQNs.Where(info => !string.IsNullOrEmpty(info.TargetIQN)).ToList();

            if (validIqns.Count == 0)
            {
                UpdateButtons();
                return;
            }

            int width = comboBoxIscsiIqns.Width;

            comboBoxIscsiIqns.Items.Add(Messages.SELECT_TARGET_IQN);

            foreach (IScsiIqnInfo iqnInfo in validIqns)
            {
                var toString = string.Format("{0} ({1}:{2})", iqnInfo.TargetIQN, iqnInfo.IpAddress, iqnInfo.Port);
                comboBoxIscsiIqns.Items.Add(new ToStringWrapper <IScsiIqnInfo>(iqnInfo, toString));
                width = Math.Max(width, Drawing.MeasureText(toString, comboBoxIscsiIqns.Font).Width);
            }

            // Set the combo box dropdown width to accommodate the widest item (within reason)
            comboBoxIscsiIqns.DropDownWidth = Math.Min(width, Int16.MaxValue);

            comboBoxIscsiIqns.SelectedItem = comboBoxIscsiIqns.Items.Count == 2
                ? comboBoxIscsiIqns.Items[1]
                : Messages.SELECT_TARGET_IQN;

            labelTargetIqn.Enabled    = true;
            comboBoxIscsiIqns.Enabled = true;
            comboBoxIscsiIqns.Focus();
            spinnerIconAtScanTargetHostButton.ShowSuccessImage();
            UpdateButtons();
        }
예제 #4
0
        private void buttonScanTargetHost_Click(object sender, EventArgs e)
        {
            HideErrors();
            ResetIqns();
            ResetLuns();

            DisableAllInputControls();
            spinnerIconAtScanTargetHostButton.StartSpinning();

            _populateIqnsAction = SrType == SR.SRTypes.gfs2
                ? new Gfs2PopulateIQNsAction(Connection, getIscsiHost(), getIscsiPort(), ChapUser, ChapPassword)
                : new ISCSIPopulateIQNsAction(Connection, getIscsiHost(), getIscsiPort(), ChapUser, ChapPassword);

            _populateIqnsAction.Completed += PopulateIqnsAction_Completed;
            _populateIqnsAction.RunAsync();
            UpdateButtons();
        }
예제 #5
0
        private void IscsiPopulateIqnsAction_Completed_(object o)
        {
            Program.AssertOnEventThread();
            ISCSIPopulateIQNsAction action = (ISCSIPopulateIQNsAction)o;

            if (action.Succeeded)
            {
                if (action.IQNs.Length == 0)
                {
                    // Do nothing: ActionProgressDialog will show Messages.NEWSR_NO_IQNS_FOUND
                }
                else
                {
                    int width = comboBoxIscsiIqns.Width;
                    foreach (Actions.IScsiIqnInfo iqnInfo in action.IQNs)
                    {
                        if (!String.IsNullOrEmpty(iqnInfo.TargetIQN))
                        {
                            String toString = String.Format("{0} ({1}:{2})", iqnInfo.TargetIQN, iqnInfo.IpAddress, iqnInfo.Port);
                            comboBoxIscsiIqns.Items.Add(new ToStringWrapper <IScsiIqnInfo>(iqnInfo, toString));
                            width = Math.Max(width, Drawing.MeasureText(toString, comboBoxIscsiIqns.Font).Width);
                        }
                    }
                    // Set the combo box dropdown width to accommodate the widest item (within reason)
                    comboBoxIscsiIqns.DropDownWidth = Math.Min(width, Int16.MaxValue);

                    if (comboBoxIscsiIqns.Items.Count > 0)
                    {
                        comboBoxIscsiIqns.SelectedItem  = comboBoxIscsiIqns.Items[0];
                        comboBoxIscsiIqns.Enabled       = true;
                        buttonIscsiPopulateLUNs.Enabled = true;
                    }
                    comboBoxIscsiIqns.Focus();
                }
            }
            else
            {
                Failure failure = action.Exception as Failure;
                if (failure != null && failure.ErrorDescription[0] == "SR_BACKEND_FAILURE_140")
                {
                    labelIscsiInvalidHost.Visible = true;
                    textBoxIscsiHost.Focus();
                }
            }
            buttonIscsiPopulateIQNs.Enabled = true;
        }
예제 #6
0
        private void scanTargetHostButton_Click(object sender, EventArgs e)
        {
            HideAllErrorIconsAndLabels();
            spinnerIconAtTargetIqn.Visible = false;
            spinnerIconAtTargetLun.Visible = false;
            spinnerIcon1.Visible           = false;
            spinnerIcon2.Visible           = false;

            spinnerIconAtScanTargetHostButton.StartSpinning();

            scanTargetHostButton.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            UpdateButtons();

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                                                                      getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                                                                      getIscsiHost(), getIscsiPort(), null, null);
            }

            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;

            controlDisabler.Reset();
            controlDisabler.SaveOrUpdateEnabledStates(UserInputControls);
            controlDisabler.DisableAllControls();

            scanTargetHostButton.Enabled = false;
            IscsiPopulateIqnsAction.RunAsync();
        }
        private void buttonIscsiPopulateIQNs_Click(object sender, EventArgs e)
        {
            buttonIscsiPopulateIQNs.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Disable the Discover LUNs button because we have no IQNs
            buttonIscsiPopulateLUNs.Enabled = false;
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(connection,
                    getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(connection,
                    getIscsiHost(), getIscsiPort(), null, null);
            }

            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;
            Dialogs.ActionProgressDialog dialog = new Dialogs.ActionProgressDialog(
                IscsiPopulateIqnsAction, ProgressBarStyle.Marquee);
            dialog.ShowCancel = true;
            dialog.ShowDialog(this);
        }
예제 #8
0
        private void IscsiPopulateIqnsAction_Completed_(object o)
        {
            Program.AssertOnEventThread();
            ISCSIPopulateIQNsAction action = (ISCSIPopulateIQNsAction)o;

            controlDisabler.RestoreEnabledOnAllControls();

            if (action.Succeeded)
            {
                if (action.IQNs.Length == 0)
                {
                    // Do nothing: ActionProgressDialog will show Messages.NEWSR_NO_IQNS_FOUND
                }
                else
                {
                    int width = comboBoxIscsiIqns.Width;

                    comboBoxIscsiIqns.Items.Add(Messages.SELECT_TARGET_IQN);

                    foreach (Actions.IScsiIqnInfo iqnInfo in action.IQNs)
                    {
                        if (!String.IsNullOrEmpty(iqnInfo.TargetIQN))
                        {
                            String toString = String.Format("{0} ({1}:{2})", iqnInfo.TargetIQN, iqnInfo.IpAddress, iqnInfo.Port);
                            comboBoxIscsiIqns.Items.Add(new ToStringWrapper <IScsiIqnInfo>(iqnInfo, toString));
                            width = Math.Max(width, Drawing.MeasureText(toString, comboBoxIscsiIqns.Font).Width);
                        }
                    }
                    // Set the combo box dropdown width to accommodate the widest item (within reason)
                    comboBoxIscsiIqns.DropDownWidth = Math.Min(width, Int16.MaxValue);

                    if (comboBoxIscsiIqns.Items.Count > 0)
                    {
                        comboBoxIscsiIqns.SelectedItem = Messages.SELECT_TARGET_IQN;
                        comboBoxIscsiIqns.Enabled      = true;
                        labelIscsiIQN.Enabled          = true;
                        iSCSITargetGroupBox.Enabled    = true;
                    }

                    spinnerIconAtScanTargetHostButton.DisplaySucceededImage();

                    comboBoxIscsiIqns.Focus();
                }
            }
            else
            {
                spinnerIconAtScanTargetHostButton.Visible = false;

                Failure failure = action.Exception as Failure;
                if (failure != null && failure.ErrorDescription[0] == "SR_BACKEND_FAILURE_140")
                {
                    errorIconAtHostOrIP.Visible  = true;
                    errorLabelAtHostname.Text    = Messages.INVALID_HOST;
                    errorLabelAtHostname.Visible = true;
                    textBoxIscsiHost.Focus();
                }
                else if (failure != null && failure.ErrorDescription[0] == "SR_BACKEND_FAILURE_141")
                {
                    errorIconAtHostOrIP.Visible  = true;
                    errorLabelAtHostname.Text    = Messages.SR_UNABLE_TO_CONNECT_TO_SCSI_TARGET;
                    errorLabelAtHostname.Visible = true;
                    textBoxIscsiHost.Focus();
                }
                else if (failure != null && failure.ErrorDescription[0] == "SR_BACKEND_FAILURE_68")
                {
                    errorIconAtHostOrIP.Visible  = true;
                    errorLabelAtHostname.Text    = Messages.LOGGING_IN_TO_THE_ISCSI_TARGET_FAILED;
                    errorLabelAtHostname.Visible = true;
                    textBoxIscsiHost.Focus();
                }
                else
                {
                    errorIconAtHostOrIP.Visible  = true;
                    errorLabelAtHostname.Text    = failure.ErrorDescription.Count > 2 ? failure.ErrorDescription[2] : failure.ErrorDescription[0];
                    errorLabelAtHostname.Visible = true;
                    textBoxIscsiHost.Focus();
                }
            }
            scanTargetHostButton.Enabled = true;
        }
예제 #9
0
        private void scanTargetHostButton_Click(object sender, EventArgs e)
        {
            HideAllErrorIconsAndLabels();
            spinnerIconAtTargetIqn.Visible = false;
            spinnerIconAtTargetLun.Visible = false;

            spinnerIconAtScanTargetHostButton.StartSpinning();

            scanTargetHostButton.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            UpdateButtons();

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                    getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                    getIscsiHost(), getIscsiPort(), null, null);
            }

            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;

            controlDisabler.Reset();
            controlDisabler.SaveOrUpdateEnabledStates(UserInputControls);
            controlDisabler.DisableAllControls();

            scanTargetHostButton.Enabled = false;
            IscsiPopulateIqnsAction.RunAsync();
        }
예제 #10
0
        private void buttonIscsiPopulateIQNs_Click(object sender, EventArgs e)
        {
            buttonIscsiPopulateIQNs.Enabled = false;
            // For this button to be enabled, we must be Miami or newer
            comboBoxIscsiIqns.Items.Clear();
            // Clear LUNs as they may no longer be valid
            ClearLunMapAndCombo();
            // Disable the Discover LUNs button because we have no IQNs
            buttonIscsiPopulateLUNs.Enabled = false;
            // Cancel any LUN scan in progress, as it is no longer meaningful
            if (IscsiPopulateLunsAction != null)
            {
                IscsiPopulateLunsAction.Cancel();
            }

            if (IscsiUseChapCheckBox.Checked)
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                    getIscsiHost(), getIscsiPort(), IScsiChapUserTextBox.Text, IScsiChapSecretTextBox.Text);
            }
            else
            {
                IscsiPopulateIqnsAction = new ISCSIPopulateIQNsAction(Connection,
                    getIscsiHost(), getIscsiPort(), null, null);
            }

            ActionProgressDialog dialog = new ActionProgressDialog(IscsiPopulateIqnsAction, ProgressBarStyle.Marquee);
            //CA-80178: need to register Completed after the action has been added to the dialog, otherwise
            //the handler will be called before the dialog is closed and the focus won't be set on the right control.
            IscsiPopulateIqnsAction.Completed += IscsiPopulateIqnsAction_Completed;
            dialog.ShowCancel = true;
            dialog.ShowDialog(this);
        }