Bug 680973 - lvm2 pvmove test mode "Command failed with status code 5"
Summary: lvm2 pvmove test mode "Command failed with status code 5"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: lvm2
Version: 5.6
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 5.7
Assignee: Milan Broz
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks: 680976
TreeView+ depends on / blocked
 
Reported: 2011-02-28 16:52 UTC by Debbie Johnson
Modified: 2018-11-14 15:58 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 680976 (view as bug list)
Environment:
Last Closed: 2011-03-07 11:55:48 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Debbie Johnson 2011-02-28 16:52:50 UTC
Description of problem:
When using test mode with the lvm2 command, pvmove (and probably others),
you get an error:

Command failed with status code 5


Version-Release number of selected component (if applicable):
RHEL 5.6



How reproducible:  every time

Example:

root@bbnfs ~]# pvmove -tv /dev/mapper/mpath3p2 /dev/mapper/mpath2p1
Test mode: Metadata will NOT be updated.
Finding volume group "nfsVG"
Test mode: Skipping archiving of volume group.
Creating logical volume pvmove0
Moving 1599 extents of logical volume nfsVG/bbnfs
Found volume group "nfsVG"
Updating volume group metadata
Test mode: Skipping volume group backup.
Found volume group "nfsVG"
Found volume group "nfsVG"
Found volume group "nfsVG"
Test mode: Wiping internal cache
Wiping internal VG cache
Command failed with status code 5. 


Actual results:
Appears the test command failed because of the error

Expected results:
No Command failed message outputed


Additional info:

In looking at the code it appears the problem is at:

        if ((ret != ECMD_PROCESSED) && !error_message_produced()) {
                log_debug(INTERNAL_ERROR "Failed command did not use log_error");
                log_error("Command failed with status code %d.", ret);
        }


We are not testing to see if we are in test mod before printing the message.
This is in lvm2_main() and lvm_shell().  So I believe the if statement should be:

        if ((ret != ECMD_PROCESSED) && !error_message_produced() && !test_mode()) {

to avoid printing the Command failed message.

Comment 1 Alasdair Kergon 2011-02-28 17:07:12 UTC
Rather, it should return success in test mode, not fail.  The error message check is OK there.  I thought pvmove --test used to work once-upon-a-time...

Comment 3 Milan Broz 2011-02-28 20:33:31 UTC
Please always provice exact lvm2 rpm version.

It works for me for release 5.6 - lvm2-2.02.74-5.el5.x86_64

# pvmove -vt /dev/sdc /dev/sdb ; echo $?
  Test mode: Metadata will NOT be updated.
    Finding volume group "vgt"
    Test mode: Skipping archiving of volume group.
    Creating logical volume pvmove0
    Moving 100 extents of logical volume vgt/lv
    Found volume group "vgt"
    activation/volume_list configuration setting not defined, checking only host tags for vgt/lv
    Updating volume group metadata
    Found volume group "vgt"
    Found volume group "vgt"
    Found volume group "vgt"
    Test mode: Skipping volume group backup.
    Test mode: Wiping internal cache
    Wiping internal VG cache
0


Note You need to log in before you can comment on or make changes to this bug.