Skip to content

Commit f2f3f71

Browse files
authored
Enhance NFS mount option check for empty response
``` ERROR: test suite for <class 'tests.component.maint.test_primary_storage_nfsmountopts_kvm.TestNFSMountOptsKVM'> ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/nose/suite.py", line 210, in run self.setUp() File "/usr/local/lib/python3.9/site-packages/nose/suite.py", line 293, in setUp self.setupContext(ancestor) File "/usr/local/lib/python3.9/site-packages/nose/suite.py", line 316, in setupContext try_run(context, names) File "/usr/local/lib/python3.9/site-packages/nose/util.py", line 471, in try_run return func() File "/marvin/tests/component/maint/test_primary_storage_nfsmountopts_kvm.py", line 46, in setUpClass cls.version = cls.getNFSMountOptionForPool(cls, "vers", cls.storage_pool.id) File "/marvin/tests/component/maint/test_primary_storage_nfsmountopts_kvm.py", line 115, in getNFSMountOptionForPool stat = nfsstat[0] IndexError: list index out of range ``` because ``` shClient: DEBUG: {Cmd: nfsstat -m | sed -n '/e08df33d-d187-3c1c-88f4-10c69669f41a/{ n; p }' via Host: 10.0.32.210} {returns: []} ```
1 parent 046014b commit f2f3f71

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/integration/component/maint/test_primary_storage_nfsmountopts_kvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def getUnusedNFSVersions(self, filter):
110110
def getNFSMountOptionForPool(self, option, poolId):
111111
nfsstat_cmd = "nfsstat -m | sed -n '/%s/{ n; p }'" % poolId
112112
nfsstat = self.sshClient.execute(nfsstat_cmd)
113-
if (nfsstat == None):
113+
if nfsstat == None or len(nfsstat) == 0:
114114
return None
115115
stat = nfsstat[0]
116116
vers = stat[stat.find(option):].split("=")[1].split(",")[0]

0 commit comments

Comments
 (0)