diff options
Diffstat (limited to 'tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py')
-rw-r--r-- | tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py | 84 |
1 files changed, 25 insertions, 59 deletions
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py index dbbe02de7de..128288bb10f 100644 --- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py +++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py @@ -19,7 +19,6 @@ from distaf.util import tc from distaflibs.gluster.volume_ops import (setup_vol, get_volume_info, cleanup_volume) -from distaflibs.gluster.mount_ops import GlusterMount class GlusterBaseClass(): @@ -33,49 +32,26 @@ class GlusterBaseClass(): """ Initialise the class with the config values """ - if config_data['gluster']['global_mode']: - self.volname = config_data['gluster']['volumes'][0]['name'] - self.voltype = (config_data['gluster']['volumes'][0]['voltype'] - ['type']) - self.servers = [] - for server in config_data['gluster']['volumes'][0]['servers']: - self.servers.append(server['host']) - self.peers = config_data['gluster']['volumes'][0]['peers'] - self.mounts = [] - for mount in config_data['gluster']['mounts']: - mount['client'] = mount['client']['host'] - mount['server'] = mount['server']['host'] - self.mounts.append(GlusterMount(mount)) - self.clients = [] - for mount_obj in self.mounts: - self.clients.append(mount_obj.client_system) - self.clients = filter(None, self.clients) - + if config_data['global_mode']: + self.volname = config_data['volumes'].keys()[0] + self.voltype = config_data['volumes'][self.volname]['voltype'] + self.servers = config_data['volumes'][self.volname]['servers'] + self.peers = config_data['volumes'][self.volname]['peers'] + self.clients = config_data['volumes'][self.volname]['clients'] + self.mount_proto = (config_data['volumes'][self.volname] + ['mount_proto']) + self.mountpoint = (config_data['volumes'][self.volname] + ['mountpoint']) else: self.voltype = config_data['voltype'] self.volname = "%s-testvol" % self.voltype - self.servers = [] - for server in config_data['servers']: - self.servers.append(server['host']) - self.clients = [] - for client in config_data['clients']: - self.clients.append(client['host']) + self.servers = config_data['servers'].keys() + self.clients = config_data['clients'].keys() self.peers = [] if config_data['peers'] is not None: - for peer in config_data['peers']: - self.peers.append(peers['host']) - self.mounts = [] + self.peers = config_data['peers'].keys() self.mount_proto = config_data['mount_proto'] self.mountpoint = "/mnt/%s_mount" % self.mount_proto - for client in self.clients: - mount = {} - mount['protocol'] = config_data['mount_proto'] - mount['mountpoint'] = "/mnt/%s_mount" % self.mount_proto - mount['server'] = self.servers[0] - mount['client'] = client - mount['volname'] = self.volname - mount['options'] = "" - self.mounts.append(GlusterMount(mount)) self.mnode = self.servers[0] self.config_data = config_data @@ -86,33 +62,23 @@ class GlusterBaseClass(): dist = rep = dispd = red = stripe = 1 trans = '' if self.voltype == 'distribute': - dist = (self.config_data['gluster']['volume_types'][self.voltype] - ['dist_count']) - trans = (self.config_data['gluster']['volume_types'][self.voltype] - ['transport']) + dist = self.config_data[self.voltype]['dist_count'] + trans = self.config_data[self.voltype]['transport'] elif self.voltype == 'replicate': - rep = (self.config_data['gluster']['volume_types'][self.voltype] - ['replica_count']) - trans = (self.config_data['gluster']['volume_types'][self.voltype] - ['transport']) + rep = self.config_data[self.voltype]['replica'] + trans = self.config_data[self.voltype]['transport'] elif self.voltype == 'dist_rep': - dist = (self.config_data['gluster']['volume_types'][self.voltype] - ['dist_count']) - rep = (self.config_data['gluster']['volume_types'][self.voltype] - ['replica_count']) - trans = (self.config_data['gluster']['volume_types'][self.voltype] - ['transport']) + dist = self.config_data[self.voltype]['dist_count'] + rep = self.config_data[self.voltype]['replica'] + trans = self.config_data[self.voltype]['transport'] elif self.voltype == 'disperse': - dispd = (self.config_data['gluster']['volume_types'][self.voltype] - ['disperse_count']) - red = (self.config_data['gluster']['volume_types'][self.voltype] - ['redundancy_count']) - trans = (self.config_data['gluster']['volume_types'][self.voltype] - ['transport']) + dispd = self.config_data[self.voltype]['disperse'] + red = self.config_data[self.voltype]['redundancy'] + trans = self.config_data[self.voltype]['transport'] elif self.voltype == 'dist_disperse': dist = self.config_data[self.voltype]['dist_count'] - dispd = self.config_data[self.voltype]['disperse_count'] - red = self.config_data[self.voltype]['redundancy_count'] + dispd = self.config_data[self.voltype]['disperse'] + red = self.config_data[self.voltype]['redundancy'] trans = self.config_data[self.voltype]['transport'] else: tc.logger.error("The volume type is not present") |