Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan 
Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/7857

to review the following change.

Change subject: glusterHostsList verb returns local hostname as IP address or 
FQDN
......................................................................

glusterHostsList verb returns local hostname as IP address or FQDN

Change-Id: I24d2b4d27107d208672b1d3df96dd7759d2288c5
Signed-off-by: Bala.FA <[email protected]>
---
M vdsm/gluster/cli.py
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/7857/1

diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index d7cd5a0..0f56151 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -23,6 +23,7 @@
 from functools import wraps
 
 from vdsm import utils
+from vdsm import netinfo
 import exception as ge
 from hostname import getHostNameFqdn, HostNameException
 
@@ -82,6 +83,13 @@
         return tree
     else:
         raise ge.GlusterCmdFailedException(rc=rv, err=[msg])
+
+
+def _getLocalIpAddress():
+    for ip in netinfo.getIpAddresses():
+        if not ip.startswith('127.'):
+            return ip
+    return ''
 
 
 def _parseVolumeInfo(out):
@@ -546,7 +554,7 @@
         raise ge.GlusterHostsListFailedException(rc=e.rc, err=e.err)
     try:
         return _parsePeerStatus(xmltree,
-                                _getGlusterHostName(),
+                                _getLocalIpAddress() or _getGlusterHostName(),
                                 _getGlusterUuid(), HostStatus.CONNECTED)
     except (etree.ParseError, AttributeError, ValueError):
         raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])


--
To view, visit http://gerrit.ovirt.org/7857
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24d2b4d27107d208672b1d3df96dd7759d2288c5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Timothy Asir <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to