diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-04-23 18:15:16 +0530 |
---|---|---|
committer | Bala.FA <barumuga@redhat.com> | 2014-04-29 10:14:33 +0530 |
commit | 3cce71403b424fb9d37e3a2f381426bb43a06b24 (patch) | |
tree | 1b4fc6a67f7780e630fd2f6c3bb8df3968925836 /plugins | |
parent | da86fb22e0f09d977b68910d5c6fe06386595f11 (diff) |
autoconf: use host uuid to identity bricks
Currently host IP/Name is used to indetify the bricks
in host. But it breaks when we use fqdn names in peer probe.
So changing the auto conf to use Host UUIDs to identify the
bricks
Change-Id: Id28ac7a47a4ce5beb1fc8f91cdb136bca17f071f
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/discoverlogicalcomponents.py | 7 | ||||
-rwxr-xr-x | plugins/discoverpeers.py | 27 |
2 files changed, 15 insertions, 19 deletions
diff --git a/plugins/discoverlogicalcomponents.py b/plugins/discoverlogicalcomponents.py index 9211f42..0d826ff 100755 --- a/plugins/discoverlogicalcomponents.py +++ b/plugins/discoverlogicalcomponents.py @@ -34,10 +34,11 @@ def discoverlogicalelements(): volDict['name'] = volume['volumeName'] volDict['type'] = volume['volumeType'] volDict['bricks'] = [] - for brickstr in volume['bricks']: - brickproplist = brickstr.split(':') + for brick in volume['bricksInfo']: + brickproplist = brick['name'].split(':') volDict['bricks'].append({'hostip': brickproplist[0], - 'brickpath': brickproplist[1]}) + 'brickpath': brickproplist[1], + 'hostUuid': brick['hostUuid']}) resultlist['volumes'].append(volDict) resultstring = json.dumps(resultlist) diff --git a/plugins/discoverpeers.py b/plugins/discoverpeers.py index c7ff8fe..6683a84 100755 --- a/plugins/discoverpeers.py +++ b/plugins/discoverpeers.py @@ -16,29 +16,24 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -import commands import sys import json from glusternagios import utils +from glusternagios import glustercli +from glusternagios.glustercli import HostStatus def discoverhosts(): - xmlElemList = [] - nrpe_out_list = [] - resultstring = "" - - command_peer_status = utils.sudoCmdPath.cmd + " " \ - + utils.glusterCmdPath.cmd + " peer status --xml" - peer_status_out = commands.getoutput(command_peer_status) - - xmlElemList = utils.parseXml(peer_status_out, "./peerStatus/peer") - for peer in xmlElemList: - if (peer.find('connected').text == "1"): - resltdict = {} - resltdict['hostip'] = peer.find('hostname').text - nrpe_out_list.append(resltdict) - resultstring = json.dumps(nrpe_out_list) + resultlist = [] + peers = glustercli.peerStatus() + for peer in peers: + if peer['status'] == HostStatus.CONNECTED: + peerDict = {} + peerDict['hostip'] = peer['hostname'] + peerDict['uuid'] = peer['uuid'] + resultlist.append(peerDict) + resultstring = json.dumps(resultlist) print resultstring sys.exit(utils.PluginStatusCode.OK) |