LVM tools return ECMD_FAILED when they shouldn't (exported vg)

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

 



Hi All,

We have encountered an unexpected behavior, in which 'lvs' command
behaves well (lists the LV's) but still returns rc==5. Well, the reason
is that we've had an exported vg. It's indeed something the user might
care about, yet its severity should be less than other "failed command"
situations.

What I suggest, is adding a new error type "EXPORTED_VG_WARNING", for
these cases, that would be returned by toollib.c's
process_each_lv_in_vg() function in this specific case of
failure-because-vg-is-exported.

I've used error number 4 (it seemed available), because the erroring
mechanism in process_each_lv cares about the error number's value, so it
should be lower than ECMD_FAILED.

Attached is the patch.

Best Regards

Oren Held
? doc/example.conf
? include/.symlinks
? lib/misc/lvm-version.h
? libdm/.exported_symbols_generated
? libdm/ioctl/libdevmapper.so.1.02
? scripts/clvmd_init_red_hat
? scripts/cmirrord_init_red_hat
? scripts/lvm2_monitoring_init_red_hat
? tools/dmsetup
? tools/lvm
Index: lib/commands/errors.h
===================================================================
RCS file: /cvs/lvm2/LVM2/lib/commands/errors.h,v
retrieving revision 1.6
diff -u -r1.6 errors.h
--- lib/commands/errors.h	30 Jun 2009 18:39:31 -0000	1.6
+++ lib/commands/errors.h	25 Jul 2010 13:51:56 -0000
@@ -19,6 +19,7 @@
 #define ECMD_PROCESSED		1
 #define ENO_SUCH_CMD		2
 #define EINVALID_CMD_LINE	3
+#define ECMD_EXPORTED_VG	4
 #define ECMD_FAILED		5
 
 /* FIXME Also returned by cmdlib. */
Index: tools/toollib.c
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/toollib.c,v
retrieving revision 1.207
diff -u -r1.207 toollib.c
--- tools/toollib.c	30 Jun 2010 20:03:53 -0000	1.207
+++ tools/toollib.c	25 Jul 2010 13:51:58 -0000
@@ -101,7 +101,7 @@
 	struct lv_list *lvl;
 
 	if (!vg_check_status(vg, EXPORTED_VG))
-		return ECMD_FAILED;
+		return ECMD_EXPORTED_VG;
 
 	if (tags && !dm_list_empty(tags))
 		tags_supplied = 1;
_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux