On Wed, Jul 22, 2009 at 06:49:26PM +0200, Daniel Veillard wrote:
On Wed, Jul 22, 2009 at 05:02:55PM +0100, Daniel P. Berrange wrote:
> * src/lxc_conf.h: Add queue for dispatch of domain events
> * src/lxc_driver.c: Trigger domain events upon important lifecycle transitions
[...]
> @@ -293,6 +303,8 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const
char *xml)
> virDomainDefPtr def = NULL;
> virDomainObjPtr vm = NULL;
> virDomainPtr dom = NULL;
> + virDomainEventPtr event = NULL;
> + int newVM = 1;
Hum I don't see where newVM is set to anything else in that patch
isn't there something missing ?
Yeah, it should be probing to see if a config already exists with the same
name/uuid, and if so setting this flag to 0. I'm going to add that support
later, since these name/uuid checks impact many other methods in this driver.
> lxcDriverLock(driver);
> if (!(def = virDomainDefParseString(conn, driver->caps, xml,
> @@ -318,6 +330,12 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const
char *xml)
> goto cleanup;
> }
>
> + event = virDomainEventNewFromObj(vm,
> + VIR_DOMAIN_EVENT_DEFINED,
> + newVM ?
> + VIR_DOMAIN_EVENT_DEFINED_ADDED :
> + VIR_DOMAIN_EVENT_DEFINED_UPDATED);
> +
> @@ -532,6 +559,13 @@ static int lxcVMCleanup(virConnectPtr conn,
> virCgroupFree(&cgroup);
> }
>
> + if (vm->newDef) {
> + virDomainDefFree(vm->def);
> + vm->def = vm->newDef;
> + vm->def->id = -1;
> + vm->newDef = NULL;
> + }
> +
Hum newDef is not touched anywhere else in that patch, unrelated ?
Opps, yes this is unrelated. THis is fixing the shutdown method so that
when a VM shuts down the existing config is replaced by the new config
(if defined).
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 :|