On 29.07.26 17:09, Peter Xu wrote:
On Wed, Jul 29, 2026 at 12:12:48PM +0300, Vladimir Sementsov-Ogievskiy wrote:
As documented, for "local", the migration channel must be direct
UNIX socket connection from source to target. We can't check for
it being "direct", but let's at least check that we deal with
UNIX socket (fd-passing supported).

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
---
  migration/channel.c | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/migration/channel.c b/migration/channel.c
index 1e2935f926b..537673c29e9 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -214,6 +214,13 @@ void migration_channel_process_incoming(QIOChannel *ioc)
      trace_migration_set_incoming_channel(
          ioc, object_get_typename(OBJECT(ioc)));
+ if (migrate_local() && migrate_mode() != MIG_MODE_CPR_EXEC &&
+        !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS)) {
+        error_setg(&local_err,
+                   "local migration requires a UNIX domain socket channel");
+        goto out;
+    }
+
      if (migrate_channel_requires_tls_upgrade(ioc)) {
          migration_tls_channel_process_incoming(ioc, &local_err);
      } else {
@@ -241,6 +248,16 @@ void migration_channel_connect_outgoing(MigrationState *s, 
QIOChannel *ioc)
  {
      trace_migration_set_outgoing_channel(ioc, 
object_get_typename(OBJECT(ioc)));
+ if (migrate_local() && migrate_mode() != MIG_MODE_CPR_EXEC &&
+        !qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_FD_PASS)) {
+        Error *local_err = NULL;
+
+        error_setg(&local_err,
+                   "local migration requires a UNIX domain socket channel");
+        migration_connect_error_propagate(s, local_err);
+        return;
+    }
+

We only need to touch migration_capabilities_and_transport_compatible()?
It should work for both, and fail QMP commands directly might also be
slightly better.

Hm. Don't remember why I didn't go this way. Will try.


      if (migrate_channel_requires_tls_upgrade(ioc)) {
          Error *local_err = NULL;
--
2.43.0




--
Best regards,
Vladimir

Reply via email to