Skip to content

Commit

Permalink
virtme: show virtiofsd warnings only in verbose mode
Browse files Browse the repository at this point in the history
Hide virtiofsd warnings that may confuse users, unless we are running in
verbose mode.

This fixes issue #51.

Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
Andrea Righi committed Dec 21, 2023
1 parent 93cc871 commit 51f785b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions virtme/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,12 @@ def start(self, path, verbose=True):

# Export the whole root fs of the host, do not enable sandbox, otherwise we
# would get permission errors.
if not verbose:
stderr = "2>/dev/null"
else:
stderr = ""
os.system(
f"{virtiofsd_path} --syslog --socket-path {self.sock} --shared-dir {path} --sandbox none &"
f"{virtiofsd_path} --syslog --socket-path {self.sock} --shared-dir {path} --sandbox none {stderr} &"
)
max_attempts = 5
check_duration = 0.1
Expand All @@ -613,7 +617,8 @@ def start(self, path, verbose=True):
sleep(check_duration)
check_duration *= 2
else:
print("virtme-run: failed to start virtiofsd, fallback to 9p")
if verbose:
sys.stderr.write("virtme-run: failed to start virtiofsd, fallback to 9p")
return False
return True

Expand Down

0 comments on commit 51f785b

Please sign in to comment.