From 9c408984e16caf259b9d37428553e7d37f0424dc Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 27 Jul 2020 03:14:23 -0500 Subject: [PATCH] differentiate between multiple of same gpu names --- plugins/dynamix.vm.manager/include/VMMachines.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/dynamix.vm.manager/include/VMMachines.php b/plugins/dynamix.vm.manager/include/VMMachines.php index 0c5bf5424..bd1864b77 100644 --- a/plugins/dynamix.vm.manager/include/VMMachines.php +++ b/plugins/dynamix.vm.manager/include/VMMachines.php @@ -79,8 +79,16 @@ foreach ($vms as $vm) { $graphics = 'VNC:auto'; } elseif (!empty($arrConfig['gpu'])) { $arrValidGPUDevices = getValidGPUDevices(); - foreach ($arrConfig['gpu'] as $arrGPU) foreach ($arrValidGPUDevices as $arrDev) { - if ($arrGPU['id'] == $arrDev['id']) $graphics .= $arrDev['name']."\n"; + foreach ($arrConfig['gpu'] as $arrGPU) { + foreach ($arrValidGPUDevices as $arrDev) { + if ($arrGPU['id'] == $arrDev['id']) { + if (count(array_filter($arrValidGPUDevices, function($v) use ($arrDev) { return $v['name'] == $arrDev['name']; })) > 1) { + $graphics .= $arrDev['name'].' ('.$arrDev['id'].')'."\n"; + } else { + $graphics .= $arrDev['name']."\n"; + } + } + } } $graphics = str_replace("\n", "
", trim($graphics)); } @@ -161,4 +169,4 @@ foreach ($vms as $vm) { echo ""; } echo "\0".implode($menu).implode($kvm); -?> \ No newline at end of file +?>