Bug 2216286

Summary: lvcreate no longer recognizes --snapshot
Product: Red Hat Enterprise Linux 9 Reporter: Demi Marie Obenour <demiobenour>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Snapshots QA Contact: cluster-qe <cluster-qe>
Status: POST --- Docs Contact:
Severity: high    
Priority: high CC: agk, heinzm, jbrassow, msnitzer, prajnoha, teigland, zkabelac
Version: 9.2Keywords: Triaged
Target Milestone: rc   
Target Release: 9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Demi Marie Obenour 2023-06-20 18:18:57 UTC
Description of problem:
`lvcreate` stopped accepting `--snapshot` when creating a thin snapshot, breaking scripts..

Version-Release number of selected component (if applicable):
`lvm2-2.03.18-2.fc38.x86_64`

How reproducible:
100%

Steps to Reproduce:
1. Run the command `lvcreate --setactivationskip=n --activate=y --snapshot --type=thin --name=SOMEVG/SOMENEWLV -- SOMEOLDLV` (replace SOMENEWLV, SOMEOLDLV, and SOMEVG with the correct values).


Actual results:
The command fails:

> Command does not accept option: --snapshot

Expected results:
Command succeeds

Additional info:
This contradicts the man page, which states that the above is the correct syntax for creating a thin snapshot of an existing thin LV.

Comment 1 David Teigland 2023-06-20 18:45:07 UTC
It looks like it was probably caused by this change:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=d651b340e68d97ada25e558eb50aa40062bba936

Comment 2 David Teigland 2023-06-20 20:50:40 UTC
fix in main:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=ea6b5b694bf0886052b048b2e04b941ec65d90f9

commit d651b340e68d97ada25e558eb50aa40062bba936 removed the optional "--type thin" from the command definition "lvcreate --snapshot LV_thin", and added --type thin as AUTOTYPE.  This was correct and should not have changed anything, if all the command defs were correct.  However, the failing command in the description was relying on it.  It reveals a problem in a different command definintion:  "lvcreate --type thin LV_thin" that was missing --snapshot in its OO list.


$ lvs aa
  LV    VG Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  thin1 aa Vwi-a-tz--   1.00g tp          0.00                                   
  tp    aa twi-aotz-- 512.00m             0.00   10.94       

Create snapshots of thin1 using different syntaxes (six different commands that do the same thing):

$ lvcreate --type thin aa/thin1
  Logical volume "lvol2" created.
$ lvcreate --thin aa/thin1
  Logical volume "lvol3" created.
$ lvcreate --snapshot aa/thin1
  Logical volume "lvol4" created.
$ lvcreate --type thin --snapshot aa/thin1
  Logical volume "lvol5" created.
$ lvcreate --type thin --thin aa/thin1
  Logical volume "lvol6" created.
$ lvcreate --type thin --thin --snapshot aa/thin1
  Logical volume "lvol7" created.

$ lvs aa
  LV    VG Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lvol2 aa Vwi---tz-k   1.00g tp   thin1                                         
  lvol3 aa Vwi---tz-k   1.00g tp   thin1                                         
  lvol4 aa Vwi---tz-k   1.00g tp   thin1                                         
  lvol5 aa Vwi---tz-k   1.00g tp   thin1                                         
  lvol6 aa Vwi---tz-k   1.00g tp   thin1                                         
  lvol7 aa Vwi---tz-k   1.00g tp   thin1                                         
  thin1 aa Vwi-a-tz--   1.00g tp          0.00                                   
  tp    aa twi-aotz-- 512.00m             0.00   10.94                           


Given the combinations above, the following syntax should also work.  It's allowed by the command definintions, but rejected by the internal lvcreate option checking.  It's uncertain why, but perhaps the lvcreate implementation won't do the right thing (it should probably be allowed.)

$ lvcreate --thin --snapshot aa/thin1
  Option --thin is unsupported with snapshots.
  Run `lvcreate --help' for more information.