def test(yaml_file_path): ganesha_test_config = { "mount_point": "ganesha-mount", "rgw_user_info": yaml_file_path, } log.info("ganesha_test_config :%s\n" % ganesha_test_config) log.info("initiating nfs ganesha") add_io_info = AddIOInfo() add_io_info.initialize() nfs_ganesha = PrepNFSGanesha( mount_point=ganesha_test_config["mount_point"], yaml_fname=ganesha_test_config["rgw_user_info"], ) nfs_ganesha.initialize() config = Config() config.bucket_count = 5 config.objects_count = 2 config.objects_size_range = {"min": 10, "max": 50} log.info("begin IO") rgw_user = nfs_ganesha.read_config() rgw = ObjectOps(config, rgw_user) buckets = rgw.create_bucket() rgw.upload(buckets) time.sleep(20) bdir = BaseDir( count=None, json_fname=rgw.json_file_upload, mount_point=ganesha_test_config["mount_point"], auth=rgw.connection, ) subd = SubdirAndObjects( base_dir_list=None, config=None, json_fname=rgw.json_file_upload, auth=rgw.connection, ) time.sleep(15) log.info("verification starts") log.info("bucket verification starts") bstatus = bdir.verify_nfs() log.info("bucket verification complete:%s" % bstatus) log.info("key verificaion starts") kstatus = subd.verify_nfs(mount_point=ganesha_test_config["mount_point"]) log.info("key verification complete: %s" % kstatus) verification = {"bucket": True, "key": True} if not bstatus: verification["bucket"] = False else: verification["bucket"] = True for ks in kstatus: if not ks["exists"]: verification["key"] = False if not ks["md5_matched"]: verification["key"] = False break if not ks["size_matched"]: verification["key"] = False break return verification
def test(yaml_file_path): ganesha_test_config = {'mount_point': 'ganesha-mount', 'rgw_user_info': yaml_file_path} log.info('ganesha_test_config :%s\n' % ganesha_test_config) log.info('initiating nfs ganesha') add_io_info = AddIOInfo() add_io_info.initialize() nfs_ganesha = PrepNFSGanesha(mount_point=ganesha_test_config['mount_point'], yaml_fname=ganesha_test_config['rgw_user_info']) nfs_ganesha.initialize() config = Config() config.bucket_count = 5 config.objects_count = 2 config.objects_size_range = {'min': 10, 'max': 50} log.info('begin IO') rgw_user = nfs_ganesha.read_config() rgw = ObjectOps(config, rgw_user) buckets = rgw.create_bucket() rgw.upload(buckets) time.sleep(20) bdir = BaseDir(count=None, json_fname=rgw.json_file_upload, mount_point=ganesha_test_config['mount_point'], auth=rgw.connection) subd = SubdirAndObjects(base_dir_list=None, config=None, json_fname=rgw.json_file_upload, auth=rgw.connection) time.sleep(15) log.info('verification starts') log.info('bucket verification starts') bstatus = bdir.verify_nfs() log.info('bucket verification complete:%s' % bstatus) log.info('key verificaion starts') kstatus = subd.verify_nfs(mount_point=ganesha_test_config['mount_point']) log.info('key verification complete: %s' % kstatus) verification = {'bucket': True, 'key': True} if not bstatus: verification['bucket'] = False else: verification['bucket'] = True for ks in kstatus: if not ks['exists']: verification['key'] = False if not ks['md5_matched']: verification['key'] = False break if not ks['size_matched']: verification['key'] = False break return verification