
On Tue, Sep 11, 2012 at 08:30:08AM -0600, Eric Blake wrote:
On 09/10/2012 08:20 PM, liguang wrote:
original migration did not aware of offline case so, add code to support offline migration quietly (did not disturb original migration) by pass VIR_MIGRATE_OFFLINE flag to migration APIs if the domain is really inactive, and migration process will not puzzeled by domain
s/puzzeled/puzzled/
offline and exit unexpectly.
s/unexpectly/unexpectedly/
these changes did not take care of disk images the domain required, for disk images could be transfered
s/transfered/transferred/
by other APIs as suggested. so, the migration result is just make domain definition alive at target side.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> --- include/libvirt/libvirt.h.in | 1 + src/qemu/qemu_driver.c | 8 ++++++ src/qemu/qemu_migration.c | 55 ++++++++++++++++++++++++++++++++++++----- src/qemu/qemu_migration.h | 3 +- tools/virsh-domain.c | 6 ++++ 5 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index cfe5047..77df2ab 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -995,6 +995,7 @@ typedef enum { * whole migration process; this will be used automatically * when supported */ VIR_MIGRATE_UNSAFE = (1 << 9), /* force migration even if it is considered unsafe */ + VIR_MIGRATE_OFFLINE = (1 << 10), /* offline migrate */
Do we really need a new user-visible flag, or can we make this work automatically without having to involve the user? On the other hand, what happens if we do keep this as a user-visible flag? Should 'virsh migrate --offline' silently ignore the flag if the guest is online, or should it error out stating that the guest is running and not offline?
Also, I think we NEED to error out if the guest is offline but the --persistent flag is not set; that is, an offline migration only makes sense if the persistent flag has been requested, but I think that 'virsh migrate --persistent' should automatically be smart enough to do an offline migration.
No we must not do that. If a guest has shutoff we cannot assume that the user / app wants to copy it across to the other host. eg consider this scenario admin a: check if guestfoo is running admin b: check if guestfoo is running admin a: migrate guestfoo barhost admin b: migrate guestfoo wizzhost IMHO step 4 should fail unless the admin explicitly requested that they want to copy across the offline config
You either need to take care of migrating storage if the user does 'virsh migrate [whatever-we-decide-for-offline] --copy-storage-*', or else explicitly reject attempts to migrate storage in parallel with an offline migration.
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 :|