mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Use variables directly in format! string
Fix clippy warning `uninlined_format_args` reported by rustc rustc
1.89.0 (29483883e 2025-08-04).
```console
warning: variables can be used directly in the `format!` string
--> block/src/lib.rs:649:17
|
649 | info!("{} failed to create io_uring instance: {}", error_msg, e);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `#[warn(clippy::uninlined_format_args)]` on by default
help: change this to
|
649 - info!("{} failed to create io_uring instance: {}", error_msg, e);
649 + info!("{error_msg} failed to create io_uring instance: {e}");
|
```
Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
committed by
cloud-hypervisor-bot
parent
ea83fe314c
commit
f2dfa7f6e0
@@ -81,7 +81,7 @@ impl Blk {
|
||||
config,
|
||||
paused,
|
||||
) = if let Some(state) = state {
|
||||
info!("Restoring vhost-user-block {}", id);
|
||||
info!("Restoring vhost-user-block {id}");
|
||||
|
||||
vu.set_protocol_features_vhost_user(
|
||||
state.acked_features,
|
||||
@@ -135,8 +135,7 @@ impl Blk {
|
||||
|
||||
if num_queues > backend_num_queues {
|
||||
error!(
|
||||
"vhost-user-blk requested too many queues ({}) since the backend only supports {}\n",
|
||||
num_queues, backend_num_queues
|
||||
"vhost-user-blk requested too many queues ({num_queues}) since the backend only supports {backend_num_queues}\n"
|
||||
);
|
||||
return Err(Error::BadQueueNum);
|
||||
}
|
||||
@@ -216,13 +215,13 @@ impl Drop for Blk {
|
||||
if let Some(kill_evt) = self.common.kill_evt.take()
|
||||
&& let Err(e) = kill_evt.write(1)
|
||||
{
|
||||
error!("failed to kill vhost-user-blk: {:?}", e);
|
||||
error!("failed to kill vhost-user-blk: {e:?}");
|
||||
}
|
||||
self.common.wait_for_epoll_threads();
|
||||
if let Some(thread) = self.epoll_thread.take()
|
||||
&& let Err(e) = thread.join()
|
||||
{
|
||||
error!("Error joining thread: {:?}", e);
|
||||
error!("Error joining thread: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,7 +274,7 @@ impl VirtioDevice for Blk {
|
||||
.set_config(offset as u32, VhostUserConfigFlags::WRITABLE, data)
|
||||
.map_err(Error::VhostUserSetConfig)
|
||||
{
|
||||
error!("Failed setting vhost-user-blk configuration: {:?}", e);
|
||||
error!("Failed setting vhost-user-blk configuration: {e:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +330,7 @@ impl VirtioDevice for Blk {
|
||||
if let Some(vu) = &self.vu_common.vu
|
||||
&& let Err(e) = vu.lock().unwrap().reset_vhost_user()
|
||||
{
|
||||
error!("Failed to reset vhost-user daemon: {:?}", e);
|
||||
error!("Failed to reset vhost-user daemon: {e:?}");
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ impl Fs {
|
||||
config,
|
||||
paused,
|
||||
) = if let Some(state) = state {
|
||||
info!("Restoring vhost-user-fs {}", id);
|
||||
info!("Restoring vhost-user-fs {id}");
|
||||
|
||||
vu.set_protocol_features_vhost_user(
|
||||
state.acked_features,
|
||||
@@ -148,8 +148,7 @@ impl Fs {
|
||||
|
||||
if num_queues > backend_num_queues {
|
||||
error!(
|
||||
"vhost-user-fs requested too many queues ({}) since the backend only supports {}\n",
|
||||
num_queues, backend_num_queues
|
||||
"vhost-user-fs requested too many queues ({num_queues}) since the backend only supports {backend_num_queues}\n"
|
||||
);
|
||||
return Err(Error::BadQueueNum);
|
||||
}
|
||||
@@ -230,7 +229,7 @@ impl Drop for Fs {
|
||||
if let Some(thread) = self.epoll_thread.take()
|
||||
&& let Err(e) = thread.join()
|
||||
{
|
||||
error!("Error joining thread: {:?}", e);
|
||||
error!("Error joining thread: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +310,7 @@ impl VirtioDevice for Fs {
|
||||
if let Some(vu) = &self.vu_common.vu
|
||||
&& let Err(e) = vu.lock().unwrap().reset_vhost_user()
|
||||
{
|
||||
error!("Failed to reset vhost-user daemon: {:?}", e);
|
||||
error!("Failed to reset vhost-user daemon: {e:?}");
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,8 +265,7 @@ impl<S: VhostUserFrontendReqHandler> EpollHelperHandler for VhostUserEpollHandle
|
||||
HUP_CONNECTION_EVENT => {
|
||||
self.reconnect(helper).map_err(|e| {
|
||||
EpollHelperError::HandleEvent(anyhow!(
|
||||
"failed to reconnect vhost-user backend: {:?}",
|
||||
e
|
||||
"failed to reconnect vhost-user backend: {e:?}"
|
||||
))
|
||||
})?;
|
||||
}
|
||||
@@ -274,8 +273,7 @@ impl<S: VhostUserFrontendReqHandler> EpollHelperHandler for VhostUserEpollHandle
|
||||
if let Some(backend_req_handler) = self.backend_req_handler.as_mut() {
|
||||
backend_req_handler.handle_request().map_err(|e| {
|
||||
EpollHelperError::HandleEvent(anyhow!(
|
||||
"Failed to handle request from vhost-user backend: {:?}",
|
||||
e
|
||||
"Failed to handle request from vhost-user backend: {e:?}"
|
||||
))
|
||||
})?;
|
||||
}
|
||||
@@ -412,7 +410,7 @@ impl VhostUserCommon {
|
||||
pub fn pause(&mut self) -> std::result::Result<(), MigratableError> {
|
||||
if let Some(vu) = &self.vu {
|
||||
vu.lock().unwrap().pause_vhost_user().map_err(|e| {
|
||||
MigratableError::Pause(anyhow!("Error pausing vhost-user backend: {:?}", e))
|
||||
MigratableError::Pause(anyhow!("Error pausing vhost-user backend: {e:?}"))
|
||||
})
|
||||
} else {
|
||||
Ok(())
|
||||
@@ -422,7 +420,7 @@ impl VhostUserCommon {
|
||||
pub fn resume(&mut self) -> std::result::Result<(), MigratableError> {
|
||||
if let Some(vu) = &self.vu {
|
||||
vu.lock().unwrap().resume_vhost_user().map_err(|e| {
|
||||
MigratableError::Resume(anyhow!("Error resuming vhost-user backend: {:?}", e))
|
||||
MigratableError::Resume(anyhow!("Error resuming vhost-user backend: {e:?}"))
|
||||
})
|
||||
} else {
|
||||
Ok(())
|
||||
@@ -454,8 +452,7 @@ impl VhostUserCommon {
|
||||
.start_dirty_log(last_ram_addr)
|
||||
.map_err(|e| {
|
||||
MigratableError::StartDirtyLog(anyhow!(
|
||||
"Error starting migration for vhost-user backend: {:?}",
|
||||
e
|
||||
"Error starting migration for vhost-user backend: {e:?}"
|
||||
))
|
||||
})
|
||||
} else {
|
||||
@@ -472,8 +469,7 @@ impl VhostUserCommon {
|
||||
if let Some(vu) = &self.vu {
|
||||
vu.lock().unwrap().stop_dirty_log().map_err(|e| {
|
||||
MigratableError::StopDirtyLog(anyhow!(
|
||||
"Error stopping migration for vhost-user backend: {:?}",
|
||||
e
|
||||
"Error stopping migration for vhost-user backend: {e:?}"
|
||||
))
|
||||
})
|
||||
} else {
|
||||
@@ -490,8 +486,7 @@ impl VhostUserCommon {
|
||||
let last_ram_addr = guest_memory.memory().last_addr().raw_value();
|
||||
vu.lock().unwrap().dirty_log(last_ram_addr).map_err(|e| {
|
||||
MigratableError::DirtyLog(anyhow!(
|
||||
"Error retrieving dirty ranges from vhost-user backend: {:?}",
|
||||
e
|
||||
"Error retrieving dirty ranges from vhost-user backend: {e:?}"
|
||||
))
|
||||
})
|
||||
} else {
|
||||
@@ -518,8 +513,7 @@ impl VhostUserCommon {
|
||||
if let Some(kill_evt) = kill_evt {
|
||||
kill_evt.write(1).map_err(|e| {
|
||||
MigratableError::CompleteMigration(anyhow!(
|
||||
"Error killing vhost-user thread: {:?}",
|
||||
e
|
||||
"Error killing vhost-user thread: {e:?}"
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ impl Net {
|
||||
config,
|
||||
paused,
|
||||
) = if let Some(state) = state {
|
||||
info!("Restoring vhost-user-net {}", id);
|
||||
info!("Restoring vhost-user-net {id}");
|
||||
|
||||
// The backend acknowledged features must not contain
|
||||
// VIRTIO_NET_F_MAC since we don't expect the backend
|
||||
@@ -169,8 +169,7 @@ impl Net {
|
||||
|
||||
if num_queues > backend_num_queues {
|
||||
error!(
|
||||
"vhost-user-net requested too many queues ({}) since the backend only supports {}\n",
|
||||
num_queues, backend_num_queues
|
||||
"vhost-user-net requested too many queues ({num_queues}) since the backend only supports {backend_num_queues}\n"
|
||||
);
|
||||
return Err(Error::BadQueueNum);
|
||||
}
|
||||
@@ -246,7 +245,7 @@ impl Drop for Net {
|
||||
if let Some(kill_evt) = self.common.kill_evt.take()
|
||||
&& let Err(e) = kill_evt.write(1)
|
||||
{
|
||||
error!("failed to kill vhost-user-net: {:?}", e);
|
||||
error!("failed to kill vhost-user-net: {e:?}");
|
||||
}
|
||||
|
||||
self.common.wait_for_epoll_threads();
|
||||
@@ -254,13 +253,13 @@ impl Drop for Net {
|
||||
if let Some(thread) = self.epoll_thread.take()
|
||||
&& let Err(e) = thread.join()
|
||||
{
|
||||
error!("Error joining thread: {:?}", e);
|
||||
error!("Error joining thread: {e:?}");
|
||||
}
|
||||
|
||||
if let Some(thread) = self.ctrl_queue_epoll_thread.take()
|
||||
&& let Err(e) = thread.join()
|
||||
{
|
||||
error!("Error joining thread: {:?}", e);
|
||||
error!("Error joining thread: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -386,7 +385,7 @@ impl VirtioDevice for Net {
|
||||
if let Some(vu) = &self.vu_common.vu
|
||||
&& let Err(e) = vu.lock().unwrap().reset_vhost_user()
|
||||
{
|
||||
error!("Failed to reset vhost-user daemon: {:?}", e);
|
||||
error!("Failed to reset vhost-user daemon: {e:?}");
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -409,10 +409,7 @@ impl VhostUserHandle {
|
||||
}
|
||||
};
|
||||
|
||||
error!(
|
||||
"Failed connecting the backend after trying for 1 minute: {:?}",
|
||||
err
|
||||
);
|
||||
error!("Failed connecting the backend after trying for 1 minute: {err:?}");
|
||||
Err(Error::VhostUserConnect)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user