]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: fix nodeGetInfo failures caused by long CPU names
authorMatt Coleman <mcoleman@datto.com>
Mon, 5 Oct 2020 16:20:07 +0000 (12:20 -0400)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 9 Oct 2020 07:22:48 +0000 (09:22 +0200)
Some CPU model names were too long for _virNodeInfo.model.
For example: Intel Xeon CPU E5-2620 v2 @ 2.10GHz
This commit removes the clock frequency suffix.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_driver.c

index b57325f2a5893d9a4d1bab3a9bcbca28c6130749..9bbc2f67fbc08260b096da66d38c26b047de1d51 100644 (file)
@@ -285,6 +285,10 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
         } else if (STRPREFIX(tmp, "(TM)")) {
             memmove(tmp, tmp + 4, strlen(tmp + 4) + 1);
             continue;
+        } else if (STRPREFIX(tmp, " @ ")) {
+            /* Remove " @ X.YZGHz" from the end. */
+            *tmp = '\0';
+            break;
         }
 
         ++tmp;