Beispiel #1
0
def execute_setup(cluster: Ceph, config: dict) -> None:
    """
    Execute the prerequisites required to run the tests.

    It involves the following steps
        - install the required software (radosgw for CLI execution)
        - Clone the S3 tests repo in the client node
        - Install S3 pre-requisites in the client node
        - Open the firewall port on the RGW node
        - Add 'rgw_lc_debug_interval' key to the RGW node config
        - Restart the service

    Args:
        cluster: Ceph cluster participating in the test.
        config:  The key/value pairs passed by the tester.

    Raises:
        CommandFailed:  When a remote command returned non-zero value.
    """
    build = config.get("build", config.get("rhbuild"))
    client_node = cluster.get_nodes(role="client")[0]
    rgw_node = cluster.get_nodes(role="rgw")[0]

    branch = config.get("branch", "ceph-luminous")
    clone_s3_tests(node=client_node, branch=branch)
    install_s3test_requirements(client_node, branch)

    host = rgw_node.shortname
    secure = config.get("is_secure", "no")
    port = "443" if secure.lower() == "yes" else rgw_frontend_port(
        cluster, build)
    create_s3_conf(cluster, build, host, port, secure)

    if not build.startswith("5"):
        open_firewall_port(rgw_node, port=port, protocol="tcp")

    add_lc_debug(cluster, build)
Beispiel #2
0
def setup_s3_tests(client_node, rgw_node, config, build):
    """
    Performs initial setup and configuration for s3 tests on client node.

    Args:
        client_node: node to setup for s3 tests
        rgw_node: node running rados gateway
        config: test configuration
        build: rhcs4 build version

    Returns:
        None

    """
    log.info("Removing existing s3-tests directory if it exists")
    client_node.exec_command(
        cmd="if test -d s3-tests; then rm -r s3-tests; fi")

    log.info("Cloning s3-tests repository")
    branch = config.get('branch', 'ceph-luminous')
    repo_url = "https://github.com/ceph/s3-tests.git"
    client_node.exec_command(cmd="git clone -b {branch} {repo_url}".format(
        branch=branch, repo_url=repo_url))

    log.info("Running bootstrap")
    if build.startswith('4'):
        client_node.exec_command(cmd="cd s3-tests")
        client_node.exec_command(
            cmd=
            "sudo yum install -y python2-virtualenv python2-devel libevent-devel"
            "libffi-devel libxml2-devel libxslt-devel zlib-devel",
            check_ec=False)
        client_node.exec_command(
            cmd="virtualenv --no-site-packages --distribute virtualenv")
        client_node.exec_command(
            cmd="./virtualenv/bin/pip install setuptools==32.3.1")
        client_node.exec_command(
            cmd="./virtualenv/bin/pip install -r requirements.txt")
        client_node.exec_command(
            cmd="./virtualenv/bin/python setup.py develop")
    else:
        client_node.exec_command(cmd="cd s3-tests; ./bootstrap", )

    main_info = create_s3_user(client_node, 'main-user')
    alt_info = create_s3_user(client_node, 'alt-user', email=True)
    tenant_info = create_s3_user(client_node, 'tenant', email=True)

    log.info("Creating configuration file")
    port = '8080'
    s3_config = '''
[DEFAULT]
host = {host}
port = {port}
is_secure = no

[fixtures]
bucket prefix = cephuser-{random}-

[s3 main]
user_id = {main_id}
display_name = {main_name}
access_key = {main_access_key}
secret_key = {main_secret_key}

[s3 alt]
user_id = {alt_id}
display_name = {alt_name}
email = {alt_email}
access_key = {alt_access_key}
secret_key = {alt_secret_key}

[s3 tenant]
user_id = {tenant_id}
display_name = {tenant_name}
email = {tenant_email}
access_key = {tenant_access_key}
secret_key = {tenant_secret_key}
    '''.format(host=rgw_node.shortname,
               port=port,
               random='{random}',
               main_id=main_info['user_id'],
               main_name=main_info['display_name'],
               main_access_key=main_info['keys'][0]['access_key'],
               main_secret_key=main_info['keys'][0]['secret_key'],
               alt_id=alt_info['user_id'],
               alt_name=alt_info['display_name'],
               alt_email=alt_info['email'],
               alt_access_key=alt_info['keys'][0]['access_key'],
               alt_secret_key=alt_info['keys'][0]['secret_key'],
               tenant_id=tenant_info['user_id'],
               tenant_name=tenant_info['display_name'],
               tenant_email=tenant_info['email'],
               tenant_access_key=tenant_info['keys'][0]['access_key'],
               tenant_secret_key=tenant_info['keys'][0]['secret_key'])

    log.info("s3-tests configuration: {s3_config}".format(s3_config=s3_config))
    config_file = client_node.write_file(file_name='s3-tests/config.yaml',
                                         file_mode='w')
    config_file.write(s3_config)
    config_file.flush()

    log.info("Opening port on rgw node")
    open_firewall_port(rgw_node, port=port, protocol='tcp')
