static qemuMigrationCookiePtr
qemuMigrationCookieNew(virDomainObjPtr dom)
{
+ qemuDomainObjPrivatePtr priv = dom->privateData;
qemuMigrationCookiePtr mig = NULL;
+ const char *name;
if (VIR_ALLOC(mig) < 0)
goto no_memory;
- if (!(mig->name = strdup(dom->def->name)))
+ if (priv->origname)
+ name = priv->origname;
+ else
+ name = dom->def->name;
+ if (!(mig->name = strdup(name)))
goto no_memory;
memcpy(mig->uuid, dom->def->uuid, VIR_UUID_BUFLEN);
unsigned long long now;
qemuMigrationCookiePtr mig = NULL;
bool tunnel = !!st;
+ char *origname = NULL;
if (virTimeMs(&now) < 0)
return -1;
/* Target domain name, maybe renamed. */
if (dname) {
- VIR_FREE(def->name);
+ origname = def->name;
def->name = strdup(dname);
if (def->name == NULL)
goto cleanup;
}
def = NULL;
priv = vm->privateData;
+ priv->origname = origname;
+ origname = NULL;
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
QEMU_MIGRATION_COOKIE_LOCKSTATE)))
ret = 0;
cleanup:
+ VIR_FREE(origname);
virDomainDefFree(def);
VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]);
qemuMigrationCookiePtr mig = NULL;
virErrorPtr orig_err = NULL;
int cookie_flags = 0;
+ qemuDomainObjPrivatePtr priv = vm->privateData;
VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, flags=%lx, retcode=%d",
}
cleanup:
- if (vm)
+ if (vm) {
+ VIR_FREE(priv->origname);
virDomainObjUnlock(vm);
+ }
if (event)
qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);