[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/9] New API: vgscan



This isn't related to the patch, but since I wrote it and it's
a useful function, I didn't want to drop the feature.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
>From 9752039e52d190c7d62281346fd2170a98434c86 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones redhat com>
Date: Sat, 10 Apr 2010 13:14:12 +0100
Subject: [PATCH 2/9] New API: vgscan

Implement vgscan to allow for a full rescan of all LVM
PVs, VGs and LVs.
---
 daemon/lvm.c     |   18 ++++++++++++++++++
 src/generator.ml |    8 ++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/daemon/lvm.c b/daemon/lvm.c
index e4fa54e..20f2fb3 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -594,3 +594,21 @@ do_vglvuuids (const char *vgname)
 {
   return get_lvm_fields ("vgs", "lv_uuid", vgname);
 }
+
+int
+do_vgscan (void)
+{
+  char *err;
+  int r;
+
+  r = command (NULL, &err,
+               "lvm", "vgscan", NULL);
+  if (r == -1) {
+    reply_with_error ("%s", err);
+    free (err);
+    return -1;
+  }
+
+  free (err);
+  return 0;
+}
diff --git a/src/generator.ml b/src/generator.ml
index 24b9bc0..b423025 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4381,6 +4381,14 @@ This command resizes an NTFS filesystem, expanding or
 shrinking it to the size of the underlying device.
 See also L<ntfsresize(8)>.");
 
+  ("vgscan", (RErr, []), 232, [],
+   [InitEmpty, Always, TestRun (
+      [["vgscan"]])],
+   "rescan for LVM physical volumes, volume groups and logical volumes",
+   "\
+This rescans all block devices and rebuilds the list of LVM
+physical volumes, volume groups and logical volumes.");
+
 ]
 
 let all_functions = non_daemon_functions @ daemon_functions
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]