diff --git a/vmm/src/config.rs b/vmm/src/config.rs index d04536f60..1d8979210 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -2205,6 +2205,13 @@ pub struct RestoredNetConfig { pub id: String, #[serde(default)] pub num_fds: usize, + // Special (de)serialize handling: + // A serialize-deserialize cycle typically happens across processes. + // Therefore, we don't serialize FDs, and whatever value is here after + // deserialization is invalid. + // + // Valid FDs are transmitted via a different channel (SCM_RIGHTS message) + // and will be populated into this struct on the destination VMM eventually. #[serde( default, serialize_with = "serialize_restorednetconfig_fds", @@ -2221,9 +2228,10 @@ where S: serde::Serializer, { if let Some(x) = x { - warn!( - "'RestoredNetConfig' contains FDs that can't be serialized correctly. Serializing them as invalid FDs." - ); + // If the live-migration path is used properly, new FDs are passed as + // SCM_RIGHTS message. So, we don't get them from the serialized JSON + // anyway. + debug!("FDs in 'RestoredNetConfig' won't be serialized as they are most likely invalid after deserialization. Serializing them as -1."); let invalid_fds = vec![-1; x.len()]; s.serialize_some(&invalid_fds) } else { @@ -2239,8 +2247,11 @@ where { let invalid_fds: Option> = Option::deserialize(d)?; if let Some(invalid_fds) = invalid_fds { - warn!( - "'RestoredNetConfig' contains FDs that can't be deserialized correctly. Deserializing them as invalid FDs." + // If the live-migration path is used properly, new FDs are passed as + // SCM_RIGHTS message. So, we don't get them from the serialized JSON + // anyway. + debug!( + "FDs in 'RestoredNetConfig' won't be deserialized as they are most likely invalid now. Deserializing them as -1." ); Ok(Some(vec![-1; invalid_fds.len()])) } else { diff --git a/vmm/src/vm_config.rs b/vmm/src/vm_config.rs index 76fe2d2b2..49e3e9596 100644 --- a/vmm/src/vm_config.rs +++ b/vmm/src/vm_config.rs @@ -324,6 +324,12 @@ pub struct NetConfig { pub vhost_mode: VhostMode, #[serde(default)] pub id: Option, + // Special (de)serialize handling: + // Therefore, we don't serialize FDs, and whatever value is here after + // deserialization is invalid. + // + // Valid FDs are transmitted via a different channel (SCM_RIGHTS message) + // and will be populated into this struct on the destination VMM eventually. #[serde( default, serialize_with = "serialize_netconfig_fds", @@ -371,9 +377,7 @@ where S: serde::Serializer, { if let Some(x) = x { - warn!( - "'NetConfig' contains FDs that can't be serialized correctly. Serializing them as invalid FDs." - ); + debug!("FDs in 'NetConfig' won't be serialized as they are most likely invalid after deserialization; using -1."); let invalid_fds = vec![-1; x.len()]; s.serialize_some(&invalid_fds) } else { @@ -387,8 +391,8 @@ where { let invalid_fds: Option> = Option::deserialize(d)?; if let Some(invalid_fds) = invalid_fds { - warn!( - "'NetConfig' contains FDs that can't be deserialized correctly. Deserializing them as invalid FDs." + debug!( + "FDs in 'NetConfig' won't be deserialized as they are most likely invalid now. Deserializing them as -1." ); Ok(Some(vec![-1; invalid_fds.len()])) } else {