Skip to content

Commit

Permalink
Removed gluster volume option fetching and parsing logic
Browse files Browse the repository at this point in the history
bugzilla: 1685461
tendrl-bug-id: Tendrl#717

Signed-off-by: GowthamShanmugasundaram <[email protected]>
  • Loading branch information
GowthamShanmugam committed Mar 6, 2019
1 parent fff4e12 commit 7a8fbb3
Showing 1 changed file with 4 additions and 64 deletions.
68 changes: 4 additions & 64 deletions tendrl/gluster_integration/sds_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import re
import socket
import subprocess
import threading
Expand Down Expand Up @@ -111,28 +110,6 @@ def run(self):
'/var/run/glusterd-state'
)
subprocess.call(['rm', '-rf', '/var/run/glusterd-state'])
subprocess.call(
[
'gluster',
'get-state',
'glusterd',
'odir',
'/var/run',
'file',
'glusterd-state-vol-opts',
'volumeoptions'
]
)
raw_data_options = ini2json.ini_to_dict(
'/var/run/glusterd-state-vol-opts'
)
subprocess.call(
[
'rm',
'-rf',
'/var/run/glusterd-state-vol-opts'
]
)
sync_object = NS.gluster.objects.\
SyncObject(data=json.dumps(raw_data))
sync_object.save()
Expand Down Expand Up @@ -232,8 +209,8 @@ def run(self):
while True:
try:
b_count = sync_volumes(
volumes, index,
raw_data_options.get('Volume Options'),
volumes,
index,
SYNC_TTL + VOLUME_TTL,
_cluster.short_name,
devicetree,
Expand All @@ -256,30 +233,6 @@ def run(self):
VOLUME_TTL = (volume_count * 20) + (
total_brick_count * 10) + 160
break
# populate the volume specific options
reg_ex = re.compile("^volume[0-9]+.options+")
options = {}
for key in volumes.keys():
if reg_ex.match(key):
options[key] = volumes[key]
for key in options.keys():
volname = key.split('.')[0]
vol_id = volumes['%s.id' % volname]
dict1 = {}
for k, v in options.items():
if k.startswith('%s.options' % volname):
dict1['.'.join(k.split(".")[2:])] = v
options.pop(k, None)
volume = NS.tendrl.objects.GlusterVolume(
NS.tendrl_context.integration_id,
vol_id=vol_id
).load()
if volume.options is not None:
dest = dict(volume.options)
dest.update(dict1)
volume.options = dest
volume.save()

# Sync cluster global details
if "provisioner/%s" % NS.tendrl_context.integration_id \
in NS.node_context.tags:
Expand Down Expand Up @@ -402,8 +355,8 @@ def _update_volume_profiling(self):


def sync_volumes(
volumes, index,
vol_options,
volumes,
index,
sync_ttl,
cluster_short_name,
devicetree,
Expand Down Expand Up @@ -519,19 +472,6 @@ def sync_volumes(
}
)
volume.save(ttl=sync_ttl)
# Save the default values of volume options
vol_opt_dict = {}
for opt_count in \
range(1, int(vol_options['volume%s.options.count' % index])):
vol_opt_dict[
vol_options[
'volume%s.options.key%s' % (index, opt_count)
]
] = vol_options[
'volume%s.options.value%s' % (index, opt_count)
]
volume.options = vol_opt_dict
volume.save()

rebal_det = NS.gluster.objects.RebalanceDetails(
vol_id=volumes['volume%s.id' % index],
Expand Down

0 comments on commit 7a8fbb3

Please sign in to comment.