[libvirt] [PATCH] Bug fix: Allow sysinfo to display processor information

Prerna Saxena prerna at linux.vnet.ibm.com
Mon Feb 6 08:36:24 UTC 2012


From: Prerna Saxena <prerna at linux.vnet.ibm.com>
Date: Mon, 6 Feb 2012 13:46:10 +0530
Subject: [PATCH] Bugfix: Allow sysinfo to display 'processor' information

Calls to virSysinfoParseBIOS(), virSysinfoParseSystem() would update
the buffer pointer 'base', so the processor information would be lost
before virSysinfoParseProcessor() was called. Sysinfo would therefore
not be able to display processor details -- It only described <bios>,
<system> and <memory_device> details.

Before the fix:
---------------
virsh # sysinfo
<sysinfo type='smbios'>
  <bios>
    ....
  </bios>
  <system>
    ....
  </system>
  <memory_device>
    ....
  </memory_device>

After the fix:
-------------
virsh # sysinfo
<sysinfo type='smbios'>
  <bios>
    ....
  </bios>
  <system>
    ....
  </system>
  <processor>
    ....
  </processor>
  <memory_device>
    ....
  </memory_device>
---
 src/util/sysinfo.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index de3108a..d92d655 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -483,16 +483,17 @@ virSysinfoRead(void) {
 
     base = outbuf;
 
+    ret->nprocessor = 0;
+    ret->processor = NULL;
+    if ((base = virSysinfoParseProcessor(base, ret)) == NULL)
+        goto no_memory;
+
     if ((base = virSysinfoParseBIOS(base, ret)) == NULL)
         goto no_memory;
 
     if ((base = virSysinfoParseSystem(base, ret)) == NULL)
         goto no_memory;
 
-    ret->nprocessor = 0;
-    ret->processor = NULL;
-    if ((base = virSysinfoParseProcessor(base, ret)) == NULL)
-        goto no_memory;
 
     ret->nmemory = 0;
     ret->memory = NULL;
-- 
1.7.3.1



-- 
Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India




More information about the libvir-list mailing list