<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 24/11/2015 06:26, Suresh Babu Angadi
      wrote:<br>
    </div>
    <blockquote cite="mid:56541F3D.3090703@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <br>
      <br>
      <div class="moz-cite-prefix">On 11/24/2015 12:25 AM, Aline Manera
        wrote:<br>
      </div>
      <blockquote cite="mid:56536129.50606@linux.vnet.ibm.com"
        type="cite">
        <meta content="text/html; charset=windows-1252"
          http-equiv="Content-Type">
        <br>
        Hi Suresh,<br>
        <br>
        We should keep the API consistent across platforms, that means
        if the 'memory' parameter is a 'string' in one platform we
        should be a string across all them.<br>
        <br>
        With this patch, we will have different results depend on arch,
        which make hard on how to expect from the output.<br>
        <br>
        For x86, we will have: 'cpus' as a dict and 'memory' as a number<br>
        {                                                                              


        <br>
         
        "cpus":{                                                                     


        <br>
           
        "offline":0,                                                               


        <br>
           
        "online":4                                                                 


        <br>
         
        },                                                                           


        <br>
         
        "memory":7933902848                                                          


        <br>
        }                                                                              


        <br>
        <br>
        For s390x, we will have 'cpus' as 'memory' as a dict.<br>
                                                                                       


        <br>
        {                                                                              


        <br>
         
        "cpus":{                                                                     


        <br>
           
        "shared":2,                                                                


        <br>
           
        "offline":2,                                                               


        <br>
           
        "dedicated":0,                                                             


        <br>
           
        "online":2                                                                 


        <br>
         
        },                                                                           


        <br>
         
        "memory":{                                                                   


        <br>
           
        "offline":2147483648,                                                      


        <br>
           
        "online":2147483648                                                        


        <br>
         
        },                                                                           


        <br>
         
        "virtualization":{                                                           


        <br>
           
        "lpar_name":"CSTLIN1",                                                     


        <br>
           
        "hypervisor":"PR/SM",                                                      


        <br>
           
        "lpar_number":55,                                                          


        <br>
           
        "hypervisor_vendor":"IBM"                                                  


        <br>
         
        }                                                                            


        <br>
        }                                                                              


        <br>
        <br>
        And for ppc, we will have 'cpus' and 'memory' as a number.<br>
        {                                                                              


        <br>
          "cpus":&lt;cpu
        count&gt;,                                                          
        <br>
         
        "memory":&lt;memory&gt;                                                            


        <br>
        }  <br>
        <br>
        My suggestion is to user dict for 'memory' and 'cpus' for all
        both platforms.<br>
        <br>
        <b>For 'memory':</b><br>
        <br>
        memory: {online: ..., offline:...}<br>
        <br>
        By 'online' memory, do you mean the memory current in the host?
        If so, we can use those 2 values for all the platforms and
        assume to total memory as online and 0 (zero) for offline memory
        for x86 and ppc.<br>
      </blockquote>
      Hi Aline,<br>
      Yes, I agree with your suggestion. Only s390x will have online and
      offline memory, for x86 and ppc - it is total memory in host, will
      keep offline memory as zero for x86 and ppc.<br>
      <blockquote cite="mid:56536129.50606@linux.vnet.ibm.com"
        type="cite"> <br>
        <b>For 'cpus':</b><br>
        <br>
        cpus: {online: ..., offline: ..., shared:..., dedicated:...}<br>
        <br>
        shared and dedicated only make sense for s390x, but online and
        offline make sense for all the platforms so we can use them
        overall. <br>
        <br>
        What do you think about it?<br>
      </blockquote>
      Agreed. I am currently using lscpu o/p to fetch total cpus and
      difference of total cpus and online cpus(fetched using psutil)
      will be taken as offline cpus.<br>
      I searched in google for sample lscpu o/p in ppc, it has CPU(s)
      field in lscpu which is the total cpu count. Please let me know if
      it doesn't provide this information in lscpu, otherwise we are
      good here.<br>
    </blockquote>
    <br>
    I've just confirmed and lscpu also returns the CPU(s) on PPC.<br>
    <br>
    <blockquote cite="mid:56541F3D.3090703@linux.vnet.ibm.com"
      type="cite"> ===sample lscpu o/p of linux on ppc====<br>
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      CPU(s):                16<br>
      On-line CPU(s) list:   0-15<br>
      Thread(s) per core:    4<br>
      Core(s) per socket:    1<br>
      Socket(s):             4<br>
      NUMA node(s):          1<br>
      Model:                 IBM,8233-E8B<br>
      L1d cache:             32K<br>
      L1i cache:             32K<br>
      NUMA node0 CPU(s):     0-15<br>
      ........<br>
      .......<br>
      <blockquote cite="mid:56536129.50606@linux.vnet.ibm.com"
        type="cite"> <br>
        Regards,<br>
        Aline Manera<br>
        <br>
        <div class="moz-cite-prefix">On 23/11/2015 10:03, <a
            moz-do-not-send="true" class="moz-txt-link-abbreviated"
            href="mailto:sureshab@linux.vnet.ibm.com"><a class="moz-txt-link-abbreviated" href="mailto:sureshab@linux.vnet.ibm.com">sureshab@linux.vnet.ibm.com</a></a>
          wrote:<br>
        </div>
        <blockquote
          cite="mid:1448280227-19495-1-git-send-email-sureshab@linux.vnet.ibm.com"
          type="cite">
          <pre wrap="">From: Suresh Babu Angadi <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:sureshab@in.ibm.com">&lt;sureshab@in.ibm.com&gt;</a>

