CP-12966 GPU drop-down to behave correctly when there is one vGPU type and no passthrough

This commit is contained in:
Stephen Turner 2015-07-13 16:27:18 +01:00
parent 86c755cba5
commit 8646a1ca3a
3 changed files with 12 additions and 2 deletions

View File

@ -125,7 +125,7 @@ namespace XenAdmin.Controls
VgpuTypes = vgpuType == null ? null : new[] {vgpuType};
if (vgpuType != null)
{
IsVgpuSubitem = gpuGroup.supported_VGPU_types.Count > 1;
IsVgpuSubitem = gpuGroup.HasVGpu;
IsFractionalVgpu = !vgpuType.IsPassthrough;
if (disabledVGpuTypes != null && disabledVGpuTypes.Select(t => t.opaque_ref).Contains(vgpuType.opaque_ref))
IsNotEnabledVgpu = true;

View File

@ -255,7 +255,7 @@ namespace XenAdmin.SettingsPanels
var disabledTypes = allTypes.FindAll(t => !enabledTypes.Exists(e => e.opaque_ref == t.opaque_ref));
if (allTypes.Count > 1)
if (gpu_group.HasVGpu)
{
allTypes.Sort((t1, t2) =>
{

View File

@ -30,6 +30,7 @@
*/
using System;
using System.Linq;
using XenAdmin;
namespace XenAPI
@ -54,6 +55,15 @@ namespace XenAPI
: String.Format(Messages.GPU_GROUP_NAME_AND_NO_OF_GPUS, Name, PGPUs.Count);
}
public bool HasVGpu
{
get
{
return Connection.ResolveAll(PGPUs).Any(pgpu => pgpu.HasVGpu);
}
}
#region IEquatable<GPU_group> Members
/// <summary>