On Tue, Oct 21, 2008 at 03:15:47PM -0400, Ben Guthro wrote: > [PATCH 06/12] Domain Events - qemu driver > Register for, and dispatch domain event callbacks > > qemu_conf.h | 3 + > qemu_driver.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- > 2 files changed, 97 insertions(+), 7 deletions(-) > @@ -918,6 +938,11 @@ static int qemudStartVMDaemon(virConnectPtr conn, > qemudShutdownVMDaemon(conn, driver, vm); > return -1; > } > + dom = qemudDomainLookupByName(conn,vm->def->name); > + if(dom) > + qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_STARTED); > + else > + DEBUG0("Warning - dom is NULL at domain start"); The lookup & if(dom) bit is redundant - the only reasons qemudDomainLookupByName() would fail are either, that the named VM doesn't exist - we know it does, since we have its 'virDomainObjPtr' right here, or on out-of-memory. So we can just call qemudDomainEventDispatch() and avoid the check. > @@ -2210,6 +2240,11 @@ static int qemudDomainRestore(virConnectPtr conn, > vm->state = VIR_DOMAIN_RUNNING; > } > > + dom = virDomainLookupByID(conn, def->id); > + if(dom) { > + qemudDomainEventDispatch(driver, vm, VIR_DOMAIN_EVENT_RESTORED); > + VIR_FREE(dom); > + } > return 0; Likewise here, the virDomainLookupByID() is redundant, and we can just call qemudDomainEventDispatch(), which does a dom lookup anyway. ACK to the rest of the patch 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