From b09acfa2c2343161bcb47ab5bd0fa6fbb3f558e7 Mon Sep 17 00:00:00 2001 From: Wei Zhang Date: Thu, 3 Aug 2023 14:17:22 +0800 Subject: [PATCH] service: print more error message Some error messages were swallowed which makes user confused, for example, for RAFSv6, we need to set blobcache config in `localfs.json` (following docs tutorial), before modification, the error message indicates nothing: ``` ERROR [src/bin/nydusd/main.rs:525] Failed in starting daemon: Invalid argument (os error 22) ``` After this modification, we get clearer error message: ``` ERROR [/src/fusedev.rs:595] service mount error: RAFS failed to handle request, Configure("Rafs v6 must have local blobcache configured") ``` Signed-off-by: Wei Zhang --- docs/tutorial.md | 6 ++++++ service/src/fusedev.rs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index 45e897ba9f2..52d17d5d9d3 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -287,6 +287,12 @@ $ cat localfs.json "config": { "dir": "//nydus-image/blobs" } + }, + "cache": { + "type": "blobcache", + "config": { + "work_dir": "/var/lib/nydus/cache" + } } }, "mode": "direct" diff --git a/service/src/fusedev.rs b/service/src/fusedev.rs index bed45ab89ab..e70151647a8 100644 --- a/service/src/fusedev.rs +++ b/service/src/fusedev.rs @@ -591,7 +591,10 @@ pub fn create_fuse_daemon( || api_sock.is_none() { if let Some(cmd) = mount_cmd { - daemon.service.mount(cmd)?; + daemon.service.mount(cmd).map_err(|e| { + error!("service mount error: {}", &e); + eother!(e) + })?; } daemon .service @@ -599,7 +602,10 @@ pub fn create_fuse_daemon( .lock() .unwrap() .mount() - .map_err(|e| eother!(e))?; + .map_err(|e| { + error!("service session mount error: {}", &e); + eother!(e) + })?; daemon .on_event(DaemonStateMachineInput::Mount) .map_err(|e| eother!(e))?;