diff --git a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs index 412a68d08..a433fb229 100644 --- a/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs +++ b/XenAdmin/Wizards/DRWizards/DRFailoverWizardStoragePage.cs @@ -329,7 +329,7 @@ namespace XenAdmin.Wizards.DRWizards try { - var metadataSrs = SR.ParseSRListXML(srProbeAction.Result); + var metadataSrs = srProbeAction.SRs ?? new List(); if (ScannedDevices.ContainsKey(deviceId)) { diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/CIFSFrontend.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/CIFSFrontend.cs index ddf062c59..740985563 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/CIFSFrontend.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/CIFSFrontend.cs @@ -167,7 +167,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends if (!action.Succeeded) return; - List SRs = SR.ParseSRListXML(action.Result); + var SRs = action.SRs ?? new List(); if (SRs.Count == 0) { // Disable box diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs index 15d4c540e..9b0e3b1fa 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs @@ -204,31 +204,13 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends private bool RunProbe(Host master, FibreChannelDescriptor srDescriptor, out List srs) { - srs = new List(); var action = new SrProbeAction(Connection, master, srDescriptor.SrType, srDescriptor.DeviceConfig); using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) dlg.ShowDialog(this); - if (action.Succeeded) - { - try - { - srs = action.ProbeExtResult != null ? SR.ParseSRList(action.ProbeExtResult) : SR.ParseSRListXML(action.Result); - return true; - } - catch - { - //ignore - } - } - - //CA-335356 special treatment of case where gfs2 cannot see the same devices as lvmohba - if (srDescriptor.SrType == SR.SRTypes.gfs2 && action.Exception is Failure f && f.ErrorDescription.Count > 1 && - f.ErrorDescription[0].StartsWith("SR_BACKEND_FAILURE") && f.ErrorDescription[1] == "DeviceNotFoundException") - return true; - - return false; + srs = action.SRs ?? new List(); + return action.Succeeded; } public override bool EnableNext() diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs index 3d892c767..1d234c48b 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs @@ -106,7 +106,10 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends HelpersGUI.PerformIQNCheck(); if (direction == PageLoadedDirection.Forward) + { textBoxIscsiHost.Focus(); + ResetAll(); + } } protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) @@ -175,7 +178,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends private bool RunProbe(Host master, SR.SRTypes srType, out List srs) { - srs = null; + srs = new List(); var dconf = GetDeviceConfig(srType); if (dconf == null) @@ -185,18 +188,10 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends using (var dialog = new ActionProgressDialog(action, ProgressBarStyle.Marquee) {ShowCancel = true}) dialog.ShowDialog(this); + srs = action.SRs ?? new List(); + if (action.Succeeded) - { - try - { - srs = action.ProbeExtResult != null ? SR.ParseSRList(action.ProbeExtResult) : SR.ParseSRListXML(action.Result); - return true; - } - catch (Exception) - { - return false; - } - } + return true; HandleFailure(action); return false; diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/VHDoNFS.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/VHDoNFS.cs index 9b7a7ba16..b1d00e016 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/VHDoNFS.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/VHDoNFS.cs @@ -175,7 +175,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends GetSupportedNfsVersionsAndSetUI(action.Result); - List SRs = SR.ParseSRListXML(action.Result); + var SRs = action.SRs ?? new List(); if (SRs.Count == 0) { // Disable box diff --git a/XenModel/Actions/SR/ISCSIPopulateIQNsAction.cs b/XenModel/Actions/SR/ISCSIPopulateIQNsAction.cs index fc6db4ab0..7865be744 100644 --- a/XenModel/Actions/SR/ISCSIPopulateIQNsAction.cs +++ b/XenModel/Actions/SR/ISCSIPopulateIQNsAction.cs @@ -225,8 +225,25 @@ namespace XenAdmin.Actions deviceConfig["chappassword"] = chapPassword; } - var probeResults = SR.probe_ext(Session, pool.master.opaque_ref, - deviceConfig, SR.SRTypes.gfs2.ToString(), new Dictionary()); + List probeResults; + try + { + probeResults = SR.probe_ext(Session, pool.master.opaque_ref, + deviceConfig, SR.SRTypes.gfs2.ToString(), new Dictionary()); + } + catch (Failure f) + { + //this will probably not happen for this scan, but be defensive + if (f.ErrorDescription.Count > 1 && f.ErrorDescription[0] == "ISCSILogin") + { + if (deviceConfig.ContainsKey("chapuser") && deviceConfig.ContainsKey("chappassword")) + throw new Exception(Messages.ACTION_ISCSI_IQN_SCANNING_GFS2); + + throw new Failure("SR_BACKEND_FAILURE_68"); + } + + throw; + } var results = new List(); var index = -1; diff --git a/XenModel/Actions/SR/ISCSIPopulateLunsAction.cs b/XenModel/Actions/SR/ISCSIPopulateLunsAction.cs index 39861a7a7..98d47cf53 100644 --- a/XenModel/Actions/SR/ISCSIPopulateLunsAction.cs +++ b/XenModel/Actions/SR/ISCSIPopulateLunsAction.cs @@ -66,7 +66,7 @@ namespace XenAdmin.Actions public ISCSIPopulateLunsAction(IXenConnection connection, string targetHost, UInt16 targetPort, string targetIQN, string chapUsername, string chapPassword) - : base(connection, string.Format(Messages.ACTION_ISCSI_LUN_SCANNING, targetHost)) + : base(connection, string.Format(Messages.ACTION_ISCSI_LUN_SCANNING, targetHost), true) { this.targetHost = targetHost; this.targetPort = targetPort; @@ -212,8 +212,24 @@ namespace XenAdmin.Actions deviceConfig["chappassword"] = chapPassword; } - var probeResults = SR.probe_ext(Session, pool.master.opaque_ref, - deviceConfig, SR.SRTypes.gfs2.ToString().ToLowerInvariant(), new Dictionary()); + List probeResults; + try + { + probeResults = SR.probe_ext(Session, pool.master.opaque_ref, + deviceConfig, SR.SRTypes.gfs2.ToString().ToLowerInvariant(), new Dictionary()); + } + catch (Failure f) + { + if (f.ErrorDescription.Count > 1 && f.ErrorDescription[0] == "ISCSILogin") + { + if (deviceConfig.ContainsKey("chapuser") && deviceConfig.ContainsKey("chappassword")) + throw new Failure(Messages.ACTION_ISCSI_IQN_SCANNING_GFS2); + + throw new Failure("SR_BACKEND_FAILURE_68"); + } + + throw; + } var results = new List(); foreach (var probeResult in probeResults) diff --git a/XenModel/Actions/SR/SrProbeAction.cs b/XenModel/Actions/SR/SrProbeAction.cs index bac6d97f2..f0ac9e512 100644 --- a/XenModel/Actions/SR/SrProbeAction.cs +++ b/XenModel/Actions/SR/SrProbeAction.cs @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ -using System; using System.Collections.Generic; using XenAdmin.Network; using XenAPI; @@ -41,18 +40,17 @@ namespace XenAdmin.Actions public class SrProbeAction : PureAsyncAction { private readonly Host host; - public readonly SR.SRTypes SrType; - private readonly Dictionary dconf; + private readonly Dictionary dconf; + private readonly Dictionary smconf; - public List ProbeExtResult; - - private readonly Dictionary smconf; + public SR.SRTypes SrType { get; } + public List SRs { get; private set; } /// /// Won't appear in the program history (SuppressHistory == true). /// public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, - Dictionary dconf, Dictionary smconf) + Dictionary dconf, Dictionary smconf = null) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; @@ -82,27 +80,43 @@ namespace XenAdmin.Actions Description = string.Format(Messages.ACTION_SR_SCANNING, SR.getFriendlyTypeName(srType), target); - this.smconf = smconf; - } - - public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary dconf) - : this(connection, host, srType, dconf, new Dictionary()) - { + this.smconf = smconf ?? new Dictionary(); } protected override void Run() { if (SrType != SR.SRTypes.gfs2) { - RelatedTask = SR.async_probe(this.Session, host.opaque_ref, + RelatedTask = SR.async_probe(Session, host.opaque_ref, dconf, SrType.ToString().ToLowerInvariant(), smconf); PollToCompletion(); + SRs = SR.ParseSRListXML(Result); } else { - ProbeExtResult = SR.probe_ext(this.Session, host.opaque_ref, - dconf, SrType.ToString().ToLowerInvariant(), smconf); + try + { + var result = SR.probe_ext(this.Session, host.opaque_ref, + dconf, SrType.ToString().ToLowerInvariant(), smconf); + SRs = SR.ParseSRList(result); + } + catch (Failure f) + { + if (f.ErrorDescription.Count > 1 && f.ErrorDescription[0].StartsWith("SR_BACKEND_FAILURE") && + f.ErrorDescription[1] == "DeviceNotFoundException") + { + //Ignore: special treatment of case where gfs2 cannot see the same devices as lvmohba (CA-335356) + } + else if (f.ErrorDescription.Count > 1 && f.ErrorDescription[0] == "ISCSILogin" && + dconf.ContainsKey("chapuser") && dconf.ContainsKey("chappassword")) + { + //Ignore: special treatment of gfs2 chap authentication failure (CA-337280) + } + else + throw; + } } + Description = Messages.ACTION_SR_SCAN_SUCCESSFUL; } } diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index fa36861c9..a3ef565ad 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -1518,6 +1518,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Thinly provisioned (GFS2) SRs with CHAP authentication are not supported.. + /// + public static string ACTION_ISCSI_IQN_SCANNING_GFS2 { + get { + return ResourceManager.GetString("ACTION_ISCSI_IQN_SCANNING_GFS2", resourceCulture); + } + } + /// /// Looks up a localized string similar to Scanning for LUNs on iSCSI filer {0}. /// @@ -21281,7 +21290,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Invalid target host. + /// Looks up a localized string similar to Invalid target host.. /// public static string INVALID_HOST { get { diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index b4c922334..28c0a817e 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -603,6 +603,9 @@ Scanning for IQNs on iSCSI filer {0} + + Thinly provisioned (GFS2) SRs with CHAP authentication are not supported. + Scanning for LUNs on iSCSI filer {0}