Add version negotiation for migration protocol#114
Add version negotiation for migration protocol#114Coffeeri wants to merge 3 commits intocyberus-technology:gardenlinuxfrom
Conversation
32cd5c1 to
4d7571b
Compare
333946d to
4777340
Compare
1e44c2e to
97ead4b
Compare
Would it be possible to 1.) change CHV so it ignores new fields in Commands that it does not yet know about and gracefully handle missing fields in responses and 2.) add new fields that encode the supported versions? This way, we could do changes to the migration protocol later easier, as long as they don't change the semantics of existing fields. We also shouldn't be breaking then (if we do it in those 2 steps and do not skip versions when upgrading). Not sure if really required but at least have a short discussion about it. |
phip1611
left a comment
There was a problem hiding this comment.
Thanks for the great work! Left some remarks
CHV doesn't know anything about the bytes it reads from the network. The only way to go from bytes to struct is to apply some known conversion, which basically means treating a predefined amount of bytes as type
Isn't that just treating the current implementation as version 0 and the negotiation just works/fails depending on whether both sides support version 0? @Coffeeri I think the general design of the handshake is good. Please assign me as one of the reviewers when code reviews are in order. |
@hertrste
Yes, exactly. We should handle v0 (impl without version negation) as a separate version, but we don't have to support it in the future if we have a migration path via an intermediate migration protocol version. Does the overall design suite the others as well?
Open questions to the discussion:
impl MigrationProtocolVersion {
pub const LEGACY: Self = Self::V0;
pub const CURRENT: Self = Self::V1;We should be careful not to model this as something like our planned 3-version support [prior, current, nightly], because protocol versions need stable, explicit identities per release. Each concrete protocol revision should keep its own defined version number, rather than being derived from moving labels. I'd like it to be explicit. |
amphi
left a comment
There was a problem hiding this comment.
Why does the sender have a "minimum supported version"? I think the sender should just send using the newest version it supports, and the receiver has to decide whether it can support that version.
Otherwise, we'd give the sender the ability to send using an older protocol than it supports. In which case would that be helpful?
7b5f772 to
f21e912
Compare
ecb08f6 to
daedb5d
Compare
2149a1a to
5561c41
Compare
5561c41 to
d36d30a
Compare
Add protocol-side support for migration protocol versioning. Use the existing 6-byte Start command header, which was previously zero padding, to carry the sender's migration protocol version without changing the wire layout. Store the version as a little-endian u16 in the first two bytes and ignore the remaining four bytes. A zeroed command header continues to mean a legacy v0 sender. This keeps the message flow unchanged for rollout: Start is still followed by plain OK or Error (Aborted), and no new command is needed. On-behalf-of: SAP leander.kohler@sap.com Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
Validate the sender's migration protocol version when handling the initial Start request. Read the version from the Start command header, accept only the supported version window n-1..=n, and reject unsupported versions with Error. A rejected Start moves the receiver to the aborted state. This keeps compatibility one-way, from older protocol versions to newer ones, and leaves later version-based branching on the receiver side. Log the protocol version on both sender and receiver to make the active migration path visible. On-behalf-of: SAP leander.kohler@sap.com Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
Print the supported vm-migration protocol version range in cloud-hypervisor --version as an extra line: vm-migration protocol versions v0-v1 This makes the currently supported compatibility window visible without having to inspect the migration code. On-behalf-of: SAP leander.kohler@sap.com Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
d36d30a to
d22e787
Compare
This PR implements https://github.com/cobaltcore-dev/cobaltcore/issues/464 and introduces version negotiation for the migration protocol.
Steps before Merging