From: Matt Coleman <matt@xxxxxxxxx> There are two specific WQL queries we're using to get either a list of virtual machines or the hypervisor host itself from Msvm_ComputerSystem. Those queries rely on filtering results based on the "Description" field. Since the "Description" field is locale sensitive, the queries will fail if the Windows host is using a language pack. While the WSMAN spec allows the client to set the requested locale (and it is supported since openwsman 2.6.x), the Windows WinRM service does not respect this setting: it returns non-English strings despite the WSMAN request properly setting the locale to 'en-US'. Therefore, this patch changes the WQL query to make use of the "__SERVER" field to stop relying on English strings in queries and side step the issue. Co-authored-by: Dawid Zamirski <dzamirski@xxxxxxxxx> Signed-off-by: Matt Coleman <matt@xxxxxxxxx> --- NEWS.rst | 4 ++++ src/hyperv/hyperv_wmi_classes.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 7663cf4208..5c9ab4a964 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -17,6 +17,10 @@ v6.9.0 (unreleased) * **Bug fixes** + * hyperv: ensure WQL queries work in all locales + + Relying on the "Description" field caused queries to fail on non-"en-US" + systems. The queries have been updated to avoid using localized strings. v6.8.0 (2020-10-01) =================== diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h index a19b6a656d..7465684d6e 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -44,10 +44,10 @@ */ #define MSVM_COMPUTERSYSTEM_WQL_VIRTUAL \ - "Description = \"Microsoft Virtual Machine\" " + "Name != __SERVER " #define MSVM_COMPUTERSYSTEM_WQL_PHYSICAL \ - "Description = \"Microsoft Hosting Computer System\" " + "Name = __SERVER " #define MSVM_COMPUTERSYSTEM_WQL_ACTIVE \ "(EnabledState != 0 and EnabledState != 3 and EnabledState != 32769) " -- 2.27.0