Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Providing an existing target name to tgt-setup-lun when attempting to add a new LUN based on a nonexistant device correctly resulted in failure because a target with the same name already existed. If the user then followed the utility's suggestion to add the new LUN to the existing target, the operation failed (again, correctly) because the device did not exist. However, the rollback action associated with this second failure resulted in the target being removed. The rollback action now checks whether the target pre-existed the failed actions, so the target is not removed in this circumstance.
Description of problem:
If you try to add a new LUN based on non existing device and provide the target name that already exists, the operation will fail since the target with the same name already exists. Then the utility will suggest to the user to add new LUN to this existing target and if the user will select to proceed it will fail since the device does not exist and as the result, the rollback action will remove the target itself.
Version-Release number of selected component (if applicable):
scsi-target-utils-1.0.4-3.el6.x86_64
How reproducible:
Always
Steps to Reproduce (/dev/vg_autofiler01/max_lv02 doesn't exist):
1. lvcreate -L 10G -n /dev/vg_autofiler01/max_lv01
2. tgt-setup-lun -n target1 -d /dev/vg_autofiler01/max_lv01 -t iscsi
3. tgt-setup-lun -n target1 -d /dev/vg_autofiler01/max_lv02 -t iscsi
Actual results:
Using transport: iscsi
Error: target named iqn.2001-04.com.auto-filer01-target1 already exists
Add a new lun to the existing target? (yes/NO): yes
Adding a logical unit (/dev/vg_autofiler01/max_lv02) to target, tid=1
tgtadm: invalid request
Error: failed to add a logical unit (/dev/vg_autofiler01/max_lv02) to target, tid=1
Deleting new target, tid=1
The target with id 1 was removed from the targets.conf file.
Expected results:
The rollback action should consider the presence of existing target and should NOT remove it.
Additional info:
[root@auto-filer01 tgt]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@auto-filer01 tgt]# rpm -qa | grep kernel
dracut-kernel-004-33.2.el6_0.noarch
abrt-addon-kerneloops-1.1.13-4.el6.x86_64
kernel-firmware-2.6.32-71.14.1.el6.noarch
kernel-2.6.32-71.14.1.el6.x86_64
kernel-2.6.32-71.el6.x86_64
[root@auto-filer01 tgt]# rpm -qa | grep lvm
lvm2-2.02.72-8.el6_0.4.x86_64
lvm2-libs-2.02.72-8.el6_0.4.x86_64
[root@auto-filer01 tgt]# less /var/log/messages
Jan 31 17:43:09 auto-filer01 tgtd: backed_file_open(92) Could not open /dev/vg_autofiler01/max_lv02, No such file or directory
IMHO, there are few fixes:
1. Add new function that validates if a target is empty
2. Fix err_exit() function to use the function from 1 above before remove any target
3. Remove the validation if target already exists during 'add new LUN' sequence
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Providing an existing target name to tgt-setup-lun when attempting to add a new LUN based on a nonexistant device correctly resulted in failure because a target with the same name already existed. If the user then followed the utility's suggestion to add the new LUN to the existing target, the operation failed (again, correctly) because the device did not exist. However, the rollback action associated with this second failure resulted in the target being removed. The rollback action now checks whether the target pre-existed the failed actions, so the target is not removed in this circumstance.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHBA-2011-0734.html