Bug 1301974

Summary: Add support for selection in all commands where --select vg_uuid=<uuid> is suggested if multiple VGs found with the same name
Product: Red Hat Enterprise Linux 7 Reporter: Peter Rajnoha <prajnoha>
Component: lvm2Assignee: David Teigland <teigland>
lvm2 sub component: Command-line tools QA Contact: cluster-qe <cluster-qe>
Status: CLOSED WONTFIX Docs Contact:
Severity: low    
Priority: medium CC: agk, heinzm, jbrassow, msnitzer, prajnoha, teigland, thornber, zkabelac
Version: 7.0   
Target Milestone: pre-dev-freeze   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:39:50 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 Peter Rajnoha 2016-01-26 13:15:58 UTC
We need to add support for -S|--select for all commands where possible, mainly the ones which suggest --select use if multiple VGs are found with the same name.

For example, lvcreate is one of them:

[root@rhel6-a ~]# vgs -o+vg_uuid -S vg_name=vg
  VG   #PV #LV #SN Attr   VSize VFree VG UUID                               
  vg     1   1   0 wz--n- 4.00g 3.99g eHZp2F-7Qdk-p6br-Z8cI-iEwi-LWIl-ScaCr4
  vg     1   1   0 wz--n- 4.00g 3.99g GhDzAe-LAav-yhCu-WF4e-G1zn-FtrQ-yh15OP

[root@rhel6-a ~]# lvcreate -l1 vg
  Multiple VGs found with the same name: skipping vg
  Use the VG UUID with --select vg_uuid=<uuid>

[root@rhel6-a ~]# lvcreate -l1 -S vg_uuid=eHZp2F-7Qdk-p6br-Z8cI-iEwi-LWIl-ScaCr4
lvcreate: invalid option -- 'S'
  Error during parsing of command line.

However, in such cases, we need to make sure that the --select returns only one item that should be processed (one VG for the lvcreate example above). If the result of selection is a set which contains more items, we need to error out and suggest users to refine their selection so there's only one item coming as a result of the selection.

We should either fix this for 6.8 or we need to remove the "Use the VG UUID with --select vg_uuid=<uuid>" message for commands where --select is not yet supported.

Comment 1 David Teigland 2016-01-26 15:37:00 UTC
I was aware of the error message being inaccurate in a couple of cases like lvcreate, but I thought it was obscure enough to ignore.  To change this we simply need to check what the command is before printing the "use -S" suggestion (by looking at the command name or using a cmd flag to control the printing of this message.)

As for adding -S support to commands like lvcreate (that take a single VG)... as you point out, we need to ensure it selects only one VG.  That obviously reduces the usefulness and motivation for it.  It also includes some messy work in changing the arg processing to allow a missing VG arg (which can also sometimes be embedded into an LV name arg.)

Comment 5 RHEL Program Management 2020-12-15 07:39:50 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.