private void comboBoxIscsiLuns_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxIscsiLuns.SelectedItem as string == Messages.SELECT_TARGET_LUN) { spinnerIconAtTargetLun.StopSpinning(); HideErrors(); } else { spinnerIconAtTargetLun.ShowSuccessImage(); var isLunInUse = SrUsingLunExists(out var sr);//in this or other connected pools if (isLunInUse) { ShowError(errorIconAtTargetLUN, errorLabelAtTargetLUN, LVMoIsciWarningDialog.GetSrInUseMessage(sr)); } else { HideErrors(); } } UpdateButtons(); }
private bool ExamineIscsiProbeResults(SR.SRTypes currentSrType, List <SR.SRInfo> srs) { _srToIntroduce = null; if (srs == null) { return(false); } // There should be 0 or 1 SRs on the LUN System.Diagnostics.Debug.Assert(srs.Count == 0 || srs.Count == 1); try { if (!string.IsNullOrEmpty(SrWizardType.UUID)) { // Check LUN contains correct SR if (srs.Count == 1 && srs[0].UUID == SrWizardType.UUID) { _srToIntroduce = srs[0]; SrType = currentSrType; // the type of the existing SR return(true); } ShowError(errorIconAtTargetLUN, errorLabelAtTargetLUN, string.Format(Messages.INCORRECT_LUN_FOR_SR, SrWizardType.SrName)); return(false); } if (srs.Count == 0) { if (!SrWizardType.AllowToCreateNewSr) { using (var dlg = new ErrorDialog(Messages.NEWSR_LUN_HAS_NO_SRS)) dlg.ShowDialog(this); return(false); } if (Program.RunInAutomatedTestMode) { return(true); } // SR creation is allowed; ask the user if they want to proceed and format. using (var dlog = new LVMoIsciWarningDialog(Connection, null, currentSrType, SrType)) { dlog.ShowDialog(this); return(dlog.SelectedOption == LVMoHBAWarningDialog.UserSelectedOption.Format); } } if (Program.RunInAutomatedTestMode) { return(true); } // offer to attach it, or format it to create a new SR, or cancel SR.SRInfo srInfo = srs[0]; using (var dlog = new LVMoIsciWarningDialog(Connection, srInfo, currentSrType, SrType)) { dlog.ShowDialog(this); switch (dlog.SelectedOption) { case LVMoHBAWarningDialog.UserSelectedOption.Reattach: _srToIntroduce = srInfo; SrType = currentSrType; // the type of the existing SR return(true); case LVMoHBAWarningDialog.UserSelectedOption.Format: return(true); default: return(false); } } } catch { // We really want to prevent the user getting to the next step if there is any kind of // exception here, since clicking 'finish' might destroy data: require another probe. return(false); } }