diff options
author | Wanlong Gao <gaowanlong@cn.fujitsu.com> | 2012-05-14 18:38:25 +0800 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-05-14 13:21:53 +0100 |
commit | 18451abdf5b3618750af11da6579db547b266b8d (patch) | |
tree | b1123c5d55fbdb23c51a3ac1c1b5d14d80cf584d | |
parent | a75020a06674a4ec77712c1d8000b51eac53f454 (diff) | |
download | libguestfs-18451abdf5b3618750af11da6579db547b266b8d.tar.gz libguestfs-18451abdf5b3618750af11da6579db547b266b8d.tar.xz libguestfs-18451abdf5b3618750af11da6579db547b266b8d.zip |
New API: add new api btrfs-set-seeding to enable or disable seeding.
Add the new API btrfs-set-seeding to support the seeding-device
feature for btrfs.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
-rw-r--r-- | daemon/btrfs.c | 19 | ||||
-rw-r--r-- | generator/generator_actions.ml | 10 | ||||
-rw-r--r-- | src/MAX_PROC_NR | 2 |
3 files changed, 30 insertions, 1 deletions
diff --git a/daemon/btrfs.c b/daemon/btrfs.c index b0218bc8..ab3babc8 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -600,3 +600,22 @@ do_btrfs_device_delete (char *const *devices, const char *fs) return 0; } + +int +do_btrfs_set_seeding (const char *device, int svalue) +{ + char *err; + int r; + + const char *s_value = svalue ? "1" : "0"; + + r = commandr (NULL, &err, "btrfstune", "-S", s_value, device, NULL); + if (r == -1) { + reply_with_error ("%s: %s", device, err); + free (err); + return -1; + } + + free (err); + return r; +} diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6948dab3..fc2df423 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -7222,6 +7222,16 @@ mounted at C<fs>. If C<devices> is an empty list, this does nothing."); Remove the C<devices> from the btrfs filesystem mounted at C<fs>. If C<devices> is an empty list, this does nothing."); + ("btrfs_set_seeding", (RErr, [Device "device"; Bool "seeding"], []), 331, [Optional "btrfs"], + [InitPartition, IfAvailable "btrfs", TestRun ( + [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""]; + ["btrfs_set_seeding"; "/dev/sda1"; "true"]; + ["btrfs_set_seeding"; "/dev/sda1"; "false"]])], + "enable or disable the seeding feature of device", + "\ +Enable or disable the seeding feature of a device that contains +a btrfs filesystem."); + ] let all_functions = non_daemon_functions @ daemon_functions diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index db2cef56..ec6cab01 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -330 +331 |