As per RFC mail thread -
     [Kimchi-devel] RFC - #728 - Processor Info in s390 architecture
this patch set adds functionality in back-end to add
architecture, and host name(for all architecture),
split CPUs to online and offline(x86, s390x),
additional virtualization details(for s390x)

Note: Subsequent patch set for UI changes will follow
      to accommodate these changes

Test Cases Executed:
====================
1) On x86 machine:
curl -k -u suresh -H "Content-Type: application/json" -H "Accept: application/json" -X GET '<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://127.0.0.1:8001/plugins/gingerbase/host">https://127.0.0.1:8001/plugins/gingerbase/host</a>'
{
  "os_distro":"Fedora",
  "cpus":{
    "offline":0,
    "online":4
  },
  "cpu_model":"Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz",
  "os_version":"21",
  "host":"localhost.localdomain",
  "os_codename":"Twenty One",
  "architecture":"x86_64",
  "memory":7933902848
}

2) On s390x machine:
curl -k -u root -H "Content-Type: application/json" -H "Accept: application/json" -X GET '<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://127.0.0.1:8001/plugins/gingerbase/host">https://127.0.0.1:8001/plugins/gingerbase/host</a>'
{
  "os_distro":"KVM for IBM z Systems",
  "cpus":{
    "shared":2,
    "offline":2,
    "dedicated":0,
    "online":2
  },
  "cpu_model":"IBM/2827/743 H43",
  "os_version":"1.1.1",
  "host":"zfwcec103",
  "os_codename":"Z",
  "architecture":"s390x",
  "memory":{
    "offline":2147483648,
    "online":2147483648
  },
  "virtualization":{
    "lpar_name":"CSTLIN1",
    "hypervisor":"PR/SM",
    "lpar_number":55,
    "hypervisor_vendor":"IBM"
  }
}

3) For Power(Expected Output):
{
  "os_distro":&lt;os distro&gt;,
  "cpus":&lt;cpu count&gt;,
  "cpu_model":&lt;cpu model&gt;,
  "os_version":&lt;os version&gt;,
  "host":&lt;host name&gt;,
  "os_codename":&lt;os codename&gt;,
  "architecture":"ppc",
  "memory":&lt;memory&gt;
}


Suresh Babu Angadi (1):
  Fix for issue 728: processor info displays blank for system z     this
    patch set also adds additional capability:     retrieving
    architecture and host name (for all architecture)     split CPUs to
    show online and offline cpus(for x86 and s390x)     split memory to
    show online and offline memory(for s390x)     additional
    virtualization details(for s390x):         virtualization will have
    hypervisor details and lpar details

 src/wok/plugins/gingerbase/docs/API.md        |  22 ++-
 src/wok/plugins/gingerbase/i18n.py            |   1 +
 src/wok/plugins/gingerbase/lscpu.py           |  59 ++++++
 src/wok/plugins/gingerbase/model/host.py      | 256 +++++++++++++++++++++++---
 src/wok/plugins/gingerbase/tests/test_host.py |  12 +-
 5 files changed, 320 insertions(+), 30 deletions(-)

</pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
Regards,
Suresh Babu Angadi</pre>
    </blockquote>
    <br>
  </body>
</html>