On Wed, May 20, 2009 at 11:15:14AM +0200, Chris Lalancette wrote:
As pointed out by Ćukasz Mierzwa <l.mierzwa(a)gmail.com>, it
would be nice if
there was an option to automatically make a domain persistent on the destination
during a live migration. The attached patch adds this simple capability. Note
that this has to be applied on top of my previous secure migration patch,
otherwise you'll have conflicts.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
Patch looks fine to me, but
@@ -5291,6 +5292,32 @@ qemudDomainMigrateFinish2 (virConnectPtr
dconn,
* object, but if no, clean up the empty qemu process.
*/
if (retcode == 0) {
+ if (flags & VIR_MIGRATE_PERSISTENT) {
+ if (vm->persistent)
+ newVM = 0;
+ vm->persistent = 1;
+
+ if (virDomainSaveConfig(dconn, driver->configDir, vm->def) < 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
+ * other hand, if we report failure, then the management tools
+ * might try to restart the domain on the source side, even
+ * though the domain is actually running on the destination.
+ * Return a NULL dom pointer, and hope that this is a rare
+ * situation and management tools are smart.
+ */
+ vm = NULL;
+ goto cleanup;
+ }
Yup that's a hard decision here, I wonder if some asynchronous event
shoul not be generated, at least make sure an error is propagated in
some ways.
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/