]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
added nfs_ganesha_rgw task and its yaml
authorrakesh <rakesh@dhcp35-53.lab.eng.blr.redhat.com>
Mon, 20 Mar 2017 06:58:09 +0000 (12:28 +0530)
committerVasu Kulkarni <vasu@redhat.com>
Tue, 5 Sep 2017 19:00:54 +0000 (12:00 -0700)
qa/suites/rgw/system/tasks/nfs_ganesha_rgw_install.yaml [new file with mode: 0644]
qa/tasks/nfs_ganesha_rgw.py [new file with mode: 0644]

diff --git a/qa/suites/rgw/system/tasks/nfs_ganesha_rgw_install.yaml b/qa/suites/rgw/system/tasks/nfs_ganesha_rgw_install.yaml
new file mode 100644 (file)
index 0000000..91c724a
--- /dev/null
@@ -0,0 +1,4 @@
+tasks:
+- ssh-keys: null
+- ceph-ansible: null
+- nfs_ganesha_rgw:
\ No newline at end of file
diff --git a/qa/tasks/nfs_ganesha_rgw.py b/qa/tasks/nfs_ganesha_rgw.py
new file mode 100644 (file)
index 0000000..82c3463
--- /dev/null
@@ -0,0 +1,162 @@
+import contextlib
+import logging
+import os
+from teuthology import misc as teuthology
+from teuthology.orchestra import run
+
+import cStringIO
+import json
+import psutil
+
+log = logging.getLogger(__name__)
+
+
+def NFS_Ganesh_RGW_config_gen(sys_conf):
+
+    ganesha_conf = '''
+                EXPORT
+                {
+                        Export_ID=77;
+                        Path = "/";
+                        Pseudo = "/";
+                        Access_Type = RW;
+                        SecType = "sys";
+                        NFS_Protocols = 4;
+                        Transport_Protocols = TCP;
+
+                        FSAL {
+                                Name = RGW;
+                                User_Id = %s;
+                                Access_Key_Id ="%s";
+                                Secret_Access_Key = "%s";
+                        }
+                }
+
+                NFSV4 {
+                    Allow_Numeric_Owners = true;
+                    Only_Numeric_Owners = true;
+                }
+
+                Cache_Inode {
+                    Dir_Max = 10000;
+                }
+
+                RGW {
+                    name = "client.rgw.%s";
+                    ceph_conf = "/etc/ceph/ceph.conf";
+                    init_args = "-d --debug-rgw=16";
+                }
+
+        ''' % (sys_conf['user_id'],
+               sys_conf['access_key'],
+                sys_conf['secret_key'],
+                sys_conf['rgw_hostname'])
+
+    return ganesha_conf
+
+
+@contextlib.contextmanager
+def task(ctx, config):
+    """
+     Install and config NFS-Ganesha and mount
+
+    """
+    if config is None:
+        config = {}
+
+    assert isinstance(config, dict), \
+        "task set-repo only supports a dictionary for configuration"
+
+    remotes = ctx.cluster.only(teuthology.is_type('client'))
+    clients = [
+        remote for remote,
+                   roles_for_host in remotes.remotes.iteritems()]
+    # clone the repo
+
+    clients[0].run(args=['sudo', 'rm', '-rf', 'nfs-ganesh-rgw'], check_status=False)
+    clients[0].run(args=['sudo', 'rm', '-rf', run.Raw('/tmp/nfs-ganesh-rgw_log*')], check_status=False)
+    clients[0].run(args=['mkdir', 'nfs-ganesha-rgw'])
+
+    # stop native nfs-ganesha service.
+
+    clients[0].run(args=['sudo', 'systemctl', 'stop', 'nfs-server.service']) # systemctl stop nfs-server.service
+    clients[0].run(args=['sudo', 'systemctl', 'disable', 'nfs-server.service']) # systemctl disable nfs-server.service
+
+    # install nfs-ganesha-rgw
+
+    # clients[0].run(args=['sudo', 'yum', 'install', 'nfs-ganesha-rgw', '-y'])
+
+    sys_conf = {}
+
+    sys_conf['rgw_hostname'] = clients[0].shortname
+
+
+    out = cStringIO.StringIO()
+    clients[0].run(args=['radosgw-admin', 'user', 'create', '--display-name="johnny rotten"', '--uid=johnny'],
+               stdout=out)
+
+    v_as_out = out.read()
+
+    v_as_json = json.loads(v_as_out)
+
+    sys_conf['user_id'] = v_as_json['user_id']
+    sys_conf['display_name'] = v_as_json['display_name']
+
+    sys_conf['access_key'] = v_as_json['keys'][0]['access_key']
+
+    sys_conf['secret_key'] = v_as_json['keys'][0]['secret_key']
+
+    ganesha_config = NFS_Ganesh_RGW_config_gen(sys_conf)
+
+    log.info('ganesha_config: %s' % ganesha_config)
+
+    # install nfs_ganesha_rgw
+
+    clients[0].run(args=['sudo', 'yum', 'install', 'nfs-ganesha-rgw', '-y'])
+
+    # backup default ganesha config file
+
+    clients[0].run(args=['sudo', 'mv', '/etc/ganesha/ganesha.conf', '/etc/ganesha/ganesha.conf.bkp'])
+
+    ganesha_config_path_on_client = '/etc/ganesha/ganesha.conf'
+
+    teuthology.sudo_write_file(clients[0],ganesha_config_path_on_client, ganesha_config)
+
+    clients[0].run(args=['cd', 'nfs-ganesha-rgw', run.Raw(';'), 'git', 'clone',
+                         'http://gitlab.osas.lab.eng.rdu2.redhat.com/ceph/ceph-qe-scripts.git', '-b', 'wip-nfs-ganesha'])
+
+    clients[0].run(args=['sudo', 'pip', 'install', 'psutil'])
+
+    # kill nfs_ganesha process
+
+    clients[0].run(args=[run.Raw('sudo python nfs-ganesha-rgw/ceph-qe-scripts/rgw/tests/nfs-ganesha/process_manage.py')])
+
+    # start the nfs_ganesha service
+
+    clients[0].run(args=['sudo', '/usr/bin/ganesha.nfsd', '-f','/etc/ganesha/ganesha.conf'])
+
+    clients[0].run(args=['mkdir', run.Raw('~/ganesha-mount')])
+
+    # mount NFS_Ganesha
+
+    clients[0].run(args=[run.Raw('sudo mount -v -t nfs -o nfsvers=4.1,sync,rw,noauto,soft,proto=tcp %s:/  %s' % (
+    clients[0].shortname, '~/ganesha-mount'))])
+
+    # run the basic IO
+
+    clients[0].run(
+        args=[run.Raw(
+            'sudo python ~/nfs-ganesha-rgw/ceph-qe-scripts/rgw/tests/nfs-ganesha/basic_io.py -c 30-4-14 -p ~/ganesha-mount -r 100')])
+
+    try:
+        yield
+    finally:
+        log.info("Deleting repo's")
+        if ctx.archive is not None:
+            path = os.path.join(ctx.archive, 'remote')
+            os.makedirs(path)
+            sub = os.path.join(path, clients[0].shortname)
+            os.makedirs(sub)
+            teuthology.pull_directory(clients[0], '/tmp/apilog',
+                                      os.path.join(sub, 'log'))
+            clients[0].run(args=['sudo', 'rm', '-rf', 'api-tests'])