Beispiel #3
0
def setup_s3_tests(client_node, rgw_node, config, build):
    """
    Performs initial setup and configuration for s3 tests on client node.

    Args:
        client_node: The node configured with 'client'
        rgw_node: The node configured with 'radosgw'
        config: test configuration
        build: rhcs4 build version

    Returns:
        None

    """
    log.info("Removing existing s3-tests directory if it exists")
    client_node.exec_command(
        cmd="if test -d s3-tests; then rm -r s3-tests; fi")

    log.info("Cloning s3-tests repository")
    branch = config.get("branch", "ceph-luminous")
    repo_url = "https://github.com/ceph/s3-tests.git"
    client_node.exec_command(cmd="git clone -b {branch} {repo_url}".format(
        branch=branch, repo_url=repo_url))

    if build.startswith("4"):
        pkgs = [
            "python2-virtualenv",
            "python2-devel",
            "libevent-devel",
            "libffi-devel",
            "libxml2-devel",
            "libxslt-devel",
            "zlib-devel",
        ]
        client_node.exec_command(cmd="cd s3-tests")
        client_node.exec_command(
            cmd="sudo yum install -y {pkgs}".format(pkgs=" ".join(pkgs)),
            check_ec=False)
        client_node.exec_command(
            cmd=
            "virtualenv -p python2 --no-site-packages --distribute virtualenv")
        client_node.exec_command(
            cmd="~/virtualenv/bin/pip install setuptools==32.3.1")
        client_node.exec_command(
            cmd="~/virtualenv/bin/pip install -r s3-tests/requirements.txt")
        client_node.exec_command(
            cmd="~/virtualenv/bin/python s3-tests/setup.py develop")
    else:
        log.info("Running bootstrap")
        client_node.exec_command(cmd="cd s3-tests; ./bootstrap", )

    setup_rgw_conf(rgw_node)
    main_info = create_s3_user(client_node, "main-user")
    alt_info = create_s3_user(client_node, "alt-user", email=True)
    tenant_info = create_s3_user(client_node, "tenant", email=True)

    log.info("Creating configuration file")
    port = "8080"
    s3_config = """
[DEFAULT]
host = {host}
port = {port}
is_secure = no

[fixtures]
bucket prefix = cephuser-{random}-

[s3 main]
user_id = {main_id}
display_name = {main_name}
access_key = {main_access_key}
secret_key = {main_secret_key}
api_name = default

[s3 alt]
user_id = {alt_id}
display_name = {alt_name}
email = {alt_email}
access_key = {alt_access_key}
secret_key = {alt_secret_key}

[s3 tenant]
user_id = {tenant_id}
display_name = {tenant_name}
email = {tenant_email}
access_key = {tenant_access_key}
secret_key = {tenant_secret_key}
    """.format(
        host=rgw_node.shortname,
        port=port,
        random="{random}",
        main_id=main_info["user_id"],
        main_name=main_info["display_name"],
        main_access_key=main_info["keys"][0]["access_key"],
        main_secret_key=main_info["keys"][0]["secret_key"],
        alt_id=alt_info["user_id"],
        alt_name=alt_info["display_name"],
        alt_email=alt_info["email"],
        alt_access_key=alt_info["keys"][0]["access_key"],
        alt_secret_key=alt_info["keys"][0]["secret_key"],
        tenant_id=tenant_info["user_id"],
        tenant_name=tenant_info["display_name"],
        tenant_email=tenant_info["email"],
        tenant_access_key=tenant_info["keys"][0]["access_key"],
        tenant_secret_key=tenant_info["keys"][0]["secret_key"],
    )

    log.info("s3-tests configuration: {s3_config}".format(s3_config=s3_config))
    config_file = client_node.write_file(file_name="s3-tests/config.yaml",
                                         file_mode="w")
    config_file.write(s3_config)
    config_file.flush()

    log.info("Opening port on rgw node")
    open_firewall_port(rgw_node, port=port, protocol="tcp")
