Re: [PATCH] Name domain managed state file with domain UUID

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

 



On Mon, Jul 11, 2011 at 09:06:05PM +0800, Osier Yang wrote:
> A domain managed state file named with domain name can cause
> problem if the domain is undefined, and a later new domain is
> created with the same name. The new domain will not be able to
> start.
> ---
>  src/libxl/libxl_driver.c |    4 +++-
>  src/qemu/qemu_driver.c   |    4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 586d562..7e4e261 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -220,8 +220,10 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
>  static char *
>  libxlDomainManagedSavePath(libxlDriverPrivatePtr driver, virDomainObjPtr vm) {
>      char *ret;
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> +    virUUIDFormat(vm->def->uuid, uuidstr);
>  
> -    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
> +    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
>          virReportOOMError();
>          return NULL;
>      }
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index a05a1ee..db77615 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2398,8 +2398,10 @@ cleanup:
>  static char *
>  qemuDomainManagedSavePath(struct qemud_driver *driver, virDomainObjPtr vm) {
>      char *ret;
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> +    virUUIDFormat(vm->def->uuid, uuidstr);
>  
> -    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
> +    if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, uuidstr) < 0) {
>          virReportOOMError();
>          return(NULL);
>      }

NACK, this is just papering over the problem IMHO, resulting in orphaned
state files being left around forever. We should have deleted the state
file when the guest was undefined.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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