def __init__(self, config_dir, output_dir, output_path, volume_name, **kw ):
     threading.Thread.__init__(self)
     self.read_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", **kw )
     read_gateway_info = testlib.read_gateway( config_dir, self.read_gateway_name )
     self.read_gateway_id = read_gateway_info['g_id']
     
     volume_info = testlib.read_volume( config_dir, volume_name )
     self.volume_id = volume_info['volume_id']
     self.config_dir = config_dir
     self.volume_name = volume_name
     self.output_path = output_path
     self.output_dir = output_dir
     self.exitcode = 0
     self.errormsg = ""
     self.errors = False
    def __init__(self, config_dir, output_dir, output_path, volume_name, **kw):
        threading.Thread.__init__(self)
        self.read_gateway_name = testlib.add_test_gateway(
            config_dir, volume_name, "UG", **kw)
        read_gateway_info = testlib.read_gateway(config_dir,
                                                 self.read_gateway_name)
        self.read_gateway_id = read_gateway_info['g_id']

        volume_info = testlib.read_volume(config_dir, volume_name)
        self.volume_id = volume_info['volume_id']
        self.config_dir = config_dir
        self.volume_name = volume_name
        self.output_path = output_path
        self.output_dir = output_dir
        self.exitcode = 0
        self.errormsg = ""
        self.errors = False
    file_version = int(file_version_line[0].split(" ")[-1])
    file_id_hex = file_id_line[0].split(" ")[-1]
    if len(file_id_hex) != 16:
        file_id_hex = ("0" * (16 - len(file_id_hex))) + file_id_hex

    file_id_hex_parts = []
    for i in xrange(0, 4):
        file_id_hex_parts.append( file_id_hex[4*i] + file_id_hex[4*i+1] + file_id_hex[4*i+2] + file_id_hex[4*i+3] )

    # expected built-in attr for cached file data
    gateway_info = testlib.read_gateway( config_dir, gateway_name )
    getxattr_gateway_info = testlib.read_gateway( config_dir, getxattr_gateway_name )
    gateway_coord_id = gateway_info['g_id']
    getxattr_gateway_id = getxattr_gateway_info['g_id']
    volume_info = testlib.read_volume( config_dir, volume_name )
    file_cache_path = os.path.join( testlib.cache_dir( config_dir, volume_info['volume_id'], getxattr_gateway_id ), "/".join(file_id_hex_parts)) + "." + file_id_hex + "." + str(file_version)
    builtin_xattr_expected_values["user.syndicate_coordinator"] = gateway_name
    builtin_xattr_expected_values["user.syndicate_cached_file_path"] = file_cache_path

    # leave this gateway running, so it can answer xattr queries 
    ug_proc, ug_out_path = testlib.start_gateway( config_dir, COORD_PATH, testconf.SYNDICATE_ADMIN, volume_name, gateway_name, path, valgrind=True ) 
    time.sleep(5)

    # get built-in xattrs, individually, with the getxattr gateway
    for builtin_xattr in builtin_xattrs:
        exitcode, out = testlib.run( GETXATTR_PATH, '-d2', '-f', '-c', os.path.join(config_dir, 'syndicate.conf'),
                                     '-u', testconf.SYNDICATE_ADMIN, '-v', volume_name, '-g', getxattr_gateway_name,
                                     path, builtin_xattr )

        testlib.save_output( output_dir, "syndicate-getxattr-%s" % builtin_xattr, out )
Exemplo n.º 4
0
    # start up AG
    AG_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "AG", caps="ALL", email=testconf.SYNDICATE_ADMIN )
    testlib.update_gateway( config_dir, AG_gateway_name, "port=31112", "driver=%s" % AG_DRIVER )

    ag_proc, ag_out_path = testlib.start_gateway( config_dir, AG_PATH, testconf.SYNDICATE_ADMIN, volume_name, AG_gateway_name, valgrind=True )
    time.sleep(30)
    if not testlib.gateway_ping( 31112, 15 ):
        raise Exception("%s exited %s" % (AG_PATH, ag_proc.poll()))

    # should cause the AG to get updated that there's a new gateway 
    read_gateway_name = testlib.add_test_gateway( config_dir, volume_name, "UG", caps="ALL", email=testconf.SYNDICATE_ADMIN )

    read_gateway_info = testlib.read_gateway( config_dir, read_gateway_name )
    read_gateway_id = read_gateway_info['g_id']

    volume_info = testlib.read_volume( config_dir, volume_name )
    volume_id = volume_info['volume_id']

    # try reading various ranges (these are (start, end) absolute ranges, not offset/length)
    ranges = [
        (1, 200),
        (0, 4096),  # 1 block, aligned
        (0, 8192),  # 2 blocks, aligned
        (0, 1000),  # 1 block, tail unaligned
        (0, 6000),  # 2 blocks, tail unaligned
        (100, 4000), # 1 block, head unaligned
        (5000, 10000), # 2 blocks, head and tail unaligned
        (4096, 10000), # 2 blocks, tail unaligned
        (5000, 8192),  # 2 blocks, head unalighed
        (4096, 16834), # 3 blocks, aligned
        (5000, 16384), # 3 blocks, head unaligned