[libvirt] [PATCH] qemudDomainCreate check if domain is already active
Daniel P. Berrange
berrange at redhat.com
Thu Jul 24 15:12:05 UTC 2008
On Thu, Jul 24, 2008 at 10:41:31AM -0400, Guido G?nther wrote:
> On Thu, Jul 24, 2008 at 10:01:32AM +0100, Daniel P. Berrange wrote:
> > > diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> > > index b84bdf4..0ad72ae 100644
> > > --- a/src/qemu_driver.c
> > > +++ b/src/qemu_driver.c
> > > @@ -1978,6 +1978,15 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
> > > if (!(def = virDomainDefParseString(conn, driver->caps, xml)))
> > > return NULL;
> > >
> > > + vm = virDomainFindByName(driver->domains, def->name);
> >
> > You need to check for UUID clash too.
> Indeed. But before fixing this I wonder what the exact semantics of
> domainCreateLinux are. Is it correct that we don't call
> virDomainSaveConfiguration?
Yes, that is correct.
virDomainCreateLinux() starts a virtual machine with no config file. All
trace of it will disappear when it shuts down - a so called 'transient'
VM.
Alternatively you can define the config first with virDomainDefineXML()
and then start it based on this definition with virDomainCreate(). This
gives you a persistent VM.
Now, while a transient VM is running you can explicitly give it a config
file by called virDomainDefineXML with the same uuid, thus turning it in
to a persistent VM.
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 :|
More information about the libvir-list
mailing list