Re: [libvirt] [PATCH 5/5] Allow for a driver specific private data blob in virDomainObjPtr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 15, 2009 at 11:41:56PM +0200, Matthias Bolte wrote:
> 2009/10/14 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> > The virDomainObjPtr object stores state about a running domain.
> > This object is shared across all drivers so it is not appropriate
> > to include driver specific state here. This patch adds the ability
> > to request a blob of private data per domain object instance. The
> > driver must provide a allocator & deallocator for this purpose
> >
> > THis patch abuses the virCapabilitiesPtr structure for storing the
> > allocator/deallocator callbacks, since it is already being abused
> > for other internal things relating to parsing. This should be moved
> > out into a separate object at some point.
> >
> > * src/conf/capabilities.h: Add privateDataAllocFunc and
> >  privateDataFreeFunc fields
> > * src/conf/domain_conf.c: Invoke the driver allocators / deallocators
> >  when creating/freeing virDomainObjPtr instances.
> > * src/conf/domain_conf.h: Pass virCapsPtr into virDomainAssignDef
> >  to allow access to the driver specific allocator function
> > * src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
> >  src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
> >  src/test/test_driver.c, src/uml/uml_driver.c: Update for
> >  change in virDomainAssignDef contract
> > ---
> >  src/conf/capabilities.h     |    2 ++
> >  src/conf/domain_conf.c      |   23 +++++++++++++++++++----
> >  src/conf/domain_conf.h      |    4 ++++
> >  src/lxc/lxc_driver.c        |    6 ++++--
> >  src/opennebula/one_driver.c |    6 ++++--
> >  src/openvz/openvz_driver.c  |    6 ++++--
> >  src/qemu/qemu_driver.c      |    5 +++++
> >  src/test/test_driver.c      |   15 ++++++++++-----
> >  src/uml/uml_driver.c        |    2 ++
> >  9 files changed, 54 insertions(+), 15 deletions(-)
> >
> > diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
> > index 2f24605..7234cf4 100644
> > --- a/src/conf/capabilities.h
> > +++ b/src/conf/capabilities.h
> > @@ -115,6 +115,8 @@ struct _virCaps {
> >     virCapsGuestPtr *guests;
> >     unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN];
> >     unsigned int emulatorRequired : 1;
> > +    void *(*privateDataAllocFunc)(void);
> > +    void (*privateDataFreeFunc)(void *);
> >  };
> 
> Maybe add a comment here that this should be moved out into a separate
> object at some point.
> 
> ACK.
> 
> PS: What's the specific use case for this?

It going to be used by the QEMU monitor re-write I'm working on. That's
not ready to send out for review yet, but hopefully in a day or two

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]