On Thu, Oct 01, 2009 at 08:18:31PM +0200, Paolo Bonzini wrote:
This adds a new flag, VIR_MIGRATE_PAUSED, that mandates pausing
the migrated VM before starting it.
* include/libvirt/libvirt.h.in (virDomainMigrateFlags): Add
VIR_MIGRATE_PAUSED.
* src/libvirt.c (virDomainMigrateVersion2): "Optimize" combination of
VIR_MIGRATE_LIVE and VIR_MIGRATE_PAUSED.
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Handle
VIR_MIGRATE_PAUSED.
* tools/virsh.c (opts_migrate): Add --suspend.
(cmdMigrate): Handle it.
* tools/virsh.pod (migrate): Document it.
* docs/libvirt-api.xml: Regenerate.
* docs/libvirt-refs.xml: Regenerate.
[...]
diff --git a/src/libvirt.c b/src/libvirt.c
index dacf8c4..8569fcb 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3057,7 +3057,8 @@ virDomainMigrateVersion2 (virDomainPtr domain,
* host given by dconn (a connection to the destination host).
*
* Flags may be one of more of the following:
- * VIR_MIGRATE_LIVE Attempt a live migration.
+ * VIR_MIGRATE_LIVE Attempt a live migration.
+ * VIR_MIGRATE_PAUSED Leave the domain suspended on the remote side.
*
* If a hypervisor supports renaming domains during migration,
* then you may set the dname parameter to the new name (otherwise
@@ -3106,6 +3107,12 @@ virDomainMigrate (virDomainPtr domain,
virResetLastError();
Hum, what happens if the remote node has an old libvirtd which doesn't
know the VIR_MIGRATE_PAUSED flag ? I would expect some kind of flag
checking on the receiving end might generate an error, true ?
+ if ((flags & VIR_MIGRATE_PAUSED)) {
+ /* Not doing migration live in this case reduces traffic,
+ and the effect is not visible. */
+ flags &= ~VIR_MIGRATE_LIVE;
+ }
Hum ... that's still a change of semantic, LIVE and PAUSED would
actually still run the domain until the data are transfered on the
other side (mostly).
If we keep that overriding semantic then that should be in the
description IMHO
That sounds reasonnable to me, but I wonder what's the use case :-)
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/