diff --git a/XenAdmin/Controls/ComboBoxes/VgpuComboBox.cs b/XenAdmin/Controls/ComboBoxes/VgpuComboBox.cs index a585e448e..d5bce66e6 100644 --- a/XenAdmin/Controls/ComboBoxes/VgpuComboBox.cs +++ b/XenAdmin/Controls/ComboBoxes/VgpuComboBox.cs @@ -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; diff --git a/XenAdmin/SettingsPanels/GpuEditPage.cs b/XenAdmin/SettingsPanels/GpuEditPage.cs index a8454b31d..4230187f2 100644 --- a/XenAdmin/SettingsPanels/GpuEditPage.cs +++ b/XenAdmin/SettingsPanels/GpuEditPage.cs @@ -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) => { diff --git a/XenModel/XenAPI-Extensions/GPU_group.cs b/XenModel/XenAPI-Extensions/GPU_group.cs index 6c5793288..79fe0c0c8 100644 --- a/XenModel/XenAPI-Extensions/GPU_group.cs +++ b/XenModel/XenAPI-Extensions/GPU_group.cs @@ -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 Members ///