salt icon indicating copy to clipboard operation
salt copied to clipboard

glusterfs.status error on 2015.8.8.2

Open gmykhailiuta opened this issue 10 years ago • 2 comments

Description of Issue/Question

glusterfs.status fails with glusterfs 3.7.11 and fails dependent states.

root@salt:/# salt-call glusterfs.status salt_shared_dev
[INFO    ] Determining pillar cache
[INFO    ] Executing command 'gluster --version' in directory '/home/gennadiy'
[INFO    ] Executing command 'gluster --xml --mode=script' in directory '/home/gennadiy'
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: '8813deec-d672-4d2d-a1dd-3ff63059fabc'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 335, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 53, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 133, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 196, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/glusterfs.py", line 337, in status
    true_hostname = hostref[peerid]
KeyError: '8813deec-d672-4d2d-a1dd-3ff63059fabc'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 335, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 53, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 133, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 196, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/glusterfs.py", line 337, in status
    true_hostname = hostref[peerid]
KeyError: '8813deec-d672-4d2d-a1dd-3ff63059fabc'

and hostref will contain:

{'b784e597-97fb-44bb-9450-87c33d6dae3e': 'salt01.example.com'}

gluster output which is being parsed:

gluster --xml  --mode=script volume status salt_shared_dev
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
  <opRet>0</opRet>
  <opErrno>0</opErrno>
  <opErrstr/>
  <volStatus>
    <volumes>
      <volume>
        <volName>salt_shared_dev</volName>
        <nodeCount>3</nodeCount>
        <node>
          <hostname>salt01.example.com</hostname>
          <path>/salt_shared</path>
          <peerid>b784e597-97fb-44bb-9450-87c33d6dae3e</peerid>
          <status>1</status>
          <port>49152</port>
          <ports>
            <tcp>49152</tcp>
            <rdma>N/A</rdma>
          </ports>
          <pid>6535</pid>
        </node>
        <node>
          <hostname>NFS Server</hostname>
          <path>localhost</path>
          <peerid>b784e597-97fb-44bb-9450-87c33d6dae3e</peerid>
          <status>1</status>
          <port>2049</port>
          <ports>
            <tcp>2049</tcp>
            <rdma>N/A</rdma>
          </ports>
          <pid>6556</pid>
        </node>
        <node>
          <hostname>NFS Server</hostname>
          <path>salt02.example.com</path>
          <peerid>8813deec-d672-4d2d-a1dd-3ff63059fabc</peerid>
          <status>1</status>
          <port>2049</port>
          <ports>
            <tcp>2049</tcp>
            <rdma>N/A</rdma>
          </ports>
          <pid>20163</pid>
        </node>
        <tasks/>
      </volume>
    </volumes>
  </volStatus>
</cliOutput>

Setup

2 nodes, both with salt-master, salt-minion and glusterfs 3.7.11. Create and start shared volume.

Steps to Reproduce Issue

salt-call glusterfs.status salt_shared_dev

Workaround

diff --git a/salt/modules/glusterfs.py b/salt/modules/glusterfs.py
index 6f29389..0cabe7c 100644
--- a/salt/modules/glusterfs.py
+++ b/salt/modules/glusterfs.py
@@ -334,7 +334,10 @@ def status(name):
                 '{0}:{1}'.format(hostname, path)] = etree_legacy_wrap(node)
         elif hostname == 'NFS Server':
             peerid = node.find('peerid').text
-            true_hostname = hostref[peerid]
+            if peerid in hostref:
+                true_hostname = hostref[peerid]
+            else:
+                true_hostname = node.find('path').text
             ret['nfs'][true_hostname] = etree_legacy_wrap(node)
         else:
             peerid = node.find('peerid').text

Versions Report

Master and minion are the same host running same salt version.

Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-77-generic
         system: Ubuntu 14.04 trusty

gmykhailiuta avatar Apr 20 '16 13:04 gmykhailiuta

Issue was caused by glusterfs configuration mistakes.

gmykhailiuta avatar Apr 20 '16 14:04 gmykhailiuta

@gmykhailiuta I have the same error. What was the configuration mistake ?

hnagri avatar Nov 18 '16 11:11 hnagri