On Wed, Feb 25, 2015 at 10:24:37AM +0100, Dario Faggioli wrote:
On Tue, 2015-02-24 at 13:10 +0000, Ian Campbell wrote:
> On Tue, 2015-02-24 at 12:41 +0000, Anthony PERARD wrote:
> > What libxl API those provide this information, if it exist?
> >
> > I found libxl_get_online_cpus() but that not enough. They want a
> > bitmap.
>
> I think that is all which currently exists, at least at the libxl level,
> you may need to add a new interface.
>
> It'd be worth looking into the various host numa interfaces -- perhaps
> one of them indirectly exposes what you want?
>
Given Daniel's latest emails, I'm not sure this is useful but
libxl_get_cpu_topology() should put LIBXL_CPUTOPOLOGY_INVALID_ENTRY in
all the fields of the i-eth element of the array it returns, if the
i-eth pcpu is offline (see the implementation of XEN_SYSCTL_topologyinfo
in xen/common/sysctl.c).
So, scanning that array and constructing the bitmap according to whether
or not we find that marker on the various elements would be the way to
go, I would say.
I've actually never tested this, i.e., I've never tried offlining a pcpu
on the host. I'll give it a go as soon as I find 5 minutes, and let know
if it works.
FWIW, this code in openstack was only added for benefit of s390
architecture where apparently it is common to have hosts with
CPUs offlined. Presumably you have to pay IBM for each extra
CPU you turn online :)
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|