summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-02-26 00:40:43 +0100
committerLennart Poettering <lennart@poettering.net>2015-02-26 00:43:16 +0100
commitefe0286285a7432f738fafae840fa4eda51c2986 (patch)
tree8e1871cedf8f4f23bace08ae42b1d4a901a706f1 /src/machine
parent3a4efbff2e729194d286f483bd8e122c52ff1129 (diff)
machined: if /var/lib/machines is backed by a loop file, resize it on "machinectl set-limit"
When the pool size limit is altered with "machinectl set-limit", then not only set the subvolume quota of the /var/lib/machine subvolume, but also resize the backing loop file and the btrfs file system on it dynamically.
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/machined-dbus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index fdb9d5fac8..0b57a62fd4 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -799,6 +799,10 @@ static int method_set_pool_limit(sd_bus *bus, sd_bus_message *message, void *use
if (r == 0)
return 1; /* Will call us back */
+ r = btrfs_resize_loopback("/var/lib/machines", limit);
+ if (r < 0 && r != -ENODEV)
+ return sd_bus_error_set_errnof(error, r, "Failed to adjust loopback limit: %m");
+
r = btrfs_quota_limit("/var/lib/machines", limit);
if (r == -ENOTTY)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Quota is only supported on btrfs.");