[Spice-devel] [PATCH spice-common] RFC: spice.proto: Start a NBD channel

Marc-André Lureau marcandre.lureau at gmail.com
Wed Jun 5 08:34:12 PDT 2013


The NBD channel is a specialized port channel which implements the NBD
protocol over the Data messages (the NBD server implementation may not
implement the whole protocol, for example, it may be read-only, but
should reply with appropriate errors where required)

To allow to gracefully switch NBD sessions, the Spice client should send
a SPICE_PORT_EVENT_BREAK, so that the server can close the session, and
take appropriate actions (such as eject the removable media).

The NBD session is recreated when the channel receives the
SPICE_PORT_EVENT_OPENED.

The combinations of those 2 events allow the client to switch the
exported images, ex:

Client initiate a switch:
> SPICE_PORT_EVENT_BREAK
Server finishes the session, eject the medium and close NBD:
< NBD_CMD_FLUSH
< NBD_CMD_DISC
Server is ready for a new session:
< SPICE_PORT_EVENT_OPENED
> NBD negotiation

There is currently no information about the associated device or name.
The spice client doesn't even know if this channel should be read-write
etc (but it is still free to provide read-only services). We may want to
use the port message to identify the associated device?
---
 spice.proto | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/spice.proto b/spice.proto
index 5eede6b..eff9706 100644
--- a/spice.proto
+++ b/spice.proto
@@ -1347,6 +1347,9 @@ channel PortChannel : SpicevmcChannel {
     } event;
 };
 
+channel NbdChannel : PortChannel {
+};
+
 protocol Spice {
     MainChannel main = 1;
     DisplayChannel display;
@@ -1357,5 +1360,6 @@ protocol Spice {
     TunnelChannel tunnel;
     SmartcardChannel smartcard;
     UsbredirChannel usbredir;
+    NbdChannel nbd;
     PortChannel port;
 };
-- 
1.8.3.rc1.49.g8d97506



More information about the Spice-devel mailing list