]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: remove domain when migration prepare fails
authorJim Fehlig <jfehlig@suse.com>
Tue, 8 Jul 2014 17:15:34 +0000 (11:15 -0600)
committerJim Fehlig <jfehlig@suse.com>
Tue, 8 Jul 2014 23:14:50 +0000 (17:14 -0600)
commitc4f66bb8bef796357d509960d5bb65153f586a1f
treef8564c4eb1494bc2f5fe720d18e2ac627c0a7b1b
parent92cd6b677e121463df414ebe42b847eacf333e08
libxl: remove domain when migration prepare fails

In libxlDomainMigrationPrepare(), a new virDomainObj is created
from the incoming domain def and added to the driver's domain
list, but never removed if there are subsequent failures during
the prepare phase.

targethost# virsh list --all

sourcehost# virsh migrate --live dom xen+ssh://targethost/system
   error: operation failed: Fail to create socket for incoming migration.

targethost# virsh list --all
error: Failed to list domains
error: name in virGetDomain must not be NULL

After adding code to remove the domain on prepare failure, noticed
that libvirtd crashed due to double free of the virDomainDef.  Similar
to the qemu driver, pass a pointer to virDomainDefPtr so it can be set
to NULL once a virDomainObj is created from it.
src/libxl/libxl_driver.c
src/libxl/libxl_migration.c
src/libxl/libxl_migration.h