Bug 2095040
| Summary: | 'lvmconfig --typeconfig current' should show what LVM/kernel is operating with currently | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Corey Marthaler <cmarthal> |
| Component: | lvm2 | Assignee: | Peter Rajnoha <prajnoha> |
| lvm2 sub component: | Configuration files | QA Contact: | cluster-qe <cluster-qe> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | medium | ||
| Priority: | unspecified | CC: | agk, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, zkabelac |
| Version: | 9.1 | Keywords: | Triaged |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | lvm2-2.03.17-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-09 08:23:40 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
2022-06-08 20:22:50 UTC
Would it also be able to just return the value asked for, so there's nothing to parse? # lvmconfig --typeconfig default activation/raid_fault_policy warn (In reply to Corey Marthaler from comment #0) > Description of problem: > While rewriting some of our older tools' lvm.conf searches, I found there's > really not an easy way to get the current lvm.conf value from the new tool > lvmconfig. I have to first see if the value was user set (may or may not be > non default), and if not, then check the default value. This is because > 'lvmconfig --typeconfig current' will only show values that were set by the > user. > > > # Here I manually set raid_fault_policy to "allocate" > [root@hayes-03 ~]# lvmconfig --typeconfig default > activation/raid_fault_policy > # raid_fault_policy="warn" > [root@hayes-03 ~]# lvmconfig --typeconfig current > activation/raid_fault_policy > raid_fault_policy="allocate" > > > # Here I haven't touched raid_region_size: > [root@hayes-03 ~]# lvmconfig --typeconfig default activation/raid_region_size > # raid_region_size=2048 > [root@hayes-03 ~]# lvmconfig --typeconfig current activation/raid_region_size > Configuration node activation/raid_region_size not found > Yes, '--typeconfig current' prints only the ones which are explicitly set in the config. If the setting is commented out/not set at all, it's not printed ("not found"). I think you're looking for "--typeconfig full" that should print the config as it is really used by LVM, either it is taking the explicitly set value or default value (including the scenario where the value is commented out/not set at all). So 'full' always tries to give a value for the setting if possible - the only exception are settings which simply do not have any default values defined at all (they're "NULL") - there are some of those too, see "lvmconfig --type full --withcomments" and look for the ones with "This configuration option does not have a default value defined." comment. > > Also, using no --typeconfig flag should imo default to "current" (maybe it > already does)? > [root@hayes-03 ~]# lvmconfig activation/raid_fault_policy > raid_fault_policy="allocate" > [root@hayes-03 ~]# lvmconfig activation/raid_region_size > Configuration node activation/raid_region_size not found > Yup, default for "--typeconfig" is "current". (In reply to Corey Marthaler from comment #1) > Would it also be able to just return the value asked for, so there's nothing > to parse? > > # lvmconfig --typeconfig default activation/raid_fault_policy > warn Hmm, yes, I guess we could add that easily. Though it would be another option added to the plethora of options we already have for lvmconfig :) I've added a new --valuesonly option to lvmconfig: https://sourceware.org/git/?p=lvm2.git;a=commit;h=b4cc28c2ef72ee022c1a03819927e31775c18676 For example: # lvmconfig --type full activation/raid_fault_policy raid_fault_policy="warn" # lvmconfig --type full activation/raid_fault_policy --valuesonly "warn" # my_var=$(lvmconfig --type full activation/raid_fault_policy --valuesonly) # echo $my_var "warn" To be clear for verification, the "current" mode remains the same as in the original comment #0. To see the actual current variable, the user needs to use the "full" option. The "valuesonly" flag is also available now in the latest build. kernel-5.14.0-176.el9 BUILT: Wed Oct 12 03:57:18 AM CDT 2022 lvm2-2.03.17-1.el9 BUILT: Thu Nov 10 10:02:16 AM CST 2022 lvm2-libs-2.03.17-1.el9 BUILT: Thu Nov 10 10:02:16 AM CST 2022 [root@hayes-03 ~]# lvmconfig --typeconfig current activation/mirror_image_fault_policy Configuration node activation/mirror_image_fault_policy not found [root@hayes-03 ~]# lvmconfig --typeconfig full activation/mirror_image_fault_policy mirror_image_fault_policy="remove" [root@hayes-03 ~]# lvmconfig --typeconfig full --valuesonly activation/mirror_image_fault_policy "remove" [root@hayes-03 ~]# grep mirror_image_fault_policy /etc/lvm/lvm.conf # Configuration option activation/mirror_image_fault_policy. # mirror_image_fault_policy = "remove" mirror_image_fault_policy = allocate # edited by QA Fri Nov 18 14:00:12 2022 [root@hayes-03 ~]# lvmconfig --typeconfig full activation/mirror_image_fault_policy mirror_image_fault_policy="allocate" [root@hayes-03 ~]# lvmconfig --typeconfig full --valuesonly activation/mirror_image_fault_policy "allocate" Marking VERIFIED in the latest rpms as well. kernel-5.14.0-212.el9 BUILT: Tue Dec 13 03:37:26 PM CST 2022 lvm2-2.03.17-3.el9 BUILT: Wed Dec 7 10:41:40 AM CST 2022 lvm2-libs-2.03.17-3.el9 BUILT: Wed Dec 7 10:41:40 AM CST 2022 [root@hayes-03 ~]# lvmconfig --typeconfig full activation/mirror_image_fault_policy mirror_image_fault_policy="remove" [root@hayes-03 ~]# lvmconfig --typeconfig full --valuesonly activation/mirror_image_fault_policy "remove" 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:2544 |