diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xc/lib/xc.h | 1 | ||||
-rw-r--r-- | tools/xc/lib/xc_domain.c | 4 | ||||
-rw-r--r-- | tools/xc/py/Xc.c | 10 |
3 files changed, 12 insertions, 3 deletions
diff --git a/tools/xc/lib/xc.h b/tools/xc/lib/xc.h index 4e75ebebef..274f2fdded 100644 --- a/tools/xc/lib/xc.h +++ b/tools/xc/lib/xc.h @@ -27,6 +27,7 @@ typedef struct { unsigned int cpu; unsigned int dying:1, crashed:1, shutdown:1, paused:1, blocked:1, running:1; + unsigned int shutdown_reason; /* only meaningful if shutdown==1 */ unsigned long nr_pages; unsigned long shared_info_frame; u64 cpu_time; diff --git a/tools/xc/lib/xc_domain.c b/tools/xc/lib/xc_domain.c index 84a97ce679..ae4dff003d 100644 --- a/tools/xc/lib/xc_domain.c +++ b/tools/xc/lib/xc_domain.c @@ -99,6 +99,10 @@ int xc_domain_getinfo(int xc_handle, info->blocked = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED); info->running = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING); + info->shutdown_reason = + (op.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) & + DOMFLAGS_SHUTDOWNMASK; + info->nr_pages = op.u.getdomaininfo.tot_pages; info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10); info->shared_info_frame = op.u.getdomaininfo.shared_info_frame; diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c index 343d118bbc..1c6a90c1b4 100644 --- a/tools/xc/py/Xc.c +++ b/tools/xc/py/Xc.c @@ -164,7 +164,8 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, { PyList_SetItem( list, i, - 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}", + 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,s:i}", "dom", info[i].domid, "cpu", info[i].cpu, "dying", info[i].dying, @@ -176,7 +177,8 @@ static PyObject *pyxc_domain_getinfo(PyObject *self, "mem_kb", info[i].nr_pages*4, "cpu_time", info[i].cpu_time, "name", info[i].name, - "maxmem_kb", info[i].max_memkb + "maxmem_kb", info[i].max_memkb, + "shutdown_reason", info[i].shutdown_reason )); } @@ -1062,7 +1064,9 @@ static PyMethodDef pyxc_methods[] = { " running [int]: Bool - is the domain currently running?\n" " mem_kb [int]: Memory reservation, in kilobytes\n" " cpu_time [long]: CPU time consumed, in nanoseconds\n" - " name [str]: Identifying name\n" }, + " name [str]: Identifying name\n" + " shutdown_reason [int]: Numeric code from guest OS, explaining " + "reason why it shut itself down.\n" }, { "linux_save", (PyCFunction)pyxc_linux_save, |