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

Re: [libvirt] [BUGFIX][PATCH] remove saved garbages after persistent migration



On Fri, Aug 26, 2011 at 12:15:37PM +0900, KAMEZAWA Hiroyuki wrote:
> >From e1e8d5ceb4a9f7c59e20dfb8c168b781435c1613 Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa hiroyu jp fujitsu com>
> Date: Fri, 26 Aug 2011 12:08:11 +0900
> Subject: [PATCH] Fix persistent migration config save
> 
> When a user migrates a domain by command as
> 
> libvirt saves vm's domain XML config in destination host after migration.
> But it saves vm->def. Then, the saved XML contains some garbages.
> 
>   <domain type='kvm' id='50'>
>                      ^^^^^^^^
>   ...
>    <console type='pty' tty='/dev/pts/5'>
>                        ^^^^^^^^^^^^^^^^^
> 
> Avoid saving unnecessary things by saving persistent vm definition.
> ---
>  src/qemu/qemu_migration.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index a38c0d9..524b8bf 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -2484,11 +2484,12 @@ qemuMigrationFinish(struct qemud_driver *driver,
>          qemuMigrationVPAssociatePortProfiles(vm->def);
>  
>          if (flags & VIR_MIGRATE_PERSIST_DEST) {
> +            virDomainDefPtr vmdef;
>              if (vm->persistent)
>                  newVM = 0;
>              vm->persistent = 1;
> -
> -            if (virDomainSaveConfig(driver->configDir, vm->def) < 0) {
> +            vmdef = virDomainObjGetPersistentDef(driver->caps, vm);
> +            if (virDomainSaveConfig(driver->configDir, vmdef) < 0) {
>                  /* Hmpf.  Migration was successful, but making it persistent
>                   * was not.  If we report successful, then when this domain
>                   * shuts down, management tools are in for a surprise.  On the

ACK, the existing bug was harmless, since those attributes won't be
parsed later, but it is good to fix none-the-less.


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


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