Bug 1364994
| Summary: | lvconvert has wrong argument logic deduction | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Roman Bednář <rbednar> |
| Component: | lvm2 | Assignee: | David Teigland <teigland> |
| lvm2 sub component: | Changing Logical Volumes | QA Contact: | cluster-qe <cluster-qe> |
| Status: | CLOSED NOTABUG | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac |
| Version: | 7.3 | ||
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-09-09 15:14:52 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
Roman Bednář
2016-08-08 10:32:16 UTC
wrong package list, here are the ones actually used: 3.10.0-481.el7.x86_64 lvm2-2.02.162-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 lvm2-libs-2.02.162-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 lvm2-cluster-2.02.162-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 device-mapper-1.02.132-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 device-mapper-libs-1.02.132-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 device-mapper-event-1.02.132-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 device-mapper-event-libs-1.02.132-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 device-mapper-persistent-data-0.6.3-1.el7 BUILT: Fri Jul 22 05:29:13 CDT 2016 cmirror-2.02.162-1.el7 BUILT: Fri Jul 29 02:26:36 CDT 2016 I'm confused!
>lvconvert --cachepool vg/lv vg/lv
Surely that command is nonsense? Why is vg/lv listed twice?
The "--cachepool vg/lv" piece means to convert existing LV vg/lv into a cache-pool. Any free args are PVs for the allocation of the extra pieces.
So an error message treating the second vg/lv as a PV doesn't seem unreasonable.
Even if the second LV listed was different LV from the first, I don't see how you could infer anything else for the command to do. It's clear that --cachepool ALWAYS take an LV argument, and if you want to also cache an LV, then that needs one of: --cache LV --type cache LV -H LV So the 3 forms are: lvconvert --cachepool vg/lv --cache lv2 lvconvert -H --cachepool vg/lv lv2 lvconvert --type cache --cachepool vg/lv lv2 with different orderings of the arguments possible as lv2 is a free arg, and only the first listed LV needs a vg/ prefix on it. So this also works: lvconvert -H vg/lv2 --cachepool lv Any remaining free args are PVs for the allocation. (In reply to Alasdair Kergon from comment #4) > Even if the second LV listed was different LV from the first, I don't see > how you could infer anything else for the command to do. > > It's clear that --cachepool ALWAYS take an LV argument, and if you want to > also cache an LV, then that needs one of: > --cache LV > --type cache LV > -H LV > > So the 3 forms are: > lvconvert --cachepool vg/lv --cache lv2 > lvconvert -H --cachepool vg/lv lv2 > lvconvert --type cache --cachepool vg/lv lv2 > with different orderings of the arguments possible as lv2 is a free arg, and > only the first listed LV needs a vg/ prefix on it. > So this also works: > lvconvert -H vg/lv2 --cachepool lv > > Any remaining free args are PVs for the allocation. Clear logic here comes from our arg parsing: lvconvert [OPTIONS] LVNAME [PVLIST] lvconvert takes 'free arg' (vg/lv) as a converted LV name before any PV list. So we have: lvconvert --type cache-pool vg/lv We also have arg --cachepool which consumes arg: lvconvert --cachepool vg/lv When 'freearg' is not given - lvconvert uses already known cachepool parameter. But since pool needs to allocate also space for metadata (as lvconvert is allowed to create new metadata LVs for conversion) and PV list might be supplied by user as allocation space. In this case we need to respect free-arg logic - so next arg must be still LV. And just after this PV list may follow (currently there is a bug). lvconvert --cachepool vg/lv1 vg/lv1 /dev/pv1... 'lv1' -> convert to cachepool. Technically we may 'deduce' cache or cache-pool arg. So even this command: lvconvert --cachepool vg/lv1 vg/lv2 can be still pretty much valid and convert (or just use) vg/lv1 as cachepool and make vg/lv2 a cache. ATM we do require 'lvconvert -H' in this case. It's the same concept we use for convert LV to a thin with external origin: lvconvert -T --thinpool vg/pool vg/lv Then here we may possibly also introduce same implicit -T deduction. |