SHA256
1
0
forked from pool/libvirt
libvirt/5ea2abb3-libxl-join-mig-rcv-thread.patch
James Fehlig 827fa7dc68 Accepting request 636920 from home:jfehlig:branches:Virtualization
- libxl: fix VM migration on busy hosts
  60b4fd90-libxl-rm-vm-finish-phase.patch,
  e39c66d3-libxl-fix-p2p-migration.patch,
  47da84e0-libxl-fix-job-handling-migsrc.patch,
  0149464a-libxl-fix-job-handling-migdst.patch,
  5ea2abb3-libxl-join-mig-rcv-thread.patch
  bsc#1108086

- Update to libvirt 4.7.0
  - Many incremental improvements and bug fixes, see
    http://libvirt.org/news.html
  - Dropped patches:
    9ed59012--revert-jansson1.patch,
    54f2b5e3-revert-jansson2.patch,
    b56950fd-revert-jansson3.patch,
    6c3d66ac-revert-jansson4.patch,
    8e373e6d-revert-jansson5.patch,
    6f99de31-revert-jansson6.patch,
    f204cf51-revert-jansson7.patch,
    5a58b5ed-revert-jansson8.patch,
    63f6e0e9-revert-jansson9.patch,
    8687eba-revert-jansson10.patch,
    e96e71d8-revert-jansson11.patch,
    d99a8959-revert-jansson12.patch,
    074a7e14-revert-jansson13.patch

OBS-URL: https://build.opensuse.org/request/show/636920
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=704
2018-09-20 17:06:17 +00:00

88 lines
3.3 KiB
Diff

commit 5ea2abb3bfd552175dc2dfcc295fde3fbf17fc37
Author: Jim Fehlig <jfehlig@suse.com>
Date: Fri Aug 24 15:38:14 2018 -0600
libxl: join with thread receiving migration data
It is possible the incoming VM is not fully started when the finish
phase of migration is executed. In libxlDomainMigrationDstFinish,
wait for the thread receiving the VM to complete before executing
finish phase tasks.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
Index: libvirt-4.7.0/src/libxl/libxl_domain.h
===================================================================
--- libvirt-4.7.0.orig/src/libxl/libxl_domain.h
+++ libvirt-4.7.0/src/libxl/libxl_domain.h
@@ -65,6 +65,7 @@ struct _libxlDomainObjPrivate {
/* console */
virChrdevsPtr devs;
libxl_evgen_domain_death *deathW;
+ virThreadPtr migrationDstReceiveThr;
unsigned short migrationPort;
char *lockState;
Index: libvirt-4.7.0/src/libxl/libxl_migration.c
===================================================================
--- libvirt-4.7.0.orig/src/libxl/libxl_migration.c
+++ libvirt-4.7.0/src/libxl/libxl_migration.c
@@ -297,9 +297,9 @@ libxlMigrateDstReceive(virNetSocketPtr s
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 */
@@ -318,7 +318,10 @@ libxlMigrateDstReceive(virNetSocketPtr s
* 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"));
@@ -557,7 +560,6 @@ libxlDomainMigrationDstPrepareTunnel3(vi
libxlDriverPrivatePtr driver = dconn->privateData;
virDomainObjPtr vm = NULL;
libxlMigrationDstArgs *args = NULL;
- virThread thread;
bool taint_hook = false;
libxlDomainObjPrivatePtr priv = NULL;
char *xmlout = NULL;
@@ -617,7 +619,10 @@ libxlDomainMigrationDstPrepareTunnel3(vi
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;
@@ -1291,6 +1296,13 @@ libxlDomainMigrationDstFinish(virConnect
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;