libxl: support VIR_MIGRATE_PERSIST_DEST migration flag

By default, virt-manager (and likely other libvirt-based apps) sets
the VIR_MIGRATE_PERSIST_DEST flag when invoking the migrate API, which
fails in a Xen setup since the libxl driver does not support the flag.

Persisting a domain is a trivial task in the grand scheme of migration,
so be nice to libvirt apps and add support for VIR_MIGRATE_PERSIST_DEST
in the libxl driver.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2016-09-19 11:34:34 -06:00
parent 53e3f69b3c
commit 1fc90ae934
2 changed files with 24 additions and 0 deletions

View File

@ -1021,6 +1021,29 @@ libxlDomainMigrationFinish(virConnectPtr dconn,
event = NULL; event = NULL;
} }
if (flags & VIR_MIGRATE_PERSIST_DEST) {
unsigned int oldPersist = vm->persistent;
virDomainDefPtr vmdef;
vm->persistent = 1;
if (!(vmdef = virDomainObjGetPersistentDef(cfg->caps,
driver->xmlopt, vm)))
goto cleanup;
if (virDomainSaveConfig(cfg->configDir, cfg->caps, vmdef) < 0)
goto cleanup;
event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_DEFINED,
oldPersist ?
VIR_DOMAIN_EVENT_DEFINED_UPDATED :
VIR_DOMAIN_EVENT_DEFINED_ADDED);
if (event) {
libxlDomainEventQueue(driver, event);
event = NULL;
}
}
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0) if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, cfg->caps) < 0)
goto cleanup; goto cleanup;

View File

@ -29,6 +29,7 @@
# define LIBXL_MIGRATION_FLAGS \ # define LIBXL_MIGRATION_FLAGS \
(VIR_MIGRATE_LIVE | \ (VIR_MIGRATE_LIVE | \
VIR_MIGRATE_PEER2PEER | \ VIR_MIGRATE_PEER2PEER | \
VIR_MIGRATE_PERSIST_DEST | \
VIR_MIGRATE_UNDEFINE_SOURCE | \ VIR_MIGRATE_UNDEFINE_SOURCE | \
VIR_MIGRATE_PAUSED) VIR_MIGRATE_PAUSED)