[libvirt] kvm migration

Hi, can someone explain me how migration works in libvirt? I got 2 machines with ubuntu 9.04 (libvirt 0.6.1 and kvm 84), disk images are stored on nfs share so both machines can access them. When I run live migration (virsh migrate --live domain uri) my domain is migrated to second host but: 1. domain is defined on both hosts after migration, it does not disappear from original host 2. when I shutdown this domain on second host it gets undefined so I guess that migration is only temporary but this is not what I want. When I migrate domain to other host I want it to stay there, how can I do that? I can't find anything about it in documentation on libvirt website, google does not seem to know anything either. Łukasz Mierzwa

On Tue, May 19, 2009 at 09:29:15PM +0200, ??ukasz Mierzwa wrote:
Hi,
can someone explain me how migration works in libvirt? I got 2 machines with ubuntu 9.04 (libvirt 0.6.1 and kvm 84), disk images are stored on nfs share so both machines can access them. When I run live migration (virsh migrate --live domain uri) my domain is migrated to second host but: 1. domain is defined on both hosts after migration, it does not disappear from original host 2. when I shutdown this domain on second host it gets undefined so I guess that migration is only temporary but this is not what I want. When I migrate domain to other host I want it to stay there, how can I do that? I can't find anything about it in documentation on libvirt website, google does not seem to know anything either.
You need to distinguish between a persistent and transient guest. A persistent guest has a config file, a transient guest does not. If the guest on the source host is persistent, then after migration you should still see it on the source host as inactive. If it is transient, then all trace should have gone after migration. If the destination does not already have a config file for the incoming guest, then it will become a transient guest. Once you shut it down on the destination, all trace will go away., If the destination has a config for the guest it will become persistent, and the guest should still exist. Based on your description I'd say your source host had a persistent guest, and the destination host did not have a config, so after migration the guest was transient. 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 :|

Dnia wtorek 19 maj 2009 o 22:20:06 Daniel P. Berrange napisał(a):
On Tue, May 19, 2009 at 09:29:15PM +0200, ??ukasz Mierzwa wrote:
Hi,
can someone explain me how migration works in libvirt? I got 2 machines with ubuntu 9.04 (libvirt 0.6.1 and kvm 84), disk images are stored on nfs share so both machines can access them. When I run live migration (virsh migrate --live domain uri) my domain is migrated to second host but: 1. domain is defined on both hosts after migration, it does not disappear from original host 2. when I shutdown this domain on second host it gets undefined so I guess that migration is only temporary but this is not what I want. When I migrate domain to other host I want it to stay there, how can I do that? I can't find anything about it in documentation on libvirt website, google does not seem to know anything either.
You need to distinguish between a persistent and transient guest. A persistent guest has a config file, a transient guest does not.
If the guest on the source host is persistent, then after migration you should still see it on the source host as inactive. If it is transient, then all trace should have gone after migration.
If the destination does not already have a config file for the incoming guest, then it will become a transient guest. Once you shut it down on the destination, all trace will go away., If the destination has a config for the guest it will become persistent, and the guest should still exist.
Based on your description I'd say your source host had a persistent guest, and the destination host did not have a config, so after migration the guest was transient.
Daniel
So if I want my guest to be undefined from the source host and stay on target host I need to define him on target host before migration? Some info in 'virsh help migrate' would be nice, and maybe '--persistent' option to auto-define it on target before migration. Thanks for help. Łukasz Mierzwa

