[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 3/3] libxl: update vcpus bitmap in retrieved guest config
On Tue, Jun 07, 2016 at 05:36:05PM +0100, Anthony PERARD wrote: > On Tue, Jun 07, 2016 at 05:03:07PM +0100, Wei Liu wrote: > > On Tue, Jun 07, 2016 at 03:45:29PM +0100, Anthony PERARD wrote: > > > On Tue, Jun 07, 2016 at 12:24:02PM +0100, Wei Liu wrote: > > > > ... because the available vcpu bitmap can change during domain life time > > > > due to cpu hotplug and unplug. > > > > > > > > For QEMU upstream, we interrogate QEMU for the number of vcpus. For > > > > others, we look directly into xenstore for information. > > > > > > > > Reported-by: Jan Beulich <jbeulich@xxxxxxxx> > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > > > --- > > > > tools/libxl/libxl.c | 91 > > > > +++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > 1 file changed, 91 insertions(+) > > > > > > > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > > > index 006b83f..4f8b663 100644 > > > > --- a/tools/libxl/libxl.c > > > > +++ b/tools/libxl/libxl.c > > > > @@ -7222,6 +7222,57 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac > > > > *dst, libxl_mac *src) > > > > (*dst)[i] = (*src)[i]; > > > > } > > > > > > > > +static int libxl__update_avail_vcpus_qmp(libxl__gc *gc, uint32_t domid, > > > > + unsigned int max_vcpus, > > > > + libxl_bitmap *map) > > > > +{ > > > > + unsigned int count, i; > > > > + int rc; > > > > + > > > > + /* For QEMU upstream we always need to return the number > > > > + * of cpus present to QEMU whether they are online or not; > > > > + * otherwise QEMU won't accept the saved state. > > > > + */ > > > > + rc = libxl__qmp_query_cpus(gc, domid, &count); > > > > + if (rc) { > > > > + LOG(ERROR, "fail to get number of cpus for domain %d", domid); > > > > + goto out; > > > > + } > > > > + > > > > + for (i = 0; i < count; i++) > > > > + libxl_bitmap_set(map, i); > > > > > > What if I have cpu 1, 7 and 42 online, but all the other offline? > > > > > > > I have more or less the same question when I wrote this patch. At that > > time I thought the avail_vcpus was only used for generating -smp option > > to QEMU. > > Right, and -smp does not let you set a bitmap... I guess having a count > for this purpose is enough. > > > In your example, you will have -smp 3,maxvcpus=$Y. I think the migration > > should still succeed. Furthermore, the cpu-add operation doesn't care, > > so it probably won't have visible effect. > > What does cpu-add not care about? > Never mind. This is too wrong to explain. I was thinking about some other stuff when writing that. The libxl API does care about the bitmap, but QEMU parameter doesn't. > > I agree it would be good to set the exact bits though -- if you can tell > > me which field to test. > > > > From the example below, I guess it would be "CPU". Sounds good to me. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |