diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-04-16 10:52:56 +0530 |
---|---|---|
committer | Bala.FA <barumuga@redhat.com> | 2014-04-29 10:21:37 +0530 |
commit | 8a52346c78331d6b192a0bb2205b9a73983c9a97 (patch) | |
tree | 41f22f9999ef37dcae829cafb949d732cf88689c /plugins/discovery.py | |
parent | 7b0612039a50d9bbe7a258bf07e0ecdb4b3e50c3 (diff) |
autocof: adding volume name as part of brick services
Currently there is no way to identify the volume from brick
services. Hence adding volume name as custom variable and note in
brick services
Change-Id: If1ef000196dca2239f713fe41d033d8a4161d6c0
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Diffstat (limited to 'plugins/discovery.py')
-rwxr-xr-x | plugins/discovery.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/plugins/discovery.py b/plugins/discovery.py index 5794c2e..2cde3d0 100755 --- a/plugins/discovery.py +++ b/plugins/discovery.py @@ -20,13 +20,11 @@ import argparse import commands import json import datetime -import re import sys from config_generator import GlusterNagiosConfManager from glusternagios import utils -#from glusternagios import utils from constants import DEFAULT_AUTO_CONFIG_DIR from constants import HOST_TEMPLATE_DIR from constants import HOST_TEMPLATE_NAME @@ -72,11 +70,6 @@ def discoverlogicalcomponents(host): def discovercluster(args): - """ - - :rtype : None - """ - ipPat = re.compile("^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$") clusterdata = {} #Discover the logical components componentlist = discoverlogicalcomponents(args.hostip) @@ -89,12 +82,14 @@ def discovercluster(args): #to generate the configuration hostlist.append({"hostip": args.hostip}) for host in hostlist: - if(ipPat.match(host['hostip'])): - #host.update(discoverhostdetails(host['hostip'], args)) - #Get the list of bricks for this host and add to dictionary - host['bricks'] = \ - [brick for brick in componentlist['bricks'] - if brick["hostip"] == host['hostip']] + #host.update(discoverhostdetails(host['hostip'], args)) + #Get the list of bricks for this host and add to dictionary + host['bricks'] = [] + for volume in componentlist['volumes']: + for brick in volume['bricks']: + if brick['hostip'] == host['hostip']: + brick['volumeName'] = volume['name'] + host['bricks'].append(brick) clusterdata['hosts'] = hostlist clusterdata['volumes'] = componentlist['volumes'] clusterdata['name'] = args.cluster |