All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oren Held <oren@held.org.il>
To: linux-lvm@redhat.com
Cc: Meori Oransky <MEORIO@il.ibm.com>
Subject: [linux-lvm] LVM tools return ECMD_FAILED when they shouldn't (exported vg)
Date: Sun, 25 Jul 2010 17:57:04 +0300	[thread overview]
Message-ID: <4C4C50C0.50406@held.org.il> (raw)

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

                 reply	other threads:[~2010-07-25 14:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C4C50C0.50406@held.org.il \
    --to=oren@held.org.il \
    --cc=MEORIO@il.ibm.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.