RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2086889 - The resource-agent "lvmlockd" returns success in setup_lvm_config(), even if use_lvmlockd was not changed to 1.
Summary: The resource-agent "lvmlockd" returns success in setup_lvm_config(), even i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: resource-agents
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.7
Assignee: Oyvind Albrigtsen
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 2094828
TreeView+ depends on / blocked
 
Reported: 2022-05-16 18:26 UTC by Shane Bradley
Modified: 2022-12-01 08:24 UTC (History)
10 users (show)

Fixed In Version: resource-agents-4.9.0-20.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2094828 (view as bug list)
Environment:
Last Closed: 2022-11-08 09:09:06 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-122277 0 None None None 2022-05-16 18:39:09 UTC
Red Hat Knowledge Base (Solution) 6958415 0 None None None 2022-05-16 18:26:56 UTC
Red Hat Product Errata RHBA-2022:7443 0 None None None 2022-11-08 09:09:47 UTC

Internal Links: 1645267

Description Shane Bradley 2022-05-16 18:26:56 UTC
Description of problem:
The resource-agent  "lvmlockd"  returns success in setup_lvm_config(), even if use_lvmlockd was not changed to 1.

If "global/use_lvmlockd" is commented out or does not exist, then function setup_lvm_config() will still returns a success return code which implies that /etc/lvm/lvm.conf is properly configured. That function returns success no matter what occurs.

The main issue is that if the option "use_lvmlockd" is comment out or does not exist then when we use lvmconfig to check the current value then "cut" the output it will return an empty string and we never run sed commands to change the value from 0 to 1.

We need to do 2 things for when the "use_lvmlockd" is comment out:
  • Add another if check if there exists a line that is comment out: "# use_lvmlockd =" . Does not matter value as it is commented out, so would be default which is disabled. 
  • If so, need similar sed command that will change a commented out line to not use comments and enable use_lvmlockd. 

In addition:
  • If use_lvmlockd does not exist, then return error and log message saying that user needs to manually enable "use_lvmlockd".
  • Add a check that "use_lvmlockd" is enabled before function returns. If not enable, return success if enabled, otherwise return a failure. For example, log an error if "use_lvmlockd" does not equal 1 and not commented out after it was suppose to be enabled but was not. The details of error should inform the user to manually enable "use_lvmlockd". 
  

   
With that said, the above approach does not fix the case where the option does not exist and also assumes that if "sed" does find "use_lvmlockd" that "use_lvmlockd" is in the global section of /etc/lvm/lvm.conf. Ideally, we should request an RFE for "lvmconfig" to create some new options to enable/disable use_lvmlockd. 

----

Our current documentation states that user has to manually enable the option "use_lvmlockd" before creating the lvmlockd resource. I believe a better approach if possible is to have that step automated by the resource-agent lvmlockd. 

  - Chapter 7\. GFS2 file systems in a cluster Red Hat Enterprise Linux 8 | 7.1. Configuring a GFS2 file system in a cluster (Step 3)
    https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_high_availability_clusters/assembly_configuring-gfs2-in-a-cluster-configuring-and-managing-high-availability-clusters)

Version-Release number of selected component (if applicable):
# rpm -qa | grep -ie resource-agents -ie lvm2 | sort
lvm2-2.03.14-3.el8.x86_64
lvm2-libs-2.03.14-3.el8.x86_64
lvm2-lockd-2.03.14-3.el8.x86_64
resource-agents-4.9.0-16.el8.x86_64

How reproducible:
Everytime

Steps to Reproduce:
1. Comment out "use_lvmlockd" in the /etc/lvm/lvm.conf
2. Create a lvmlockd resource


Actual results:
The option use_lvmlockd option is still commented out. This means that use_lvmlockd=0 (disabled).

Expected results:
The option use_lvmlockd option should return an error in setup_lvm_config() if the option "use_lvmlockd" in /etc/lvm/lvm.conf was not enabled.

Additional info:

Do note that "locking_type" option is not used (or possibly does not exist) on RHEL 8, so validating it is the correct value is not important, but we still might want to consider someway of validating "locking_type" in upstream like we do with "use_lvmlockd" proposed above for those clusters that do not support lvmlockd as an option. 

------

On a related issue, we should see if there is away to automate enabling/disabling "use_lvmlockd" via lvmconfig with an option like: # lvmconfig [--enable,--disable]_lvmlockd.

Currently we are using "sed" to enable "use_lvmlockd" if it is disable. The "sed" approach would not work if the option "use_lvmlockd" does not exist.

I think the best approach would be to open another bug for "lvm2" that will do the following:
  • Add option for lvmconfig to enable "use_lvmlockd":  lvmconfig --enable_lvmlockd.
  • Add option for lvmconfig to disable "use_lvmlockd": lvmconfig --disable_lvmlockd
  * Add ability somehow (unless already exists) for lvmconfig to be able to determine the value of "global/use_lvmlockd" when option is enabled, disable, comment out, or does not exist (the later two is ones I could not find a way to do).

