From 641d74cb267e87a22df8f9a3d285e3ab4343ce50 Mon Sep 17 00:00:00 2001 From: Tim Beale Date: Wed, 10 Apr 2019 12:55:26 +1200 Subject: traffic_replay: Assign users to groups by default The traffic_replay script has a myriad of options, but by default when it creates user accounts it does not assign these users to any groups (you have to specify extra options to do that). This isn't really a fair test of samba performance, because it's unlikely that real world setups will have users that are in no groups (other than the default ones). This patch changes the default behaviour so that it will assign the new users to groups automatically, if no other group options were specified. Signed-off-by: Tim Beale Reviewed-by: Andrew Bartlett Reviewed-by: Andreas Schneider --- script/traffic_replay | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'script') diff --git a/script/traffic_replay b/script/traffic_replay index fab9a8ded26..0d06d1c861d 100755 --- a/script/traffic_replay +++ b/script/traffic_replay @@ -114,7 +114,7 @@ def main(): 'the traffic') user_gen_group.add_option('-n', '--number-of-users', type='int', default=0, help='Total number of test users to create') - user_gen_group.add_option('--number-of-groups', type='int', default=0, + user_gen_group.add_option('--number-of-groups', type='int', default=None, help='Create this many groups') user_gen_group.add_option('--average-groups-per-user', type='int', default=0, @@ -301,6 +301,10 @@ def main(): sys.exit(1) number_of_users = max(opts.number_of_users, len(conversations)) + + if opts.number_of_groups is None: + opts.number_of_groups = max(int(number_of_users / 10), 1) + max_memberships = number_of_users * opts.number_of_groups if not opts.group_memberships and opts.average_groups_per_user: @@ -317,6 +321,11 @@ def main(): opts.number_of_groups))) sys.exit(1) + # if no groups were specified by the user, then make sure we create some + # group memberships (otherwise it's not really a fair test) + if not opts.group_memberships and not opts.average_groups_per_user: + opts.group_memberships = min(number_of_users * 5, max_memberships) + # Get an LDB connection. try: # if we're only adding users, then it's OK to pass a sam.ldb filepath -- cgit v1.2.1