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.

Bug 2188718

Summary: 'pvck --dump -f <file>' should give a better error when the file already exists
Product: Red Hat Enterprise Linux 9 Reporter: Corey Marthaler <cmarthal>
Component: lvm2Assignee: LVM Team <lvm-team>
lvm2 sub component: Command-line tools QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: agk, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, teigland, thornber, zkabelac
Version: 9.3Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lvm2-2.03.21-2.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:53:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Marthaler 2023-04-21 20:40:45 UTC
Description of problem:
[root@virt-506 ~]# ls -l /tmp/meta.txt
-rw-------. 1 root root 15189 Apr 21 22:36 /tmp/meta.txt

[root@virt-506 ~]# pvck --dump metadata_search --settings metadata_offset=3870720 -f /tmp/meta.txt /dev/sdb
  Searching for metadata at offset 4096 size 4190208
  Failed to create file /tmp/meta.txt

[root@virt-506 ~]# pvck --dump metadata_search --settings metadata_offset=3870720 -f /tmp/meta2.txt /dev/sdb
  Searching for metadata at offset 4096 size 4190208
  metadata at 3870720 length 15190 crc 6afa48cc vg resize_matrix seqno 281 id VwYvXu-zDWf-M6FO-szLS-Z47u-zQlV-2FrQ2W



Version-Release number of selected component (if applicable):
lvm2-2.03.20-2.el9    BUILT: Thu Apr  6 01:40:29 PM CEST 2023
lvm2-libs-2.03.20-2.el9    BUILT: Thu Apr  6 01:40:29 PM CEST 2023

Comment 1 David Teigland 2023-04-28 18:35:16 UTC
fix in main
https://sourceware.org/git/?p=lvm2.git;a=commit;h=c4440b5b495a2d11ff541dd7e7791e2a83c83609

$ touch foo
$ pvck --dump metadata -f foo /dev/sdb 
  File already exists.
$ echo $?
5

Comment 3 Corey Marthaler 2023-05-30 18:22:12 UTC
Marking Verified:Tested in the latest rpms.

# before fix (lvm2-2.03.17-7.el9)
[root@virt-030 ~]# pvck --dump metadata /dev/sda -f /tmp/pvck_meta.459.1767298
  metadata text at 4608 crc 0xc6449eab # vgname df seqno 1
[root@virt-030 ~]# pvck --dump metadata /dev/sda -f /tmp/pvck_meta.459.1767298
  metadata text at 4608 crc 0xc6449eab # vgname df seqno 1
  Failed to create file /tmp/pvck_meta.459.1767298
[root@virt-030 ~]# echo $?
0


# after fix (lvm2-2.03.21-2.el9)
[root@virt-521 ~]# pvck --dump metadata /dev/sda -f /tmp/pvck_meta.459.1767298
  metadata text at 4608 crc 0x71775faf # vgname df seqno 1
[root@virt-521 ~]# pvck --dump metadata /dev/sda -f /tmp/pvck_meta.459.1767298
  File already exists.
[root@virt-521 ~]# echo $?
5

Comment 9 errata-xmlrpc 2023-11-07 08:53:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6633