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.
This commit is contained in:
Lennart Poettering
2015-02-26 00:43:16 +01:00
parent 3a4efbff2e
commit efe0286285
3 changed files with 102 additions and 7 deletions
+4
View File
@@ -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.");