[libvirt] [PATCH 22/34] Removed virDomainEventPtr in favor of virObjectEventPtr

Cedric Bosdonnat cbosdonnat at suse.com
Mon Dec 2 12:50:58 UTC 2013


On Fri, 2013-11-29 at 17:18 +0000, Daniel P. Berrange wrote:
> On Fri, Nov 29, 2013 at 04:18:58PM +0100, Cédric Bosdonnat wrote:
> > The virDomainEvent class wasn't defining anything special, thus it has
> > been dropped.
> 
> 
> > diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
> > index 7694fcc..d4ecc23 100644
> > --- a/src/conf/domain_event.c
> > +++ b/src/conf/domain_event.c
> 
> > @@ -107,16 +105,11 @@ static void virDomainEventDeviceRemovedDispose(void *obj);
> >  struct _virObjectEvent {
> >      virObject parent;
> >      int eventID;
> > -};
> > -
> > -struct _virDomainEvent {
> > -    virObjectEvent parent;
> > -
> >      virObjectMeta meta;
> >  };
> 
> Ok, so you're merging virObjectMeta into the parent class. I understand why
> you want to keep a single set of metadata for all object types. This does
> mostly work. We should be aware of the fact that different objects have
> a different set of valid attributes
> 
>  - virDomainPtr - id, name, uuid
>  - virNetworkPtr - name, uuid
>  - virStoragePoolPtr - name, uuid
>  - virInterfacePtr - name
>  - virSecretPtr - uuid
>  - virNodeDevicePtr - name
>  - virNWfilterPtr - name, uuid

In most of the cases, the uuid is used for the filtering... but that can
be improved later for virInterfacePtr and virInterfacePtr.

> Even if we don't store any custom data in the virDomainEvent class its
> existance does tell you information about the metadata attributes that
> are valid for this class. Even if we don't use it right now, this feels
> like a useful class representation to have available.

The problem is that virClassNew is failing to create a class that has no
new attribute due to objectSize <= parent->objectSize. I'm tempted to
replace the '<=' in that test by '<'. Any objection?

--
Cedric




More information about the libvir-list mailing list