]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: Rename hypervGetProcessorsByName() to hypervGetProcessorList()
authorJonathon Jongsma <jjongsma@redhat.com>
Fri, 13 Feb 2026 17:00:51 +0000 (11:00 -0600)
committerJonathon Jongsma <jjongsma@redhat.com>
Wed, 3 Jun 2026 14:48:47 +0000 (09:48 -0500)
Make the 'name' parameter optional and return all processors from the
host if name is not specified.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_driver.c

index 1031076a2872de8b0435998098ccb055108079f2..7cd83e7565813c295d7420318fa8872873fc6077 100644 (file)
@@ -56,15 +56,20 @@ VIR_LOG_INIT("hyperv.hyperv_driver");
  */
 
 static int
-hypervGetProcessorsByName(hypervPrivate *priv, const char *name,
-                          Win32_Processor **processorList)
+hypervGetProcessorList(hypervPrivate *priv, const char *computer_name,
+                       Win32_Processor **processorList)
 {
     g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
-    virBufferEscapeSQL(&query,
-                       "ASSOCIATORS OF {Win32_ComputerSystem.Name='%s'} "
-                       "WHERE AssocClass = Win32_ComputerSystemProcessor "
-                       "ResultClass = Win32_Processor",
-                       name);
+    if (computer_name) {
+        virBufferEscapeSQL(&query,
+                           "ASSOCIATORS OF {Win32_ComputerSystem.Name='%s'} "
+                           "WHERE AssocClass = Win32_ComputerSystemProcessor "
+                           "ResultClass = Win32_Processor",
+                           computer_name);
+
+    } else {
+        virBufferAddLit(&query, WIN32_PROCESSOR_WQL_SELECT);
+    }
 
     if (hypervGetWmiClass(Win32_Processor, processorList) < 0)
         return -1;
@@ -72,7 +77,7 @@ hypervGetProcessorsByName(hypervPrivate *priv, const char *name,
     if (!*processorList) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Could not look up processor(s) on '%1$s'"),
-                       name);
+                       computer_name);
         return -1;
     }
 
@@ -1933,7 +1938,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
     if (hypervGetPhysicalSystemList(priv, &computerSystem) < 0)
         return -1;
 
-    if (hypervGetProcessorsByName(priv, computerSystem->data->Name, &processorList) < 0) {
+    if (hypervGetProcessorList(priv, computerSystem->data->Name, &processorList) < 0) {
         return -1;
     }