Hide Forgot
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.
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...
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