]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Make various tools more quiet 3493/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Feb 2025 10:14:09 +0000 (11:14 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 11 Feb 2025 12:50:26 +0000 (13:50 +0100)
Let's reduce the noise when booting a vm with mkosi vm by silencing
the output of some tools used during setup that isn't useful.

mkosi/qemu.py
mkosi/tree.py

index 367972b08e58f14065732594a9614c2492b82d44..6dd9f38a320a1a99a53b209fb2e2487ec67d057d 100644 (file)
@@ -361,6 +361,7 @@ def start_virtiofsd(
         "--no-announce-submounts",
         "--sandbox=chroot",
         f"--inode-file-handles={'prefer' if os.getuid() == 0 and not uidmap else 'never'}",
+        "--log-level=error",
     ]  # fmt: skip
 
     if selinux:
@@ -687,8 +688,7 @@ def generate_scratch_fs(config: Config) -> Iterator[Path]:
         fs = config.distribution.filesystem()
         extra = config.environment.get(f"SYSTEMD_REPART_MKFS_OPTIONS_{fs.upper()}", "")
         run(
-            [f"mkfs.{fs}", "-L", "scratch", *extra.split(), workdir(Path(scratch.name))],
-            stdout=subprocess.DEVNULL,
+            [f"mkfs.{fs}", "-L", "scratch", "-q", *extra.split(), workdir(Path(scratch.name))],
             sandbox=config.sandbox(options=["--bind", scratch.name, workdir(Path(scratch.name))]),
         )
         yield Path(scratch.name)
index 1bc5e6d837e588471c814a91fc5596caf2279b77..c97dfe551476649de244cc4ab87c1e4b1e452478 100644 (file)
@@ -51,7 +51,7 @@ def make_tree(
 
     if use_subvolumes != ConfigFeature.disabled:
         result = run(
-            ["btrfs", "subvolume", "create", workdir(path, sandbox)],
+            ["btrfs", "--quiet", "subvolume", "create", workdir(path, sandbox)],
             sandbox=sandbox(options=["--bind", path.parent, workdir(path.parent, sandbox)]),
             check=use_subvolumes == ConfigFeature.enabled,
         ).returncode
@@ -147,7 +147,7 @@ def copy_tree(
         dst.rmdir()
 
     result = run(
-        ["btrfs", "subvolume", "snapshot", workdir(src, sandbox), workdir(dst, sandbox)],
+        ["btrfs", "--quiet", "subvolume", "snapshot", workdir(src, sandbox), workdir(dst, sandbox)],
         check=use_subvolumes == ConfigFeature.enabled,
         sandbox=sandbox(options=options),
     ).returncode
@@ -169,7 +169,7 @@ def rmtree(*paths: Path, sandbox: SandboxProtocol = nosandbox) -> None:
         # Silence and ignore failures since when not running as root, this will fail with a permission error
         # unless the btrfs filesystem is mounted with user_subvol_rm_allowed.
         run(
-            ["btrfs", "subvolume", "delete", *(workdir(p, sandbox) for p in subvolumes)],
+            ["btrfs", "--quiet", "subvolume", "delete", *(workdir(p, sandbox) for p in subvolumes)],
             check=False,
             sandbox=sandbox(
                 options=flatten(("--bind", p.parent, workdir(p.parent, sandbox)) for p in subvolumes),