Add qemuMigrationOpenNBDTunnel that connects a remote stream to the
local NBD UNIX socket.
Signed-off-by: Pavel Boldin <pboldin(a)mirantis.com>
---
src/qemu/qemu_migration.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4708387..27c1acb 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3605,6 +3605,32 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
}
+static int
+qemuMigrationOpenNBDTunnel(virQEMUDriverPtr driver,
+ virStreamPtr st,
+ const char *name)
+{
+ char *tunnelName = NULL;
+ int ret = -1;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+
+ if (virAsprintf(&tunnelName,
+ "%s/domain-%s/qemu.nbdtunnelmigrate.src",
+ cfg->libDir, name) < 0)
+ goto cleanup;
+
+ if (virFDStreamConnectUNIX(st, tunnelName, false) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(tunnelName);
+ virObjectUnref(cfg);
+ return ret;
+}
+
+
int
qemuMigrationOpenTunnel(virQEMUDriverPtr driver,
virConnectPtr dconn,
@@ -3621,6 +3647,9 @@ qemuMigrationOpenTunnel(virQEMUDriverPtr driver,
return -1;
}
+ if (flags & VIR_MIGRATE_TUNNEL_NBD)
+ return qemuMigrationOpenNBDTunnel(driver, st, def->name);
+
return 0;
}
--
1.9.1