[libvirt] [PATCH 1/5] lib: Add API for specific vCPU hot(un)plug

Peter Krempa pkrempa at redhat.com
Wed Feb 22 12:34:54 UTC 2017


On Wed, Feb 22, 2017 at 12:16:51 +0000, Daniel Berrange wrote:
> On Fri, Feb 10, 2017 at 06:10:18PM +0100, Peter Krempa wrote:
> > Similarly to domainSetGuestVcpus this commit adds API which allows to
> > modify state of individual vcpus rather than just setting the count.
> > 
> > This allows to enable CPUs in specific guest NUMA nodes to achieve any
> > necessary configuration.
> > ---
> >  include/libvirt/libvirt-domain.h |  5 +++++
> >  src/driver-hypervisor.h          |  7 ++++++
> >  src/libvirt-domain.c             | 48 ++++++++++++++++++++++++++++++++++++++++
> >  src/libvirt_public.syms          |  5 +++++
> >  src/remote/remote_driver.c       |  1 +
> >  src/remote/remote_protocol.x     | 16 +++++++++++++-
> >  src/remote_protocol-structs      |  7 ++++++
> >  7 files changed, 88 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> > index e303140a2..c0f715d66 100644
> > --- a/include/libvirt/libvirt-domain.h
> > +++ b/include/libvirt/libvirt-domain.h
> > @@ -4528,4 +4528,9 @@ int virDomainSetGuestVcpus(virDomainPtr domain,
> >                             int state,
> >                             unsigned int flags);
> > 
> > +int virDomainSetVcpu(virDomainPtr domain,
> > +                     const char *vcpumap,
> > +                     int state,
> > +                     unsigned int flags);
> 
> In adding support for this to perl/go bindings I see that this is using
> a different style to the existing APIs. With the exception of the
> virDomainSetGuestVcpus() API, everything else dealing with CPU maps
> uses an 'unsigned char *cpu' & 'int maplen' pair to store the data as
> a bitmap. I think we should change this API to also use the bitmap
> rather than the textual format as it gives consistency with other
> APIs, particularly when mapping into other languages.  For example
> in Go, the bitmaps get turned into a boolean array, so it is a very
> natural representation to manipulate - the textual format is rather
> inconvenient in this respect.

I modelled this API after the qemuDomainSetGuestVcpus and
qemuDomainGetGuestVcpusParams which already uses the string
representation rather the harder-to-use bitmap one, since they are in
for a while we can't change those.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170222/7cd8274b/attachment-0001.sig>


More information about the libvir-list mailing list