Beispiel #4
0
def setup_s3_tests(client_node, rgw_node, config):
    """
    Performs initial setup and configuration for s3 tests on client node.

    Args:
        client_node: node to setup for s3 tests
        rgw_node: node running rados gateway
        config: test configuration

    Returns:
        None

    """
    log.info("Removing existing s3-tests directory if it exists")
    client_node.exec_command(cmd="if test -d s3-tests; then rm -r s3-tests; fi")

    log.info("Cloning s3-tests repository")
    branch = config.get('branch', 'ceph-luminous')
    repo_url = "https://github.com/ceph/s3-tests.git"
    client_node.exec_command(cmd="git clone -b {branch} {repo_url}".format(branch=branch, repo_url=repo_url))

    log.info("Running bootstrap")
    client_node.exec_command(cmd="cd s3-tests; ./bootstrap")

    main_info = create_s3_user(client_node, 'main-user')
    alt_info = create_s3_user(client_node, 'alt-user', email=True)
    tenant_info = create_s3_user(client_node, 'tenant', email=True)

    log.info("Creating configuration file")
    port = '8080'
    s3_config = '''
[DEFAULT]
host = {host}
port = {port}
is_secure = no

[fixtures]
bucket prefix = cephuser-{random}-

[s3 main]
user_id = {main_id}
display_name = {main_name}
access_key = {main_access_key}
secret_key = {main_secret_key}

[s3 alt]
user_id = {alt_id}
display_name = {alt_name}
email = {alt_email}
access_key = {alt_access_key}
secret_key = {alt_secret_key}

[s3 tenant]
user_id = {tenant_id}
display_name = {tenant_name}
email = {tenant_email}
access_key = {tenant_access_key}
secret_key = {tenant_secret_key}
    '''.format(host=rgw_node.shortname,
               port=port,
               random='{random}',
               main_id=main_info['user_id'],
               main_name=main_info['display_name'],
               main_access_key=main_info['keys'][0]['access_key'],
               main_secret_key=main_info['keys'][0]['secret_key'],
               alt_id=alt_info['user_id'],
               alt_name=alt_info['display_name'],
               alt_email=alt_info['email'],
               alt_access_key=alt_info['keys'][0]['access_key'],
               alt_secret_key=alt_info['keys'][0]['secret_key'],
               tenant_id=tenant_info['user_id'],
               tenant_name=tenant_info['display_name'],
               tenant_email=tenant_info['email'],
               tenant_access_key=tenant_info['keys'][0]['access_key'],
               tenant_secret_key=tenant_info['keys'][0]['secret_key'])

    log.info("s3-tests configuration: {s3_config}".format(s3_config=s3_config))
    config_file = client_node.write_file(file_name='s3-tests/config.yaml', file_mode='w')
    config_file.write(s3_config)
    config_file.flush()

    log.info("Opening port on rgw node")
    open_firewall_port(rgw_node, port=port, protocol='tcp')