示例#1
0
文件: dev.py 项目: DarumasLegs/alba
    def deploy_and_test(old_proxy, old_plugins, old_asds):
        tls = 'False'

        alba.demo_kill()

        env_old = env.copy()
        old_alba_home = './bin/0.6'
        env_old['alba_bin'] = env.get('alba.0.6')
        env_old['alba_plugin_path'] = env.get('ALBA_06_PLUGIN_PATH', '/usr/lib/alba')
        env_old['license_file'] = '%s/community_license' % old_alba_home
        env_old['signature']    = '''3cd787f7a0bcb6c8dbf40a8b4a3a5f350fa87d1bff5b33f5d099ab850e44aaeca6e3206b595d7cb361eed28c5dd3c0f3b95531d931a31a058f3c054b04917797b7363457f7a156b5f36c9bf3e1a43b46e5c1e9ca3025c695ef366be6c36a1fc28f5648256a82ca392833a3050e1808e21ef3838d0c027cf6edaafedc8cfe2f2fc37bd95102b92e7de28042acc65b8b6af4cfb3a11dadce215986da3743f1be275200860d24446865c50cdae2ebe2d77c86f6d8b3907b20725cdb7489e0a1ba7e306c90ff0189c5299194598c44a537b0a460c2bf2569ab9bb99c72f6415a2f98c614d196d0538c8c19ef956d42094658dba8d59cfc4a024c18c1c677eb59299425ac2c225a559756dee125ef93c38c211cda69c892d26ca33b7bd2ca95f15bbc1bb755c46574432005b8afcab48a0a5ed489854cec24207cddc7ab632d8715c1fb4b1309b45376a49e4c2b4819f27d9d6c8170c59422a0b778b9c3ac18e677bc6fa6e2a2527365aca5d16d4bc6e22007debef1989d08adc9523be0a5d50309ef9393eace644260345bb3d442004c70097fffd29fe315127f6d19edd4f0f46ae2f10df4f162318c4174b1339286f8c07d5febdf24dc049a875347f6b2860ba3a71b82aba829f890192511d6eddaacb0c8be890799fb5cb353bce7366e8047c9a66b8ee07bf78af40b09b4b278d8af2a9333959213df6101c85dda61f2944237c8'''
        env_old['arakoon_bin'] = env.get('ARAKOON_189_BIN', '/usr/bin/arakoon')
        if old_plugins:
            arakoon_env = env_old
        else:
            arakoon_env = env

        alba.demo_kill(env = env_old)

        alba.arakoon_start(env = arakoon_env)
        alba.wait_for_master(env = arakoon_env)

        if old_plugins:
            cmd = [
                env_old['alba_bin'],
                'apply-license',
                env_old['license_file'],
                env_old['signature'],
                '--config', arakoon_config_file
            ]
            cmd_line = ' '.join(cmd)
            local(cmd_line)

        alba.maintenance_start()

        proxy_env = env_old if old_proxy else env

        alba.proxy_start(env = proxy_env)


        alba.nsm_host_register_default()


        if old_asds:
            asd_env = env_old
        else:
            asd_env = env

        kind = default_kind
        alba.start_osds(kind, N, False, env = asd_env)
        alba.claim_local_osds(N, abm_cfg = arakoon_config_file)
        alba.create_namespace_demo()
        #
        test(old_proxy, old_plugins, old_asds)
示例#2
0
文件: dev.py 项目: DarumasLegs/alba
def run_tests_ocaml(xml=False,
                    kind = default_kind,
                    dump = None,
                    filter = None):
    alba.demo_kill()
    alba.arakoon_start()
    alba.wait_for_master()

    alba.maintenance_start()
    alba.proxy_start()
    alba.nsm_host_register_default()

    alba.start_osds(kind, N, False)

    tls = env['alba_tls']
    use_tls = is_true(tls)
    if use_tls:
        # make cert for extra asd (test_discover_claimed)
        alba.make_cert(name = 'test_discover_claimed')

    alba.claim_local_osds(N, abm_cfg = arakoon_config_file)

    where = local
    where("rm -rf %s/ocaml/" % ALBA_BASE_PATH)

    cmd = [env['alba_bin'], "unit-tests"]
    if xml:
        cmd.append(" --xml=true")
    if filter:
        cmd.append(" --only-test=%s" % filter)

    if use_tls:
        alba._extend_alba_tls(cmd)

    print cmd
    cmd_line = ' '.join(cmd)
    if dump:
        cmd_line += " > %s" % dump

    where(cmd_line)
示例#3
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()