diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2019-04-10 12:55:26 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-04-30 23:18:28 +0000 |
commit | 641d74cb267e87a22df8f9a3d285e3ab4343ce50 (patch) | |
tree | 0e6475cc4d084f2faf90a328a3201001e7e30ec1 /script | |
parent | 826e37218df691f42c79b4cce693853b5af9ddc9 (diff) | |
download | samba-641d74cb267e87a22df8f9a3d285e3ab4343ce50.tar.gz |
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 <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'script')
-rwxr-xr-x | script/traffic_replay | 11 |
1 files changed, 10 insertions, 1 deletions
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 |