mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
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>
This commit is contained in:
parent
826e37218d
commit
641d74cb26
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user