From bf752054784e123dfdb4cba9a948bb8fb66865e9 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Thu, 13 Jul 2023 11:43:10 +0530 Subject: [PATCH] crates: Don't warn for vhost_user::Error::Disconnected The vhost_user::Error::Disconnected error code is returned by the daemon if the VM is shutting down. Don't Warn the user in this case but just point out that VM may be shutting down. Signed-off-by: Viresh Kumar --- crates/gpio/src/backend.rs | 2 +- crates/i2c/src/main.rs | 2 +- crates/rng/src/main.rs | 2 +- crates/scsi/src/main.rs | 4 +++- crates/vsock/src/main.rs | 4 +++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/gpio/src/backend.rs b/crates/gpio/src/backend.rs index 28408eb..872073b 100644 --- a/crates/gpio/src/backend.rs +++ b/crates/gpio/src/backend.rs @@ -173,7 +173,7 @@ fn start_backend(args: GpioArgs) -> Resul info!("Stopping cleanly."); } Err(vhost_user_backend::Error::HandleRequest( - vhost_user::Error::PartialMessage, + vhost_user::Error::PartialMessage | vhost_user::Error::Disconnected, )) => { info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug."); } diff --git a/crates/i2c/src/main.rs b/crates/i2c/src/main.rs index 4698063..457feba 100644 --- a/crates/i2c/src/main.rs +++ b/crates/i2c/src/main.rs @@ -215,7 +215,7 @@ fn start_backend(args: I2cArgs) -> Result< info!("Stopping cleanly."); } Err(vhost_user_backend::Error::HandleRequest( - vhost_user::Error::PartialMessage, + vhost_user::Error::PartialMessage | vhost_user::Error::Disconnected, )) => { info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug."); } diff --git a/crates/rng/src/main.rs b/crates/rng/src/main.rs index a1767a7..eac7ba8 100644 --- a/crates/rng/src/main.rs +++ b/crates/rng/src/main.rs @@ -139,7 +139,7 @@ pub(crate) fn start_backend(config: VuRngConfig) -> Result<()> { info!("Stopping cleanly."); } Err(vhost_user_backend::Error::HandleRequest( - vhost_user::Error::PartialMessage, + vhost_user::Error::PartialMessage | vhost_user::Error::Disconnected, )) => { info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug."); } diff --git a/crates/scsi/src/main.rs b/crates/scsi/src/main.rs index 9a4c733..8ca2922 100644 --- a/crates/scsi/src/main.rs +++ b/crates/scsi/src/main.rs @@ -108,7 +108,9 @@ fn start_backend(backend: VhostUserScsiBackend, args: ScsiArgs) -> Result<()> { Ok(()) => { info!("Stopping cleanly."); } - Err(vhost_user_backend::Error::HandleRequest(vhost_user::Error::PartialMessage)) => { + Err(vhost_user_backend::Error::HandleRequest( + vhost_user::Error::PartialMessage | vhost_user::Error::Disconnected, + )) => { info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug."); } Err(e) => { diff --git a/crates/vsock/src/main.rs b/crates/vsock/src/main.rs index c1156b6..4ff0f93 100644 --- a/crates/vsock/src/main.rs +++ b/crates/vsock/src/main.rs @@ -224,7 +224,9 @@ pub(crate) fn start_backend_server( Ok(()) => { info!("Stopping cleanly"); } - Err(vhost_user_backend::Error::HandleRequest(vhost_user::Error::PartialMessage)) => { + Err(vhost_user_backend::Error::HandleRequest( + vhost_user::Error::PartialMessage | vhost_user::Error::Disconnected, + )) => { info!("vhost-user connection closed with partial message. If the VM is shutting down, this is expected behavior; otherwise, it might be a bug."); } Err(e) => {