Re: [libvirt] [PATCH] qemudDomainCreate check if domain is already active

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

 



On Thu, Jul 24, 2008 at 12:49:13AM -0400, Guido G?nther wrote:
> Hi,
> currently virsh create foo.xml overwrites running domains. In case of
> qemu this leaves detached qemu processes around and the domain creation
> fails later on being unable to start other domains afterwards - not
> nice.
> Attached patch checks if we already have a running domain by that name
> and in this case refuses to create a new domain from xml by that name.
> 
> Probably this check needs to be pushed further upward since this might
> affect other hypervisors too, haven't checked that though.

Actually, in Xen case, XenD itself will do the checking.

> [PATCH] qemudDomainCreate: check if domain is already active
> 
> otherwise we overwrite a running domain which lets libvirtd disconnect
> from the running qemu.
> ---
>  src/qemu_driver.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> 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.


Regards,
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]