コード例 #1
0
ファイル: dev.py プロジェクト: DarumasLegs/alba
    def _inner():
        alba.demo_kill()
        alba.demo_setup()
        cmd = [
            env['alba_bin'],
            'create-preset', 'preset_no_compression',
            '--config', arakoon_config_file,

        ]
        tls = env['alba_tls']
        if is_true(tls):
            alba._extend_alba_tls(cmd)

        cmd.append('< ./cfg/preset_no_compression.json')
        # create the preset in albamgr
        local(" ".join(cmd))

        cmd = [
            env['alba_bin'],
            'create-namespace', 'big', 'preset_no_compression',
            '--config', arakoon_config_file
        ]
        if is_true(tls):
            alba._extend_alba_tls(cmd)
        # create new namespace with this preset
        local(" ".join(cmd))

        object_file = "%s/obj" % ALBA_BASE_PATH
        # upload a big object
        local("truncate -s 2G %s" % object_file)
        local(" ".join([
            'time', env['alba_bin'],
            'proxy-upload-object',
            "-h 127.0.0.1 ",
            'big', object_file, 'bigobj'
        ]))
        # note this may fail with NoSatisfiablePolicy from time to time

        local(" ".join([
            'time', env['alba_bin'],
            'proxy-download-object',
            "-h 127.0.0.1 ",
            'big', 'bigobj', '%s/obj_download' % ALBA_BASE_PATH
        ]))
        local("rm %s/obj_download" % ALBA_BASE_PATH)

        # policy says we can lose a node,
        # so stop and decommission osd 0 to 3
        for i in range(0,4):
            port = alba.get_osd_port(i)
            alba.osd_stop(port)
            long_id = "%i_%i_%s" % (port, 2000, alba.local_nodeid_prefix)
            cmd = [
                env['alba_bin'],
                'decommission-osd', '--long-id', long_id,
                '--config', arakoon_config_file
            ]
            if is_true(tls):
                alba._extend_alba_tls(cmd)
            local(" ".join(cmd))
コード例 #2
0
ファイル: dev.py プロジェクト: DarumasLegs/alba
def run_test_asd_start(xml=False):
    alba.demo_kill()
    alba.demo_setup()

    object_location = "%s/obj" % ALBA_BASE_PATH
    local("dd if=/dev/urandom of=%s bs=1M count=1" % object_location)

    for i in xrange(0, 1000):
        cmd = [
            env['alba_bin'],
            'proxy-upload-object',
            "-h 127.0.0.1 ",
            'demo', object_location,
            str(i)
        ]
        local(" ".join(cmd))

    for i in xrange(0, N):
        alba.osd_stop(alba.get_osd_port(i))

    alba.start_osds(default_kind, N, True, restart = True)
    time.sleep(2)

    cmd = [
        env['alba_bin'],
        'proxy-upload-object',
        "-h 127.0.0.1 ",
        'demo', object_location,
        "fdskii", "--allow-overwrite"
    ]
    with warn_only():
        # this clears the borked connections from the
        # asd connection pools
        local(" ".join(cmd))
        local(" ".join(cmd))
        local(" ".join(cmd))
        time.sleep(2)
        local(" ".join(cmd))

    r = local(" ".join(cmd))
    print r

    local(" ".join([
        env['alba_bin'],
        'proxy-download-object',
        "-h 127.0.0.1 ",
        'demo', '1', '%s/obj2' % ALBA_BASE_PATH
    ]))

    alba.smoke_test()

    if xml:
        alba.dump_junit_xml()
コード例 #3
0
ファイル: dev.py プロジェクト: DarumasLegs/alba
    def fresh():
        alba.demo_kill()
        alba.demo_setup()

        # deliver osd & nsm messages
        time.sleep(1)
        cmd = [
            env['alba_bin'],
            'deliver-messages',
            '--config', arakoon_config_file
        ]
        local(' '.join(cmd))

        # stop asd 0
        alba.osd_stop(alba.get_osd_port(0))