Łukasz Mierzwa wrote:
Dnia wtorek 19 maj 2009 o 22:20:06 Daniel P. Berrange napisał(a):
On Tue, May 19, 2009 at 09:29:15PM +0200, ??ukasz Mierzwa wrote:
Hi,
can someone explain me how migration works in libvirt? I got 2 machines with ubuntu 9.04 (libvirt 0.6.1 and kvm 84), disk images are stored on nfs share so both machines can access them. When I run live migration (virsh migrate --live domain uri) my domain is migrated to second host but: 1. domain is defined on both hosts after migration, it does not disappear from original host 2. when I shutdown this domain on second host it gets undefined so I guess that migration is only temporary but this is not what I want. When I migrate domain to other host I want it to stay there, how can I do that? I can't find anything about it in documentation on libvirt website, google does not seem to know anything either. You need to distinguish between a persistent and transient guest. A persistent guest has a config file, a transient guest does not.
If the guest on the source host is persistent, then after migration you should still see it on the source host as inactive. If it is transient, then all trace should have gone after migration.
If the destination does not already have a config file for the incoming guest, then it will become a transient guest. Once you shut it down on the destination, all trace will go away., If the destination has a config for the guest it will become persistent, and the guest should still exist.
Based on your description I'd say your source host had a persistent guest, and the destination host did not have a config, so after migration the guest was transient.
Daniel
So if I want my guest to be undefined from the source host and stay on target host I need to define him on target host before migration? Some info in 'virsh help migrate' would be nice, and maybe '--persistent' option to auto-define it on target before migration. Thanks for help.
Yeah, the persistent flag idea is a good one. I think people would find that useful, and it's fairly easy to implement. I'll give it a shot. -- Chris Lalancette

2009/5/20 Chris Lalancette <clalance@redhat.com>
Łukasz Mierzwa wrote:
Dnia wtorek 19 maj 2009 o 22:20:06 Daniel P. Berrange napisał(a):
On Tue, May 19, 2009 at 09:29:15PM +0200, ??ukasz Mierzwa wrote:
Hi,
can someone explain me how migration works in libvirt? I got 2 machines with ubuntu 9.04 (libvirt 0.6.1 and kvm 84), disk images are stored on nfs share so both machines can access them. When I run live migration (virsh migrate --live domain uri) my domain is migrated to second host but: 1. domain is defined on both hosts after migration, it does not disappear from original host 2. when I shutdown this domain on second host it gets undefined so I guess that migration is only temporary but this is not what I want. When I migrate domain to other host I want it to stay there, how can I do that? I can't find anything about it in documentation on libvirt website, google does not seem to know anything either. You need to distinguish between a persistent and transient guest. A persistent guest has a config file, a transient guest does not.
If the guest on the source host is persistent, then after migration you should still see it on the source host as inactive. If it is transient, then all trace should have gone after migration.
If the destination does not already have a config file for the incoming guest, then it will become a transient guest. Once you shut it down on the destination, all trace will go away., If the destination has a config for the guest it will become persistent, and the guest should still exist.
Based on your description I'd say your source host had a persistent guest, and the destination host did not have a config, so after migration the guest was transient.
Daniel
So if I want my guest to be undefined from the source host and stay on target host I need to define him on target host before migration? Some info in 'virsh help migrate' would be nice, and maybe '--persistent' option to auto-define it on target before migration. Thanks for help.
Yeah, the persistent flag idea is a good one. I think people would find that useful, and it's fairly easy to implement. I'll give it a shot.
When I try to migrate do destination host with domain defined on both, source and target, virsh just hangs on destination, migration does not finish and I can't connect anymore to libvirt on destination, I needed to SIGKILL it, SIGTERM did not stop it. It's 0.6.1 on ubuntu 9.04. Tried several times and it always hang. Łukasz Mierzwa

Łukasz Mierzwa wrote:
> So if I want my guest to be undefined from the source host and stay on target > host I need to define him on target host before migration? Some info in 'virsh > help migrate' would be nice, and maybe '--persistent' option to auto-define it > on target before migration. > Thanks for help.
Yeah, the persistent flag idea is a good one. I think people would find that useful, and it's fairly easy to implement. I'll give it a shot.
When I try to migrate do destination host with domain defined on both, source and target, virsh just hangs on destination, migration does not finish and I can't connect anymore to libvirt on destination, I needed to SIGKILL it, SIGTERM did not stop it. It's 0.6.1 on ubuntu 9.04. Tried several times and it always hang.
Hm, I seem to remember that there were some locking and event dispatch bugs in 0.6.1 that might be causing your issues. For what it's worth, I just tried it here on libvirt git tip, and it seems to work fine. -- Chris Lalancette
participants (3)
-
Chris Lalancette
-
Daniel P. Berrange
-
Łukasz Mierzwa