direct-io.hg

changeset 1537:b05d7cdfc7c6

bitkeeper revision 1.994.1.5 (40d80fc0MVMbD_X8rrCInCJ1FJtGOA)

Add reason code to getdomaininfo.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jun 22 10:53:52 2004 +0000 (2004-06-22)
parents 7ce227b8b740
children cbee10dcdd93 e5ddcc390f7c
files tools/xc/lib/xc.h tools/xc/lib/xc_domain.c tools/xc/py/Xc.c
line diff
     1.1 --- a/tools/xc/lib/xc.h	Tue Jun 22 10:45:04 2004 +0000
     1.2 +++ b/tools/xc/lib/xc.h	Tue Jun 22 10:53:52 2004 +0000
     1.3 @@ -27,6 +27,7 @@ typedef struct {
     1.4      unsigned int  cpu;
     1.5      unsigned int  dying:1, crashed:1, shutdown:1, 
     1.6                    paused:1, blocked:1, running:1;
     1.7 +    unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     1.8      unsigned long nr_pages;
     1.9      unsigned long shared_info_frame;
    1.10      u64           cpu_time;
     2.1 --- a/tools/xc/lib/xc_domain.c	Tue Jun 22 10:45:04 2004 +0000
     2.2 +++ b/tools/xc/lib/xc_domain.c	Tue Jun 22 10:53:52 2004 +0000
     2.3 @@ -99,6 +99,10 @@ int xc_domain_getinfo(int xc_handle,
     2.4          info->blocked  = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
     2.5          info->running  = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
     2.6  
     2.7 +        info->shutdown_reason = 
     2.8 +            (op.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) & 
     2.9 +            DOMFLAGS_SHUTDOWNMASK;
    2.10 +
    2.11          info->nr_pages = op.u.getdomaininfo.tot_pages;
    2.12          info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10);
    2.13          info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
     3.1 --- a/tools/xc/py/Xc.c	Tue Jun 22 10:45:04 2004 +0000
     3.2 +++ b/tools/xc/py/Xc.c	Tue Jun 22 10:53:52 2004 +0000
     3.3 @@ -164,7 +164,8 @@ static PyObject *pyxc_domain_getinfo(PyO
     3.4      {
     3.5          PyList_SetItem(
     3.6              list, i, 
     3.7 -            Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:l,s:L,s:s,s:l}",
     3.8 +            Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
     3.9 +                          ",s:l,s:L,s:s,s:l,s:i}",
    3.10                            "dom",       info[i].domid,
    3.11                            "cpu",       info[i].cpu,
    3.12                            "dying",     info[i].dying,
    3.13 @@ -176,7 +177,8 @@ static PyObject *pyxc_domain_getinfo(PyO
    3.14                            "mem_kb",    info[i].nr_pages*4,
    3.15                            "cpu_time",  info[i].cpu_time,
    3.16                            "name",      info[i].name,
    3.17 -                          "maxmem_kb", info[i].max_memkb
    3.18 +                          "maxmem_kb", info[i].max_memkb,
    3.19 +                          "shutdown_reason", info[i].shutdown_reason
    3.20                  ));
    3.21      }
    3.22  
    3.23 @@ -1062,7 +1064,9 @@ static PyMethodDef pyxc_methods[] = {
    3.24        " running  [int]:  Bool - is the domain currently running?\n"
    3.25        " mem_kb   [int]:  Memory reservation, in kilobytes\n"
    3.26        " cpu_time [long]: CPU time consumed, in nanoseconds\n"
    3.27 -      " name     [str]:  Identifying name\n" },
    3.28 +      " name     [str]:  Identifying name\n"
    3.29 +      " shutdown_reason [int]: Numeric code from guest OS, explaining "
    3.30 +      "reason why it shut itself down.\n" },
    3.31  
    3.32      { "linux_save", 
    3.33        (PyCFunction)pyxc_linux_save,