Beispiel #1
0
 def setup(self):
     """
         Function to setup the volume for testing.
     """
     volinfo = get_volume_info(server=self.nodes[0])
     if volinfo is not None and self.volname in volinfo.keys():
         tc.logger.debug("The volume %s is already present in %s" \
                 % (self.volname, self.mnode))
         if not self.config_data['reuse_setup']:
             ret = cleanup_volume(self.volname, self.mnode)
             if not ret:
                 tc.logger.error("Unable to cleanup the setup")
                 return False
     else:
         dist = rep = dispd = red = stripe = 1
         trans = ''
         if self.voltype == 'distribute':
             dist = self.config_data[self.voltype]['dist_count']
             trans = self.config_data[self.voltype]['transport']
         elif self.voltype == 'replicate':
             rep = self.config_data[self.voltype]['replica']
             trans = self.config_data[self.voltype]['transport']
         elif self.voltype == 'dist_rep':
             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[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']
             red = self.config_data[self.voltype]['redundancy']
             trans = self.config_data[self.voltype]['transport']
         else:
             tc.logger.error("The volume type is not present")
             return False
         ret = setup_vol(self.volname, dist, rep, dispd, red, \
                         stripe, trans, servers=self.nodes)
         if not ret:
             tc.logger.error("Unable to setup volume %s. Aborting" \
                     % self.volname)
             return False
     return True
Beispiel #2
0
 def cleanup(self):
     """
         The function to cleanup the volume
     """
     return cleanup_volume(self.volname, self.mnode)