libxlMigrationDstArgs *args = opaque;
virNetSocketPtr *socks = args->socks;
size_t nsocks = args->nsocks;
+ libxlDomainObjPrivatePtr priv = args->vm->privateData;
virNetSocketPtr client_sock;
int recvfd = -1;
- virThread thread;
size_t i;
/* Accept migration connection */
* the migration data
*/
args->recvfd = recvfd;
- if (virThreadCreate(&thread, false,
+ VIR_FREE(priv->migrationDstReceiveThr);
+ if (VIR_ALLOC(priv->migrationDstReceiveThr) < 0)
+ goto fail;
+ if (virThreadCreate(priv->migrationDstReceiveThr, true,
libxlDoMigrateDstReceive, args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration data"));
libxlDriverPrivatePtr driver = dconn->privateData;
virDomainObjPtr vm = NULL;
libxlMigrationDstArgs *args = NULL;
- virThread thread;
bool taint_hook = false;
libxlDomainObjPrivatePtr priv = NULL;
char *xmlout = NULL;
args->nsocks = 0;
mig = NULL;
- if (virThreadCreate(&thread, false, libxlDoMigrateDstReceive, args) < 0) {
+ VIR_FREE(priv->migrationDstReceiveThr);
+ if (VIR_ALLOC(priv->migrationDstReceiveThr) < 0)
+ goto error;
+ if (virThreadCreate(priv->migrationDstReceiveThr, true, libxlDoMigrateDstReceive, args) < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to create thread for receiving migration data"));
goto endjob;
virObjectEventPtr event = NULL;
virDomainPtr dom = NULL;
+ if (priv->migrationDstReceiveThr) {
+ virObjectUnlock(vm);
+ virThreadJoin(priv->migrationDstReceiveThr);
+ virObjectLock(vm);
+ VIR_FREE(priv->migrationDstReceiveThr);
+ }
+
virPortAllocatorRelease(priv->migrationPort);
priv->migrationPort = 0;