Skip to content

Commit

Permalink
scenarios: added a scenario for detecting NFS name resolution failures (
Browse files Browse the repository at this point in the history
#876)

Fixes #716

Signed-off-by: Mustafa Kemal Gilor <[email protected]>
  • Loading branch information
xmkg authored May 17, 2024
1 parent d3c6d0e commit f83347b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hotsos/core/issues/issue_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class NetworkWarning(IssueTypeBase):
pass


class NFSNameResolutionError(IssueTypeBase):
pass


class RabbitMQWarning(IssueTypeBase):
pass

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
checks:
has_nfs_name_resolution_failures:
input:
path: ['var/log/syslog', 'var/log/boot.log']
expr: '.*mount.nfs.*Failed to resolve server (.*): (Name or service not known|Temporary failure in name resolution).*'
conclusions:
nfs_name_resolution_failures:
decision: has_nfs_name_resolution_failures
raises:
type: NFSNameResolutionError
message: >-
Name resolution failures have been detected for the following NFS mounts:
{names}
format-dict:
names: '@checks.has_nfs_name_resolution_failures.search.results_group_1:unique_comma_join'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
target-name: nfs-detect-mount-name-resolution-failure.yaml
data-root:
files:
var/log/syslog: |
Aug 23 07:27:31 juju-0c7157-trilio-test-16 mount[809]: mount.nfs: Failed to resolve server my.great.nfsserver.org: Name or service not known
Oct 9 11:28:22 mail mount[714]: mount.nfs4: Failed to resolve server my.another.great.nfs.org: Temporary failure in name resolution
copy-from-original:
- sos_commands/date/date
raised-issues:
NFSNameResolutionError: >-
Name resolution failures have been detected for the following NFS mounts:
my.another.great.nfs.org, my.great.nfsserver.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
target-name: nfs-detect-mount-name-resolution-failure.yaml
data-root:
files:
var/log/boot.log: |
mount.nfs: Failed to resolve server filesrv23: Temporary failure in name resolution
mountall: mount /epgbatch_data [623] terminated with status 32
mount.nfs: Failed to resolve server filesrv24: Temporary failure in name resolution
mountall: mount /epgbatch_data [632] terminated with status 32
copy-from-original:
- sos_commands/date/date
raised-issues:
NFSNameResolutionError: >-
Name resolution failures have been detected for the following NFS mounts:
filesrv23, filesrv24
22 changes: 22 additions & 0 deletions tests/unit/storage/test_nfs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from hotsos.core.config import HotSOSConfig

from .. import utils


class StorageNFSTestsBase(utils.BaseTestCase):

def setUp(self):
super().setUp()
HotSOSConfig.plugin_name = 'storage'


@utils.load_templated_tests('scenarios/storage/nfs')
class TestNFSScenarios(StorageNFSTestsBase):
"""
Scenario tests can be written using YAML templates that are auto-loaded
into this test runner. This is the recommended way to write tests for
scenarios. It is however still possible to write the tests in Python if
required. See https://hotsos.readthedocs.io/en/latest/contrib/testing.html
for more information.
"""

0 comments on commit f83347b

Please sign in to comment.