[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xc Python ext lib: Xen 4.6 Unable to start a 2T guest without OverflowError
Starting a vm with memory over 2T resulted in an overflow error. memory = 2097152 defined as number of megabytes returns the error "OverflowError: signed integer is greater than maximum" The error is the result of the python extension argument translator defining max_memkb as a signed int instead of an unsigned int. So PyArg_ParseTuple(args, "ii", &dom, &maxmem_kb) overflowed by one with 2147483648 kb. The other issue is that max_memkb is defined as uint64_t in the subsequent domctl target api so the xc lib and its python C extension should use uint64_t as well. /* XEN_DOMCTL_max_mem */ struct xen_domctl_max_mem { /* IN variables. */ uint64_aligned_t max_memkb; }; Signed-off-by: Cathy Avery <cathy.avery@xxxxxxxxxx> --- tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_domain.c | 2 +- tools/python/xen/lowlevel/xc/xc.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 0ad8b8d..1b5c622 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1253,7 +1253,7 @@ int xc_getcpuinfo(xc_interface *xch, int max_cpus, int xc_domain_setmaxmem(xc_interface *xch, uint32_t domid, - unsigned int max_memkb); + uint64_t max_memkb); int xc_domain_set_memmap_limit(xc_interface *xch, uint32_t domid, diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index b864872..2c0fc9f 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -630,7 +630,7 @@ int xc_shadow_control(xc_interface *xch, int xc_domain_setmaxmem(xc_interface *xch, uint32_t domid, - unsigned int max_memkb) + uint64_t max_memkb) { DECLARE_DOMCTL; domctl.cmd = XEN_DOMCTL_max_mem; diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index f83e33d..7a5d36e 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1658,9 +1658,9 @@ static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args) static PyObject *pyxc_domain_setmaxmem(XcObject *self, PyObject *args) { uint32_t dom; - unsigned int maxmem_kb; + uint64_t maxmem_kb; - if (!PyArg_ParseTuple(args, "ii", &dom, &maxmem_kb)) + if (!PyArg_ParseTuple(args, "ik", &dom, &maxmem_kb)) return NULL; if (xc_domain_setmaxmem(self->xc_handle, dom, maxmem_kb) != 0) -- 1.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |