summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Schöning <tschoening@am-soft.de>2017-08-30 18:36:57 +0200
committerThorsten Schöning <tschoening@am-soft.de>2017-08-30 18:36:57 +0200
commit7e2d7e7431b7ba6e8dd74cc76c55018d51206fa2 (patch)
treee54fb274e0de16702bee1434305014b62b8f68e6
parent65ebcedd3079fd80a6359c7e10651b0d17cc55ed (diff)
downloadphpvirtualbox-7e2d7e7431b7ba6e8dd74cc76c55018d51206fa2.zip
phpvirtualbox-7e2d7e7431b7ba6e8dd74cc76c55018d51206fa2.tar.gz
phpvirtualbox-7e2d7e7431b7ba6e8dd74cc76c55018d51206fa2.tar.bz2
#53: Some CPUs might have gaps in their IDs and querying VirtualBox for processor descriptions for unknown CPU IDs results in an error. Therefore a loop is not the correct strategy to query details of all CPUs, but instead one would need to get all CPU IDs used in the system and iterate those. Even "vboxmanage list hostinfo" seems to be doing that wrong:
https://www.virtualbox.org/ticket/17045 This patch is a quick and dirty WORKAROUND for this problem, because more people seem to be affected by it. Querying only ID 0 will most likely succeed, but even that ID might be missing of course. Additionally, it is very likely that people only use exactly the same CPUs in multi socket systems and with only one socket I couldn't even thing of a reason why the description between the cores of one socket should be different. Keeping the loop is necessary and easy to let phpVirtualBox have available all expected data and performance simply shouldn't be an issue.
-rw-r--r--endpoints/lib/vboxconnector.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/endpoints/lib/vboxconnector.php b/endpoints/lib/vboxconnector.php
index 8c4953c..68c3499 100644
--- a/endpoints/lib/vboxconnector.php
+++ b/endpoints/lib/vboxconnector.php
@@ -3391,7 +3391,8 @@ class vboxconnector {
* Processors
*/
for($i = 0; $i < $host->processorCount; $i++) {
- $response['cpus'][$i] = $host->getProcessorDescription($i);
+ // TODO https://github.com/phpvirtualbox/phpvirtualbox/issues/53
+ $response['cpus'][$i] = $host->getProcessorDescription(0);
}
/*