lib/repo: Add min-free-space-percent option, default 3%
For ostree-as-host, we're the superuser, so we'll blow past any reserved free space by default. While deltas have size metadata, if one happens to do a loose fetch, we can fill up the disk. Another case is flatpak: the system helper has similar concerns here as ostree-as-host, and for `flatpak --user`, we also want to be nice and avoid filling up the user's quota. Closes: https://github.com/ostreedev/ostree/issues/962 Closes: #987 Approved by: jlebon
This commit is contained in:
1 parent
8d4d638e99
commit
1f5ce1a9f7
5 files changed
+94
No files matched your search
@@ -44,6 +44,7 @@
|
||||
#include <locale.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
/**
|
||||
* SECTION:ostree-repo
|
||||
@@ -1964,6 +1965,20 @@ reload_core_config (OstreeRepo *self,
|
||||
self->zlib_compression_level = OSTREE_ARCHIVE_DEFAULT_COMPRESSION_LEVEL;
|
||||
}
|
||||
|
||||
{ g_autofree char *min_free_space_percent_str = NULL;
|
||||
/* If changing this, be sure to change the man page too */
|
||||
const char *default_min_free_space = "3";
|
||||
|
||||
if (!ot_keyfile_get_value_with_default (self->config, "core", "min-free-space-percent",
|
||||
default_min_free_space,
|
||||
&min_free_space_percent_str, error))
|
||||
return FALSE;
|
||||
|
||||
self->min_free_space_percent = g_ascii_strtoull (min_free_space_percent_str, NULL, 10);
|
||||
if (self->min_free_space_percent > 99)
|
||||
return glnx_throw (error, "Invalid min-free-space-percent '%s'", min_free_space_percent_str);
|
||||
}
|
||||
|
||||
{
|
||||
g_clear_pointer (&self->collection_id, g_free);
|
||||
if (!ot_keyfile_get_value_with_default (self->config, "core", "collection-id",
|
||||
|
||||
Reference in new issue
Block a user