CP-35898: Do not show SMAPIv3 SRs as of unknown type if the type can be inferred from the SM plugin.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2021-02-24 01:20:38 +00:00
parent a109f5f22d
commit 29f3f9cd33

View File

@ -120,7 +120,19 @@ namespace XenAPI
public string FriendlyTypeName()
{
return GetFriendlyTypeName(GetSRType(false));
var srType = GetSRType(false);
if (srType == SRTypes.unknown)
{
var sm = SM.GetByType(Connection, type);
if (sm != null &&
Version.TryParse(sm.required_api_version, out var smapiVersion) &&
smapiVersion.CompareTo(new Version(3, 0)) >= 0)
return !string.IsNullOrEmpty(sm.name_label) ? sm.name_label : type;
}
return GetFriendlyTypeName(srType);
}
/// <summary>