Bug 2179859

Summary: [augtool] Unable to set multipath.conf/blacklist/wwid
Product: Red Hat Enterprise Linux 8 Reporter: Martin Hoyer <mhoyer>
Component: augeasAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED MIGRATED QA Contact: YongkuiGuo <yoguo>
Severity: low Docs Contact:
Priority: low    
Version: 8.8CC: jmaloy, kkiwi, qzhang, ymao, yoguo
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-07 21:20:10 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 Martin Hoyer 2023-03-20 10:01:07 UTC
Description of problem:
augtool does not seem to function properly when modifying multipath.conf

# augtool -s set "/files/etc/multipath.conf/blacklist/wwid" ".*"
error: Failed to execute command
saving failed (run 'errors' for details)

# augtool errors
Error in /etc/multipath.conf:14.0 (parse_failed)
  Iterated lens matched less than it should
  Lens: /usr/share/augeas/lenses/dist/multipath.aug:133.10-.64:
    Last matched: /usr/share/augeas/lenses/dist/multipath.aug:24.24-.42:
    Next (no match): /usr/share/augeas/lenses/dist/multipath.aug:16.10-.37:

Version-Release number of selected component (if applicable):
augeas-1.12.0-8.el8.x86_64
augeas-libs-1.12.0-8.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. install augeas device-mapper-multipath packages
2. mpathconf --enable
3. augtool -s set "/files/etc/multipath.conf/blacklist/wwid" ".*"

Actual results:
error

Expected results:
As seen on el9:
augeas-libs-1.13.0-3.el9.x86_64
augeas-1.13.0-3.el9.x86_64

# augtool -s set "/files/etc/multipath.conf/blacklist/wwid" ".*"
Saved 1 file(s)

# cat /etc/multipath.conf 
# device-mapper-multipath configuration file

# For a complete list of the default configuration values, run either:
# # multipath -t
# or
# # multipathd show config

# For a list of configuration options with descriptions, see the
# multipath.conf man page.

defaults {
	user_friendly_names yes
	find_multipaths yes
}

blacklist {
wwid .*
}

Comment 1 YongkuiGuo 2023-03-21 03:32:39 UTC
Can reproduce this issue on RHEL8.8 with the following steps:

Steps:

1. 
# yum install device-mapper-multipath
2.
# mpathconf --enable
3.
# augtool -s set "/files/etc/multipath.conf/blacklist/wwid" ".*"
error: Failed to execute command
saving failed (run 'errors' for details)

4.
# augtool print /augeas//error | grep multipath.conf
/augeas/files/etc/multipath.conf/error = "parse_failed"
/augeas/files/etc/multipath.conf/error/pos = "317"
/augeas/files/etc/multipath.conf/error/line = "14"
/augeas/files/etc/multipath.conf/error/char = "0"
/augeas/files/etc/multipath.conf/error/lens = "/usr/share/augeas/lenses/dist/multipath.aug:133.10-.64:"
/augeas/files/etc/multipath.conf/error/lens/last_matched = "/usr/share/augeas/lenses/dist/multipath.aug:24.24-.42:"
/augeas/files/etc/multipath.conf/error/lens/next_not_matched = "/usr/share/augeas/lenses/dist/multipath.aug:16.10-.37:"
/augeas/files/etc/multipath.conf/error/message = "Iterated lens matched less than it should"

5.
# cat /etc/multipath.conf
# device-mapper-multipath configuration file

# For a complete list of the default configuration values, run either:
# # multipath -t
# or
# # multipathd show config

# For a list of configuration options with descriptions, see the
# multipath.conf man page.

defaults {
	user_friendly_names yes
	find_multipaths yes
	enable_foreign "^$"
}

blacklist_exceptions {
        property "(SCSI_IDENT_|ID_WWN)"
}

blacklist {
}


In fact, augeas cannot parse 'enable_foreign "^$"' this line in /etc/multipath.conf file. This line doesn't exist in /etc/multipath.conf on RHEL9.

Comment 2 Klaus Heinrich Kiwi 2023-03-24 12:27:33 UTC
(In reply to Martin Hoyer from comment #0)
> Description of problem:
> augtool does not seem to function properly when modifying multipath.conf
> 

For triaging / prioritization purposes, can you state if this is impacting anything on top of it (i.e., any script / program / routine that is trying to perform this change and failing)?

Thanks

Comment 3 Martin Hoyer 2023-03-24 14:43:21 UTC
I don't know any other example then our kernel/storage python tests, which enable multipath this way. In past we were using custom multipathd.conf file, but switch to running `mpathconf --enable` recently. The workaround (deleting 'enable_foreign "^$"' line) is simple enough so there is no real impact here.
Looking at the multipath-aug source it looks like the last commit was in 2018 to fix and issue reported also by me :) https://github.com/hercules-team/augeas/issues/583 i.e. I wouldn't say this needs to have any priority.

Comment 4 Martin Hoyer 2023-03-24 14:55:03 UTC
fyi, opened an issue upstream: https://github.com/hercules-team/augeas/issues/808