[PATCH] Topology fix for "no cpus"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was able to test on a 128-way NUMA box and found a bug. My code did not handle the case of no cpus being associated with a node. I decided to represent (pretty straightforward decision :-) no cpus as follows in the xml...


<cell id='2'>
       <cpus num='0'>
       </cpus>
     </cell>

Here is the patch...

Signed-off-by: Beth Kon <eak@xxxxxxxxxx>





--
Elizabeth Kon (Beth)
IBM Linux Technology Center
Open Hypervisor Team
email: eak@xxxxxxxxxx

diff -urpN libvirt.orig/src/xend_internal.c libvirt/src/xend_internal.c
--- libvirt.orig/src/xend_internal.c	2007-10-03 19:27:25.000000000 -0700
+++ libvirt/src/xend_internal.c	2007-10-04 05:41:13.000000000 -0700
@@ -1989,6 +1989,15 @@ sexpr_to_xend_topology_xml(virConnectPtr
         /* get list of cpus associated w/ single cell */
         while (1) {
             if ((len = getNumber(offset, &cpuNum)) < 0) {
+                if (!strncmp (offset, "no cpus", 7)){
+                    *(cpuIdsPtr++) = -1;
+                    break;
+                } else {
+                    virXendError(conn, VIR_ERR_XEN_CALL, "topology string syntax error");
+                    goto error;
+                }
+            }
+            if ((len = getNumber(offset, &cpuNum)) < 0) {
                 virXendError(conn, VIR_ERR_XEN_CALL, " topology string syntax error");
                 goto error;
             }
@@ -2058,6 +2067,8 @@ sexpr_to_xend_topology_xml(virConnectPtr
         if (r == -1) goto vir_buffer_failed;
 
         for (i = 0; i < cellCpuCount; i++) {
+            if (*(iCpuIdsPtr + i) == -1)
+                break;
             r = virBufferVSprintf (xml, "\
            <cpu id='%d'/>\n", *(iCpuIdsPtr + i));
         if (r == -1) goto vir_buffer_failed;
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]