All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-lvm] LVM tools return ECMD_FAILED when they shouldn't (exported vg)
@ 2010-07-25 14:57 Oren Held
  0 siblings, 0 replies; only message in thread
From: Oren Held @ 2010-07-25 14:57 UTC (permalink / raw)
  To: linux-lvm; +Cc: Meori Oransky

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

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

[-- Attachment #2: lvm-distinguish-between-fail-and-exported-vg-status.patch --]
[-- Type: text/x-patch, Size: 1240 bytes --]

? 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-25 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-25 14:57 [linux-lvm] LVM tools return ECMD_FAILED when they shouldn't (exported vg) Oren Held

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.