deploy: Log calculated needed space
authorColin Walters <walters@verbum.org>
Tue, 19 Dec 2023 20:00:05 +0000 (15:00 -0500)
committerColin Walters <walters@verbum.org>
Wed, 20 Dec 2023 02:04:22 +0000 (21:04 -0500)
To aid debugging issues like https://github.com/coreos/fedora-coreos-tracker/issues/1637

If we're hitting this path where we think we have enough space,
let's log what we calculated here to aid in diagnosing why we
may later fail with ENOSPC.

src/libostree/ostree-sysroot-deploy.c

index ebc0b4fcb298aad3ae8e058d94f9c0c08bb45e81..c7148208bc8fe8ac824afaafc30cd182904d5c1d 100644 (file)
@@ -2657,6 +2657,7 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
       /* it wasn't in current_bootcsums; add */
       net_new_bootcsum_dirs_total_size += bootdir_size;
     }
+  g_autofree char *net_new_formatted = g_format_size (net_new_bootcsum_dirs_total_size);
 
   {
     gboolean bootfs_has_space = FALSE;
@@ -2667,9 +2668,13 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
     /* does the bootfs have enough free space for temporarily holding both the new
      * and old bootdirs? */
     if (bootfs_has_space)
-      return TRUE; /* nothing to do! */
+      {
+        g_printerr ("bootfs is sufficient for calculated new size: %s\n", net_new_formatted);
+        return TRUE; /* nothing to do! */
+      }
   }
 
+  g_printerr ("bootfs requires additional space: %s\n", net_new_formatted);
   /* OK, we would fail if we tried to write the new bootdirs. Is it salvageable?
    * First, calculate how much space we could save with the bootcsums scheduled
    * for removal. */
@@ -2680,6 +2685,11 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
         bootcsum_dirs_to_remove_total_size += GPOINTER_TO_UINT (sizep);
     }
 
+  {
+    g_autofree char *to_remove_formated = g_format_size (bootcsum_dirs_to_remove_total_size);
+    g_printerr ("Size to prune from bootfs: %s\n", to_remove_formated);
+  }
+
   if (net_new_bootcsum_dirs_total_size > bootcsum_dirs_to_remove_total_size)
     {
       /* Check whether if we did early prune, we'd have enough space to write