On 05/12/2011 10:04 AM, Daniel P. Berrange wrote:
By running the doTunnelSendAll code in a separate thread, the
main thread can do qemuMigrationWaitForCompletion as with
normal migration. This in turn ensures that job signals work
correctly and that progress monitoring can be done
* src/qemu/qemu_migration.c: Runn tunnelled migration in
s/Runn/Run/
separate thread
---
src/qemu/qemu_migration.c | 95 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 81 insertions(+), 14 deletions(-)
Ah, so we finally get to a patch where I've never reviewed a prior version.
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index d12ffda..bc8a305 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1287,44 +1287,101 @@ cleanup:
#define TUNNEL_SEND_BUF_SIZE 65536
-static int doTunnelSendAll(virStreamPtr st,
- int sock)
+typedef struct _qemuMigrationIOThread qemuMigrationIOThread;
+typedef qemuMigrationIOThread * qemuMigrationIOThreadPtr;
Extra space; for consistency with other typedefs, do s/\* /*/
+static qemuMigrationIOThreadPtr
+qemuMigrationStartTunnel(virStreamPtr st,
+ int sock)
+{
+ qemuMigrationIOThreadPtr io;
+
+ if (VIR_ALLOC(io) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ io->st = st;
+ io->sock = sock;
+
+ if (virThreadCreate(&io->thread, true,
+ qemuMigrationIOFunc,
+ io) < 0) {
+ VIR_FREE(io);
+ return NULL;
virThreadCreate does not report an error, but you already used
virReportOOMError earlier. Therefore, the caller can't tell which error
happened on a NULL return, so you need to report an error here.
ACK with those findings addressed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org