Skip to content

Commit

Permalink
qa/tests: use dnsmasq task which does better job of setting up cname …
Browse files Browse the repository at this point in the history
…and cleanup

Signed-off-by: Vasu Kulkarni <[email protected]>
  • Loading branch information
vasukulkarni committed Mar 30, 2018
1 parent ab9a78b commit 0a794cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 40 deletions.
9 changes: 6 additions & 3 deletions qa/suites/rgw/hadoop-s3a/s3a-hadoop.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
machine_type: ovh
openstack:
- volumes: # attached to each instance
count: 3
count: 3
size: 20 # GB
overrides:
ceph_ansible:
Expand All @@ -22,11 +22,14 @@ overrides:
ceph_origin: repository
ceph_repository: dev
roles:
- [mon.a, osd.0, osd.1, osd.2, rgw.0]
- [mon.a, osd.0, osd.1, osd.2]
- [osd.3, osd.4, osd.5]
- [osd.6, osd.7, osd.8]
- [mgr.x]
- [mon.b, mgr.x, rgw.0]

tasks:
- ssh-keys:
- ceph-ansible:
- dnsmasq:
rgw.0: [s3.ceph.com]
- s3a-hadoop:
39 changes: 2 additions & 37 deletions qa/tasks/s3a_hadoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def task(ctx, config):
bucket-name: 's3atest' (default)
access-key: 'anykey' (uses a default value)
secret-key: 'secretkey' ( uses a default value)
dnsmasq-name: 's3.ceph.com'
"""
if config is None:
config = {}
Expand All @@ -39,6 +40,7 @@ def task(ctx, config):
hadoop_ver = config.get('hadoop-version', '2.7.3')
bucket_name = config.get('bucket-name', 's3atest')
access_key = config.get('access-key', 'EGAQRD2ULOIFKFSKCT4F')
dnsmasq_name = config.get('dnsmasq-name', 's3.ceph.com')
secret_key = config.get(
'secret-key',
'zi816w1vZKfaSM85Cl0BxXTwSLyN7zB4RbTswrGb')
Expand Down Expand Up @@ -76,9 +78,7 @@ def task(ctx, config):
run.Raw(hadoop_rel)
]
)
dnsmasq_name = 's3.ceph.com'
configure_s3a(rgw_node, dnsmasq_name, access_key, secret_key, bucket_name, testdir)
setup_dnsmasq(rgw_node, dnsmasq_name)
fix_rgw_config(rgw_node, dnsmasq_name)
setup_user_bucket(rgw_node, dnsmasq_name, access_key, secret_key, bucket_name, testdir)
if hadoop_ver.startswith('2.8'):
Expand All @@ -94,10 +94,6 @@ def task(ctx, config):
log.info("Done s3a testing, Cleaning up")
for fil in ['apache*', 'hadoop*', 'venv*', 'create*']:
rgw_node.run(args=['rm', run.Raw('-rf'), run.Raw('{tdir}/{file}'.format(tdir=testdir, file=fil))])
# restart and let NM restore original config
rgw_node.run(args=['sudo', 'systemctl', 'stop', 'dnsmasq'])
rgw_node.run(args=['sudo', 'systemctl', 'restart', 'network.service'], check_status=False)
rgw_node.run(args=['sudo', 'systemctl', 'status', 'network.service'], check_status=False)


def install_prereq(client):
Expand All @@ -120,37 +116,6 @@ def install_prereq(client):
)


def setup_dnsmasq(client, name):
"""
Setup simple dnsmasq name eg: s3.ceph.com
Local RGW host can then be used with whatever name has been setup with.
"""
resolv_conf = "nameserver 127.0.0.1\n"
dnsmasq_template = """address=/{name}/{ip_address}
server=8.8.8.8
server=8.8.4.4
""".format(name=name, ip_address=client.ip_address)
dnsmasq_config_path = '/etc/dnsmasq.d/ceph'
# point resolv.conf to local dnsmasq
misc.sudo_write_file(
remote=client,
path='/etc/resolv.conf',
data=resolv_conf,
)
misc.sudo_write_file(
remote=client,
path=dnsmasq_config_path,
data=dnsmasq_template,
)
client.run(args=['cat', dnsmasq_config_path])
# restart dnsmasq
client.run(args=['sudo', 'systemctl', 'restart', 'dnsmasq'])
client.run(args=['sudo', 'systemctl', 'status', 'dnsmasq'])
time.sleep(5)
# verify dns name is set
client.run(args=['ping', '-c', '4', name])


def fix_rgw_config(client, name):
"""
Fix RGW config in ceph.conf, we need rgw dns name entry
Expand Down

0 comments on commit 0a794cf

Please sign in to comment.