[Pkg-libvirt-commits] [libguestfs] 188/384: New API: add btrfs_rescue_chunk_recover

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:56:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 15c75eaace30d6c8786532482eb040071a3f28ec
Author: Hu Tao <hutao at cn.fujitsu.com>
Date:   Fri Jan 16 10:23:46 2015 +0800

    New API: add btrfs_rescue_chunk_recover
    
    Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
 daemon/btrfs.c       | 26 ++++++++++++++++++++++++++
 generator/actions.ml | 14 ++++++++++++++
 src/MAX_PROC_NR      |  2 +-
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 9fa6511..41300b2 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -1607,3 +1607,29 @@ do_btrfs_filesystem_defragment (const char *path, int flush, const char *compres
 
   return 0;
 }
+
+int
+do_btrfs_rescue_chunk_recover (const char *device)
+{
+  const size_t MAX_ARGS = 64;
+  const char *argv[MAX_ARGS];
+  size_t i = 0;
+  CLEANUP_FREE char *err = NULL;
+  CLEANUP_FREE char *out = NULL;
+  int r;
+
+  ADD_ARG (argv, i, str_btrfs);
+  ADD_ARG (argv, i, "rescue");
+  ADD_ARG (argv, i, "chunk-recover");
+  ADD_ARG (argv, i, "-y");
+  ADD_ARG (argv, i, device);
+  ADD_ARG (argv, i, NULL);
+
+  r = commandv (&out, &err, argv);
+  if (r == -1) {
+    reply_with_error ("%s: %s", device, err);
+    return -1;
+  }
+
+  return 0;
+}
diff --git a/generator/actions.ml b/generator/actions.ml
index 0dc8520..6b9c02e 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12357,6 +12357,20 @@ Resume a paused balance on a btrfs filesystem." };
     longdesc = "\
 Defragment a file or directory on a btrfs filesystem. compress is one of zlib or lzo." };
 
+  { defaults with
+    name = "btrfs_rescue_chunk_recover";
+    style = RErr, [Device "device"], [];
+    proc_nr = Some 444;
+    optional = Some "btrfs"; camel_name = "BTRFSRescueChunkRecover";
+    tests = [
+      InitPartition, Always, TestRun (
+        [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; "NOARG"; ""; ""];
+         ["btrfs_rescue_chunk_recover"; "/dev/sda1"]]), [];
+    ];
+    shortdesc = "recover the chunk tree of btrfs filesystem";
+    longdesc = "\
+Recover the chunk tree of btrfs filesystem by scannning the devices one by one." };
+
 ]
 
 (* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 6a13cf6..1e6fd03 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-443
+444

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list