[PATCH-KOAN] Trac #369 - BUG: block device not passed to installer when virt file size is unset or 0
by James Cammarata
Patch pushed up to my koan github:
commit 7489784673a1c0d958582eb271524cdb0602940d
Author: James Cammarata <jimi(a)sngx.net>
Date: Thu Mar 26 00:30:16 2009 -0500
Corrections to xen/kvm/qemu vmware creation to use block devices as the
virt disk despite the virt-size being 0
Trac Ticket #369
Essentially, it looks at the virt-disk name and if it starts with "/dev" it
ignores the size.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
[PATCH] trac ticket #396 - cobbler --gateway should validate ipv4/ipv6 address
by James Cammarata
Pushed to my cobbler git hub, branch my-devel:
commit afcf6fe446d420d8cc3cacff2f3bf5b00ceeffc8
Author: James Cammarata <jimi(a)sngx.net>
Date: Thu Mar 26 00:52:34 2009 -0500
Modifications to system object to validate the gateway IP being set.
Also modified utils.py is_ip() function to use the python netaddr IP
object for validation rather than regex. This should also handle IPv6
addresses with no additional code required.
Trac Ticket #396
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
Ticket #405 - xmlrpc api doesn't recognized when a system is deleted from the cmd line
by James Cammarata
Ok, so I've been looking into this one, and it looks like it is an issue
with delete not removing items from the cache correctly when things are
deleted from the cli. However, it looks like it was coded to:
(from cobbler/collection_systems.py, line 68):
if with_delete and not self.api.is_cobblerd:
self.api._internal_cache_update("system", name, remove=True)
I've tracked down the system removal code to the above lines as the
potential culprit, though I don't fully understand the logic behind it.
I'll try and debug this more today, but the issue is definitely cache
related, things are not being cleaned up correctly when something is
deleted.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
15 years, 1 month
Make DHCP work with bonding
by Scott Henson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If you follow the bonding examples on the wiki and in the cobbler docs,
you end up with a cobbler instance that doesn't really do dhcp. This
patch makes it work as advertised. Basically now you end up with
/etc/dhcpd.conf containing both the mac addresses for eth0 and eth1
pointing at the ip address for bond0.
A caveat, it should continue to work if you gave bond0 the mac address
of eth0 or eth1. But, if you set bonding up and just set the ip of
bond0 on eth0 to get dhcp working, this will probably break your dhcp
configs pretty silently. I'm not sure how to fix that really. I'm open
to ideas.
Patch is attached. It also contains some whitespace clean up of
manage_isc.py. If you want them separate let me know and I'll pull them
apart.
This time with the patch
- --
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
iEYEARECAAYFAknJOsgACgkQZ+CEIfzQ+Eo7eQCgoH576SuQvDKeq9gIVJ3Lkl/4
DzIAnRAa4f0aGfEjnYG9m4rlhhzw34Mm
=m5sr
-----END PGP SIGNATURE-----
>From bbf9218095459896fc97f7457a3b7218ecab5ff6 Mon Sep 17 00:00:00 2001
From: Scott Henson <shenson(a)redhat.com>
Date: Mon, 23 Mar 2009 21:34:16 -0400
Subject: [PATCH] Fix bonding when used with dhcp
- If you are a slave in a bonding configuration, get your ip address and dns_name from your master
- Change the interface name to include the interface
- Include some whitespace cleanups to manage_isc.py
---
cobbler/modules/manage_isc.py | 49 +++++++++++++++++++++-------------------
1 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/cobbler/modules/manage_isc.py b/cobbler/modules/manage_isc.py
index 54f9dc6..fa95e0d 100644
--- a/cobbler/modules/manage_isc.py
+++ b/cobbler/modules/manage_isc.py
@@ -36,7 +36,7 @@ from shlex import shlex
import utils
from cexceptions import *
-import templar
+import templar
import item_distro
import item_profile
@@ -74,14 +74,14 @@ class IscManager:
def write_dhcp_lease(self,port,host,ip,mac):
"""
- Use DHCP's API to create a DHCP entry in the
+ Use DHCP's API to create a DHCP entry in the
/var/lib/dhcpd/dhcpd.leases file
#Code from http://svn.osgdc.org/browse/kusu/kusu
# /trunk/src/kits/base/packages/kusu-base-installer/lib/kusu/nodefun.py?r=3025
# FIXME: should use subprocess
"""
if ip.find("/") != -1:
- return
+ return
try:
fromchild, tochild = popen2([self.settings.omshell_bin])
tochild.write("port %s\n" % port)
@@ -108,13 +108,13 @@ class IscManager:
def remove_dhcp_lease(self,port,host):
"""
- Use DHCP's API to delete a DHCP entry in
- the /var/lib/dhcpd/dhcpd.leases file
+ Use DHCP's API to delete a DHCP entry in
+ the /var/lib/dhcpd/dhcpd.leases file
"""
- fromchild, tochild = popen2([self.settings.omshell_bin])
- try:
+ fromchild, tochild = popen2([self.settings.omshell_bin])
+ try:
tochild.write("port %s\n" % port)
- tochild.flush()
+ tochild.flush()
tochild.write("connect\n")
tochild.flush()
tochild.write("new host\n")
@@ -131,13 +131,13 @@ class IscManager:
# FIXME: convert this to subprocess.
# FIXME: catch specific errors only (32/broken pipe)
pass
-
+
def write_dhcp_file(self):
"""
DHCP files are written when manage_dhcp is set in
/var/lib/cobbler/settings.
"""
-
+
settings_file = self.settings.dhcpd_conf
template_file = "/etc/cobbler/dhcp.template"
blender_cache = {}
@@ -153,7 +153,7 @@ class IscManager:
# use a simple counter for generating generic names where a hostname
# is not available
counter = 0
-
+
# Clean system definitions in /var/lib/dhcpd/dhcpd.leases just in
# case to avoid conflicts with the hosts we're defining and to clean
# possible removed hosts (only if using OMAPI)
@@ -183,7 +183,7 @@ class IscManager:
distro = profile.get_conceptual_parent()
# if distro is None then the profile is really an image
- # record!
+ # record!
for (name, interface) in system.interfaces.iteritems():
@@ -193,22 +193,26 @@ class IscManager:
interface["gateway"] = system.gateway
mac = interface["mac_address"]
- ip = interface["ip_address"]
- host = interface["dns_name"]
-
+ if interface["bonding"] == "slave":
+ ip = system.interfaces[interface["bonding_master"]]["ip_address"]
+ interface["ip_address"] = ip
+ host = system.interfaces[interface["bonding_master"]]["dns_name"]
+ else:
+ ip = interface["ip_address"]
+ host = interface["dns_name"]
if distro is not None:
interface["distro"] = distro.to_datastruct()
if mac is None or mac == "":
# can't write a DHCP entry for this system
- continue
-
+ continue
+
counter = counter + 1
# the label the entry after the hostname if possible
if host is not None and host != "":
- interface["name"] = host
+ interface["name"] = "%s_%s"%(host,name)
else:
interface["name"] = "generic%d" % counter
@@ -218,10 +222,10 @@ class IscManager:
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:
@@ -229,7 +233,7 @@ class IscManager:
interface["filename"] = elilo
elif distro.arch.startswith("ppc"):
interface["filename"] = yaboot
-
+
# If we have all values defined and we're using omapi,
# we will just create entries dinamically into DHCPD
# without requiring a restart (but file will be written
@@ -241,7 +245,7 @@ class IscManager:
if self.settings.omapi_enabled and self.settings.omapi_port:
self.remove_dhcp_lease(self.settings.omapi_port,host)
self.write_dhcp_lease(self.settings.omapi_port,host,ip,mac)
-
+
dhcp_tag = interface["dhcp_tag"]
if dhcp_tag == "":
dhcp_tag = "default"
@@ -274,4 +278,3 @@ class IscManager:
def get_manager(config):
return IscManager(config)
-
--
1.6.0.6
15 years, 1 month
[Patch] Speed up manage_isc
by Scott Henson
-----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
15 years, 1 month
Make DHCP work with bonding
by Scott Henson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If you follow the bonding examples on the wiki and in the cobbler docs,
you end up with a cobbler instance that doesn't really do dhcp. This
patch makes it work as advertised. Basically now you end up with
/etc/dhcpd.conf containing both the mac addresses for eth0 and eth1
pointing at the ip address for bond0.
A caveat, it should continue to work if you gave bond0 the mac address
of eth0 or eth1. But, if you set bonding up and just set the ip of
bond0 on eth0 to get dhcp working, this will probably break your dhcp
configs pretty silently. I'm not sure how to fix that really. I'm open
to ideas.
Patch is attached. It also contains some whitespace clean up of
manage_isc.py. If you want them separate let me know and I'll pull them
apart.
- --
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
iEYEARECAAYFAknJOnoACgkQZ+CEIfzQ+Er4bQCdH9kaStfIzOUyg1CwJBI8CHZA
KV8AnRejNhflftjXyrrBEKKdUAelUkX5
=ah3j
-----END PGP SIGNATURE-----
15 years, 1 month
Re: Patch queue
by Michael DeHaan
Michael DeHaan wrote:
> If I've not responded to a patch yet, or you think I've not applied it
> to the right place, please let me know.
>
> I think I'm caught up with the exception of 1 or 2 patches I had
> questions about.
>
> (Similarly, if I have asked a question and not responded with
> "applied", I'm waiting on an answer before applying... so please let
> me know.)
>
> Thanks!
>
> --Michael
>
>
>
This should have gone to -devel.
I'm learning too! :)
15 years, 1 month
[PATCH] Update _re_initrd and _re_kernel to find ppc and s390* images. Updated is_safe_to_hardlink() to use updated regular expressions for matching on kernel and initrd
by James Laska
---
cobbler/utils.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 0f34786..1ad3437 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -76,8 +76,8 @@ def _(foo):
MODULE_CACHE = {}
-_re_kernel = re.compile(r'vmlinuz(.*)')
-_re_initrd = re.compile(r'initrd(.*).img')
+_re_kernel = re.compile(r'(vmlinu[xz]|kernel.img)')
+_re_initrd = re.compile(r'(initrd(.*).img|ramdisk.image.gz)')
def setup_logger(name, is_cobblerd=False, log_level=logging.INFO, log_file="/var/log/cobbler/cobbler.log"):
if is_cobblerd:
@@ -871,9 +871,9 @@ def is_safe_to_hardlink(src,dst,api):
# note: this is very cobbler implementation specific!
if not api.is_selinux_enabled():
return True
- if src.find("initrd") != -1:
+ if _re_initrd.match(os.path.basename(path1)):
return True
- if src.find("vmlinuz") != -1:
+ if _re_kernel.match(os.path.basename(path1)):
return True
# we're dealing with SELinux and files that are not safe to chcon
return False
--
1.6.0.6
15 years, 1 month
[PATCH] Incorrect indentation
by James Laska
---
cobbler/utils.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cobbler/utils.py b/cobbler/utils.py
index eaab805..0f34786 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -901,7 +901,7 @@ def linkfile(src, dst, symlink_ok=False, api=None, verbose=False):
# as previous implementations were not complete
if verbose:
print "- removing: %s" % dst
- os.remove(dst)
+ os.remove(dst)
else:
# restorecon(dst,api=api,verbose=verbose)
return True
--
1.6.0.6
15 years, 1 month