Comment 3 Reid Wahl 2022-05-16 19:35:10 UTC
> I think the best approach would be to open another bug for "lvm2" that will do the following:
>   • Add option for lvmconfig to enable "use_lvmlockd":  lvmconfig --enable_lvmlockd.

AFAIK lvmconfig is a read-only command. In RHEL 7, there was a command called lvmconf whose job was to modify the lvm.conf file. For some reason this was removed in RHEL 8.


>   * Add ability somehow (unless already exists) for lvmconfig to be able to determine the value of "global/use_lvmlockd" when option is enabled, disable, comment out, or does not exist (the later two is ones I could not find a way to do).

If I understand you correctly, we basically have this ability: if the `lvmconfig` output doesn't contain `use_lvmlockd`, then that means it's set to the default value. We don't know if it's commented out or just doesn't exist. It may not be worth the effort (and possibly resulting brittleness) of adding an "is it commented out" check; we can just add a new line if it's either commented or missing.

Comment 4 Reid Wahl 2022-05-16 19:44:01 UTC
The simplest approach IMO would be:
  - Update the value in-place if it's there or if it passes a SIMPLE commented-out check (e.g., a regex like /[[:blank:]]*#[[:blank:]]*use_lvmlockd[[:blank:]]*=/). If it's commented out, then either remove the '#' character or put the new line directly underneath.
  - If we can't find the value, add a new `use_lvmlockd = 1` line directly under the `global {` line. Or if that's too much of a pain, just add a second `global {}` section at the bottom of /etc/lvm/lvm.conf:

```
global {
    use_lvmlockd = 1
}
```

Comment 6 David Teigland 2022-05-16 19:58:25 UTC
(In reply to Shane Bradley from comment #1)
>   "This worked in previous versions, because the /etc/lvm/lvm.conf file had
> an uncommented value for use_lvmlockd set to the default value of 0
>    However, that looks to have been changed in this commit last year:
> https://github.com/lvmteam/lvm2/commit/
> ca38251b1043c49f5453c2c571876b12aad6b450
>    where all values that were set to the default were commented out"

That change should only have gone into 9.0 IMO.  I'd guess there will be more issues like this.

> The issue the customer states they are hitting is that on RHEL 8.5 or later
> that when the /etc/lvm/lvm.conf 
> is created, it no longer contains the uncommented option using default value:
>   use_lvmlockd = 0
> 
> Instead on RHEL 8.5 or later, the created /etc/lvm/lvm.conf will comment out
> any options that are using
> default values (at least they are saying it does for use_lvmlockd).
>   # use_lvmlockd = 0


Fixing setup_lvm_config like in comment 4 (to not assume specific lvm.conf contents) seems like the right solution.

Letting lvmconfig edit lvm.conf has been an obvious missing feature for many years, but nobody has taken it up.

Comment 8 Oyvind Albrigtsen 2022-06-07 14:38:30 UTC
https://github.com/ClusterLabs/resource-agents/pull/1777

Comment 14 errata-xmlrpc 2022-11-08 09:09:06 UTC
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 (resource-agents 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-2022:7443

Comment 15 heming.zhao 2022-11-30 09:16:59 UTC
Hello all, sorry for waking up this bug.

I prefer the solution in comment 4 & 6.
But comment 8 (lvmlockd RA commit: b3885f7d95fe3) method directly returns error when cmd "$(lvmconfig 'global/use_lvmlockd' 2> /dev/null)" return empty.
under this change, RA can't change commented-out use_lvmlockd automatically. It makes very bad customer experience.

Do we have any plan to create a new patch for comment 4 idea?

Comment 16 Oyvind Albrigtsen 2022-11-30 11:28:44 UTC
(In reply to heming.zhao from comment #15)
> Hello all, sorry for waking up this bug.
> 
> I prefer the solution in comment 4 & 6.
> But comment 8 (lvmlockd RA commit: b3885f7d95fe3) method directly returns
> error when cmd "$(lvmconfig 'global/use_lvmlockd' 2> /dev/null)" return
> empty.
> under this change, RA can't change commented-out use_lvmlockd automatically.
> It makes very bad customer experience.
> 
> Do we have any plan to create a new patch for comment 4 idea?

I've made a patch, and will push it when CI maintenance is done (should be sometime tomorrow or friday).

Comment 17 heming.zhao 2022-11-30 11:45:48 UTC
very good news, thank you.

Comment 18 Oyvind Albrigtsen 2022-12-01 08:24:42 UTC
https://github.com/ClusterLabs/resource-agents/pull/1824


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