public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 test/t-pvcreate-operation.sh tools/pvcreate.c Date: Fri, 25 Jul 2008 14:59:00 -0000 [thread overview] Message-ID: <20080725145952.3552.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2008-07-25 14:59:51 Modified files: test : t-pvcreate-operation.sh tools : pvcreate.c Log message: Refactor pvcreate - simplify return codes. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-operation.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73 --- LVM2/test/t-pvcreate-operation.sh 2008/07/25 14:36:52 1.5 +++ LVM2/test/t-pvcreate-operation.sh 2008/07/25 14:59:51 1.6 @@ -42,6 +42,18 @@ vgremove -f $vg1 && pvremove -f $d1' +test_expect_success \ + "pvcreate (lvm$mdatype) fails when PV1 does and PV2 does not belong to VG" \ + 'pvcreate -M$mdatype $d1 && + pvcreate -M$mdatype $d2 && + vgcreate -M$mdatype $vg1 $d1 && + echo pvcreate a second time on $d2 and $d1 && + pvcreate -M$mdatype $d2 $d1; + status=$?; echo status=$status; test $status != 0 && + vgremove -f $vg1 && + pvremove -f $d2 && + pvremove -f $d1' + done test_expect_success \ --- LVM2/tools/pvcreate.c 2008/07/25 14:45:24 1.72 +++ LVM2/tools/pvcreate.c 2008/07/25 14:59:51 1.73 @@ -153,13 +153,13 @@ (dev != dev_cache_get(pv_name, cmd->filter))) { log_error("uuid %s already in use on \"%s\"", pp->idp->uuid, dev_name(dev)); - return ECMD_FAILED; + return 0; } } if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) { log_error("Can't get lock for orphan PVs"); - return ECMD_FAILED; + return 0; } if (!pvcreate_check(cmd, pv_name, pp)) @@ -218,11 +218,11 @@ log_print("Physical volume \"%s\" successfully created", pv_name); unlock_vg(cmd, VG_ORPHANS); - return ECMD_PROCESSED; + return 1; error: unlock_vg(cmd, VG_ORPHANS); - return ECMD_FAILED; + return 0; } /* @@ -352,7 +352,7 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv) { - int i, r; + int i; int ret = ECMD_PROCESSED; struct pvcreate_params pp; @@ -361,9 +361,9 @@ } for (i = 0; i < argc; i++) { - r = pvcreate_single(cmd, argv[i], &pp); - if (r > ret) - ret = r; + if (!pvcreate_single(cmd, argv[i], &pp)) + ret = ECMD_FAILED; + if (sigint_caught()) return ret; }
next reply other threads:[~2008-07-25 14:59 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-07-25 14:59 wysochanski [this message] -- strict thread matches above, loose matches on Subject: below -- 2008-07-25 14:37 wysochanski 2008-07-25 0:30 wysochanski
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=20080725145952.3552.qmail@sourceware.org \ --to=wysochanski@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).