コード例 #4
0
ファイル: dev.py プロジェクト: DarumasLegs/alba
def run_tests_recovery(xml = False, tls = 'False'):
    alba.demo_kill()

    # set up separate albamgr & nsm host
    abm_cfg = "cfg/test_abm.ini"
    nsm_cfg = "cfg/test_nsm_1.ini"
    alba.arakoon_start_(abm_cfg, "%s/abm_0" % ALBA_BASE_PATH, ["micky_0"])
    alba.arakoon_start_(nsm_cfg, "%s/nsm_1" % ALBA_BASE_PATH, ["zicky_0"])

    alba.wait_for_master(abm_cfg)
    alba.wait_for_master(nsm_cfg)

    alba.nsm_host_register(nsm_cfg, albamgr_cfg = abm_cfg)

    alba.maintenance_start(abm_cfg = abm_cfg)
    alba.proxy_start(abm_cfg = abm_cfg)

    N = 3
    alba.start_osds("ASD", N, False)

    alba.claim_local_osds(N, abm_cfg = abm_cfg)

    alba.maintenance_stop()

    ns = 'test'
    alba.create_namespace(ns, abm_cfg = abm_cfg)

    obj_name = 'alba_binary'
    cmd = [
        env['alba_bin'],
        'upload-object', ns, env['alba_bin'], obj_name,
        '--config', abm_cfg
    ]
    local(' '.join(cmd))

    cmd = [
        env['alba_bin'],
        'show-object', ns, obj_name,
        '--config', abm_cfg
    ]
    local(' '.join(cmd))

    checksum1 = local('md5sum %s' % env['alba_bin'], capture=True)

    # kill nsm host
    local('fuser -n tcp 4001 -k')
    local('rm -rf %s/nsm_1' % ALBA_BASE_PATH)

    cmd = [
        env['alba_bin'],
        'update-nsm-host',
        nsm_cfg,
        '--lost',
        '--config', abm_cfg
    ]
    local(' '.join(cmd))

    # start new nsm host + register it to albamgr
    alba.arakoon_start_("cfg/test_nsm_2.ini", "%s/nsm_2" % ALBA_BASE_PATH, ["ticky_0"])
    alba.wait_for_master("cfg/test_nsm_2.ini")
    cmd = [
        env['alba_bin'],
        "add-nsm-host",
        'cfg/test_nsm_2.ini',
        "--config",
        abm_cfg
    ]
    local(' '.join(cmd))

    # recover namespace to the new nsm host
    cmd = [
        env['alba_bin'],
        'recover-namespace', ns, 'ticky',
        '--config', abm_cfg
    ]
    local(' '.join(cmd))

    cmd = [
        env['alba_bin'],
        'deliver-messages',
        '--config', abm_cfg
    ]
    local(' '.join(cmd))
    local(' '.join(cmd))

    # bring down one of the osds
    # we should be able to handle this...
    alba.osd_stop(alba.get_osd_port(0))

    local('mkdir -p %s/recovery_agent' % ALBA_BASE_PATH)
    cmd = [
        env['alba_bin'],
        'namespace-recovery-agent',
        ns, '%s/recovery_agent' % ALBA_BASE_PATH, '1', '0',
        "--config", abm_cfg,
        "--osd-id 1 --osd-id 2"
    ]
    local(' '.join(cmd))

    dfile = 'destination_file.out'
    local('rm -f %s' % dfile)
    cmd = [
        env['alba_bin'],
        'download-object', ns, obj_name, dfile,
        "--config", abm_cfg
    ]
    local(' '.join(cmd))

    checksum1 = hashlib.md5(open(env['alba_bin'], 'rb').read()).hexdigest()
    checksum2 = hashlib.md5(open(dfile, 'rb').read()).hexdigest()

    print "Got checksums %s & %s" % (checksum1, checksum2)

    assert (checksum1 == checksum2)

    # TODO 1
    # iets asserten ivm hoeveel fragments er in manifest aanwezig zijn
    # dan osd 0 starten en recovery opnieuw draaien
    # die moet kunnen de extra fragments goed benutten

    # TODO 2
    # object eerst es overschrijven, dan recovery doen
    # en zien of we laatste versie krijgen

    # TODO 3
    # add more objects (and verify them all)

    # TODO 4
    # start met 1 osd die alive is

    if xml:
        alba.dump_junit_xml()