-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
We recently tripled the number of interfaces in our cobbler instance,
which resulted in some fairly strange errors coming out of cobbler
sync. We (thank you John and Michael) eventually tracked it down to an
out of memory condition in manage_isc.py. I think John and Michael have
already committed speed ups for the serializer that helps the
situation. But we still had problems. Thus, I patched manage_isc.py to
not call blender so much and to cache its results a little. Instead of
calling blender twice, once for the profile and once for the system, per
interface, we now only call it once per system.
The attached patch is against devel. It should cherry-pick/apply
against sustain14 and master as the code hasn't changed.
- --
Scott Henson
Red Hat CIS Operator
WVU Alum BSAE/BSME
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora -
http://enigmail.mozdev.org
iEYEARECAAYFAknHyI4ACgkQZ+CEIfzQ+ErgNACfZ2f66lX5tB9vT36TQ9/chNtt
PNAAn1uWS1lbPzMsmwJoTNCkyv1OutFn
=hbEx
-----END PGP SIGNATURE-----
From 826c0435d8215e638361090867a2424a9fe1b6f6 Mon Sep 17 00:00:00 2001
From: Scott Henson <shenson(a)redhat.com>
Date: Mon, 23 Mar 2009 12:57:39 -0400
Subject: [PATCH] - Create a blender cache so we only blend each system once
- Pull only the needed information out of the blended system and update the template to
pull this new information
- Remove the blending of the profile as it is not needed
---
cobbler/modules/manage_isc.py | 15 +++++++++++----
templates/dhcp.template | 4 ++--
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py
index 9846314..54f9dc6 100644
--- a/cobbler/modules/manage_isc.py
+++ b/cobbler/modules/manage_isc.py
@@ -140,6 +140,7 @@ class IscManager:
settings_file = self.settings.dhcpd_conf
template_file = "/etc/cobbler/dhcp.template"
+ blender_cache = {}
try:
f2 = open(template_file,"r")
@@ -195,10 +196,6 @@ class IscManager:
ip = interface["ip_address"]
host = interface["dns_name"]
- # add references to the system, profile, and distro
- # for use in the template
- interface["system"] = utils.blender( self.api, False, system
)
- interface["profile"] = utils.blender( self.api, False, profile
)
if distro is not None:
interface["distro"] = distro.to_datastruct()
@@ -215,6 +212,16 @@ class IscManager:
else:
interface["name"] = "generic%d" % counter
+ # add references to the system, profile, and distro
+ # for use in the template
+ if blender_cache.has_key(interface["name"]):
+ blended_system = blender_cache[interface["name"]]
+ else:
+ blended_system = utils.blender( self.api, False, system )
+
+ interface["next_server"] = blended_system["server"]
+ interface["netboot_enabled"] =
blended_system["netboot_enabled"]
+
interface["filename"] = "/pxelinux.0"
# can't use pxelinux.0 anymore
if distro is not None:
diff --git a/templates/dhcp.template b/templates/dhcp.template
index c902b4f..4741770 100644
--- a/templates/dhcp.template
+++ b/templates/dhcp.template
@@ -50,12 +50,12 @@ group {
#if $iface.gateway:
option routers $iface.gateway;
#end if
- #if $iface.system.netboot_enabled:
+ #if $iface.netboot_enabled:
filename "$iface.filename";
## Cobbler defaults to $next_server, but some users
## like to use $iface.system.server for proxied setups
next-server $next_server;
- ## next-server $iface.system.server;
+ ## next-server $iface.next_server;
#end if
}
#end for
--
1.6.0.6