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

[lvm-devel] fix lvmdiskscan volume reporting when using lvm shell



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Currently lvmdiskscan uses four global counters to track the number of
disks, partitions & PVs located. These are statically initialised to
zero but are never reset between runs.

This is fine for the standalone command but causes mis-reporting when
the tool is repeatedly run in the lvm shell:

# lvm
lvm> lvmdiskscan
  /dev/ramdisk               [       16.00 MB]
  /dev/loop0                 [      500.00 MB] LVM physical volume
[...]
  7 disks
  14 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume
lvm> lvmdiskscan
  /dev/ramdisk               [       16.00 MB]
  /dev/loop0                 [      500.00 MB] LVM physical volume
[...]
  14 disks
  28 partitions
  0 LVM physical volume whole disks
  2 LVM physical volumes

etc.

Patch just moves the initialisation into the lvmdiskscan function.

Regards,
Bryn.
	
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGf7jZ6YSQoMYUY94RAjUEAJ9LMqyi8bZdRqNrynK6CefPnIau2ACfVv4I
km8ZqH2XpwTPdxhWhSx37og=
=ce90
-----END PGP SIGNATURE-----
Index: tools/lvmdiskscan.c
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/lvmdiskscan.c,v
retrieving revision 1.17
diff -u -r1.17 lvmdiskscan.c
--- tools/lvmdiskscan.c	23 Apr 2007 18:21:01 -0000	1.17
+++ tools/lvmdiskscan.c	25 Jun 2007 12:39:30 -0000
@@ -21,10 +21,10 @@
 
 #include "tools.h"
 
-int disks_found = 0;
-int parts_found = 0;
-int pv_disks_found = 0;
-int pv_parts_found = 0;
+int disks_found;
+int parts_found;
+int pv_disks_found;
+int pv_parts_found;
 int max_len;
 
 static int _get_max_dev_name_len(struct dev_filter *filter)
@@ -99,6 +99,12 @@
 	struct device *dev;
 	struct label *label;
 
+	/* initialise these here to avoid problems with the lvm shell */
+	disks_found = 0;
+	parts_found = 0;
+	pv_disks_found = 0;
+	pv_parts_found = 0;
+
 	if (arg_count(cmd, lvmpartition_ARG))
 		log_print("WARNING: only considering LVM devices");
 

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