Bug 1301974 - Add support for selection in all commands where --select vg_uuid=<uuid> is suggested if multiple VGs found with the same name
Add support for selection in all commands where --select vg_uuid=<uuid> is su...
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2 (Show other bugs)
All Linux
medium Severity low
: pre-dev-freeze
: ---
Assigned To: LVM and device-mapper development team
Depends On:
  Show dependency treegraph
Reported: 2016-01-26 08:15 EST by Peter Rajnoha
Modified: 2018-01-01 20:15 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Rajnoha 2016-01-26 08:15:58 EST
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 10:37:00 EST
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.)

Note You need to log in before you can comment on or make changes to this bug.