On Tue, 7 Dec 2010 13:53:53 +0100
Jan Zelený <jzel...@redhat.com> wrote:

> Simo Sorce <sso...@redhat.com> wrote:
> > This patch reduced the size of the default range (from 1 million to
> > 200.000) and also changes the way the range is selected.
> > Instead of starting at a completely random number, it selects 1 out
> > of 10000 random 200k ranges so that the range starts at multiples
> > of 200k.
> > 
> > This makes it so that 2 different installs either do not overlap at
> > all or overlap completely (once in 10k times) instead of potentially
> > partially overlapping.
> > 
> > Simo.
> 
> Do I understand correctly that this change is just to make IDs more
> readable? I don't get why two installs need to have either complete
> overlapping or no overlapping at all.

So that normally 2 installations have completely separate IDs, and a
third at most overlap with one of them but not partially with both.
Makes it easier to deal with conflicts IMO.

It also makes it somewhat easier to build tests that look at specific
patterns and aid the admin understanding the id numbers at first.

> Also, you have a typo in Rob's name ;-)

Ouch! Sorry Rob.
attached corrected version

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From 0d4ae2790f1913e32ae45ef8227110ecf1e17fc2 Mon Sep 17 00:00:00 2001
From: Simo Sorce <sso...@redhat.com>
Date: Mon, 6 Dec 2010 16:16:49 -0500
Subject: [PATCH] Give back smaller and more readable ranges by default.

Instead of allocating a completely random start between 1M and 2G and a range
of 1M values, give 10000 possible 200k ranges. They all start at a 200k
boundary so they generate more readable IDs, at least until there arent't too
many users/replicas involved.
---
 install/tools/ipa-server-install |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 020fc8ff8aa7b627ba9cb7366635c6ed4f864a79..bed9add9cbfc1634cce333d810a5dfa6d1df26c9 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -1,7 +1,9 @@
 #! /usr/bin/python -E
 # Authors: Karl MacMillan <kmacmil...@mentalrootkit.com>
+#          Simo Sorce <sso...@redhat.com>
+#          Rob Crittenden <rcrit...@redhat.com>
 #
-# Copyright (C) 2007  Red Hat
+# Copyright (C) 2007-2010  Red Hat
 # see file 'COPYING' for use and warranty information
 #
 # This program is free software; you can redistribute it and/or
@@ -60,11 +62,10 @@ from ipapython.config import IPAOptionParser
 pw_name = None
 uninstalling = False
 
-# Used to determine the the highest possible uid/gid
-MAXINT_32BIT = 2147483648
 
 def parse_options():
-    namespace = random.randint(1000000, (MAXINT_32BIT - 1000000))
+    # Guaranteed to give a random 200k range below the 2G mark (uint32_t limit)
+    namespace = random.randint(1, 10000) * 200000
     parser = IPAOptionParser(version=version.VERSION)
     parser.add_option("-u", "--user", dest="ds_user",
                       help="ds user")
@@ -177,7 +178,7 @@ def parse_options():
         parser.error("--external-cert-file must use an absolute path")
 
     if options.idmax == 0:
-        options.idmax = int(options.idstart) + 1000000 - 1
+        options.idmax = int(options.idstart) + 200000 - 1
 
     if options.idmax < options.idstart:
         parse.error("idmax (%u) cannot be smaller than idstart (%u)" %
-- 
1.7.3.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to