Пример #1
0
def gluster_basic_test():
    tc.logger.info("Testing gluster volume create and mounting")
    volname = tc.config_data['VOLNAME']
    mount_type = tc.config_data['MOUNT_TYPE']
    mountpoint = tc.config_data['MOUNTPOINT']
    mnode = tc.nodes[0]
    client = tc.clients[0]
    _rc = True
    ret = setup_vol()
    if not ret:
        tc.logger.error("Unable to setup the volume %s" % volname)
        return False
    tc.run(mnode, "gluster volume status %s" % volname)
    ret, _, _ = mount_volume(volname, mount_type, mountpoint, mclient=client)
    if ret != 0:
        tc.logger.error("mounting volume %s failed" % volname)
        _rc = False
    else:
        ret, _, _ = tc.run(client, "cp -r /etc %s" % mountpoint)
        if ret != 0:
            tc.logger.error("cp failed on the mountpoint")
            _rc = False
    umount_volume(client, mountpoint)
    ret = stop_volume(volname)
    if not ret:
        _rc = False
    ret = delete_volume(volname)
    if not ret:
        _rc = False
    return _rc
Пример #2
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