From 33fd0af8b3fb4e7907c869cc4d6501543fd529ed Mon Sep 17 00:00:00 2001
From: Rob Bradford <robert.bradford@intel.com>
Date: Mon, 17 Jan 2022 16:40:01 +0000
Subject: [PATCH] vm-migration: Update protocol for FD based live migration

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
---
 vm-migration/src/protocol.rs | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/vm-migration/src/protocol.rs b/vm-migration/src/protocol.rs
index 99989b2e7..8b2aad48f 100644
--- a/vm-migration/src/protocol.rs
+++ b/vm-migration/src/protocol.rs
@@ -27,7 +27,24 @@ use vm_memory::ByteValued;
 // (n-2): Dest -> Source : sends "ok response"
 // (n-1): Source -> Dest : send "complete command"
 // n: Dest -> Source: sends "ok response"
-
+//
+// "Local version": (Handing FDs across socket for memory)
+// 1: Source establishes communication with destination (file socket or TCP connection.)
+// (The establishment is out of scope.)
+// 2: Source -> Dest : send "start command"
+// 3: Dest -> Source : sends "ok response" when read to accept state data
+// 4: Source -> Dest : sends "config command" followed by config data, length
+//                     in command is length of config data
+// 5: Dest -> Source : sends "ok response" when ready to accept memory data
+// 6: Source -> Dest : send "memory fd command" followed by u16 slot ID and FD for memory
+// 7: Dest -> Source : sends "ok response" when received
+// 8..(n-4): Repeat steps 6 and 7 until source has no more memory to send
+// (n-3): Source -> Dest : sends "state command" followed by state data, length
+//                     in command is length of config data
+// (n-2): Dest -> Source : sends "ok response"
+// (n-1): Source -> Dest : send "complete command"
+// n: Dest -> Source: sends "ok response"
+//
 // The destination can at any time send an "error response" to cancel
 // The source can at any time send an "abandon request" to cancel