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
Example #2
0
def snap_restore(volname, snapname, server=''):
    """
        stops the volume restore the snapshot and starts the volume

        Returns True upon success, False on in any step
    """
    if server == '':
        server = tc.nodes[0]
    ret = stop_volume(volname, server)
    if not ret:
        return False
    ret = tc.run(server, "gluster snapshot restore %s" % snapname)
    if ret[0] != 0:
        tc.logger.error("snapshot restore failed")
        return False
    ret = start_volume(volname, server)
    if not ret:
        return False
    return True