Since current kernel options (kopts) in cobbler are only for installer's
kernel and are not propagating to installed system, a new option for
passing kernel parameters for installed kernel is needed for the purpose.
Here's a patch that adds kernel_option_post variable which is available
in templating. Second one is a snippet that calls grubby in kickstart's
%post section to pass the options to grub's kernel line.
-Lassi
diff --git a/cobbler/collection.py b/cobbler/collection.py
index 04d891a..72f454c 100644
--- a/cobbler/collection.py
+++ b/cobbler/collection.py
@@ -91,6 +91,7 @@ class Collection(serializable.Serializable):
SEARCH_REKEY = {
'kopts' : 'kernel_options',
+ 'kopts_post' : 'kernel_options_post',
'ksmeta' : 'ks_meta',
'inherit' : 'parent',
'ip' : 'ip_address',
diff --git a/cobbler/item.py b/cobbler/item.py
index 9ddfc95..e54399a 100644
--- a/cobbler/item.py
+++ b/cobbler/item.py
@@ -149,6 +149,22 @@ class Item(serializable.Serializable):
self.kernel_options = value
return True
+ def set_kernel_options_post(self,options,inplace=False):
+ """
+ Post kernel options are a space delimited list,
+ like 'a=b c=d e=f g h i=j' or a hash.
+ """
+ (success, value) = utils.input_string_or_hash(options,None)
+ if not success:
+ raise CX(_("invalid post kernel options"))
+ else:
+ if inplace:
+ for key in value.keys():
+ self.kernel_options_post[key] = value[key]
+ else:
+ self.kernel_options_post = value
+ return True
+
def set_ksmeta(self,options,inplace=False):
"""
A comma delimited list of key value pairs, like 'a=b,c=d,e=f' or a hash.
diff --git a/cobbler/item_distro.py b/cobbler/item_distro.py
index 744bb6d..e434c46 100644
--- a/cobbler/item_distro.py
+++ b/cobbler/item_distro.py
@@ -31,16 +31,17 @@ class Distro(item.Item):
"""
Reset this object.
"""
- self.name = None
- self.owners = self.settings.default_ownership
- self.kernel = (None, '<<inherit>>')[is_subobject]
- self.initrd = (None, '<<inherit>>')[is_subobject]
- self.kernel_options = ({}, '<<inherit>>')[is_subobject]
- self.ks_meta = ({}, '<<inherit>>')[is_subobject]
- self.arch = ('i386', '<<inherit>>')[is_subobject]
- self.breed = ('redhat', '<<inherit>>')[is_subobject]
- self.source_repos = ([], '<<inherit>>')[is_subobject]
- self.depth = 0
+ self.name = None
+ self.owners = self.settings.default_ownership
+ self.kernel = (None, '<<inherit>>')[is_subobject]
+ self.initrd = (None, '<<inherit>>')[is_subobject]
+ self.kernel_options = ({}, '<<inherit>>')[is_subobject]
+ self.kernel_options_post = ({}, '<<inherit>>')[is_subobject]
+ self.ks_meta = ({}, '<<inherit>>')[is_subobject]
+ self.arch = ('i386', '<<inherit>>')[is_subobject]
+ self.breed = ('redhat', '<<inherit>>')[is_subobject]
+ self.source_repos = ([], '<<inherit>>')[is_subobject]
+ self.depth = 0
def make_clone(self):
ds = self.to_datastruct()
@@ -59,17 +60,18 @@ class Distro(item.Item):
"""
Modify this object to take on values in seed_data
"""
- self.parent = self.load_item(seed_data,'parent')
- self.name = self.load_item(seed_data,'name')
- self.owners = self.load_item(seed_data,'owners',self.settings.default_ownership)
- self.kernel = self.load_item(seed_data,'kernel')
- self.initrd = self.load_item(seed_data,'initrd')
- self.kernel_options = self.load_item(seed_data,'kernel_options')
- self.ks_meta = self.load_item(seed_data,'ks_meta')
- self.arch = self.load_item(seed_data,'arch','i386')
- self.breed = self.load_item(seed_data,'breed','redhat')
- self.source_repos = self.load_item(seed_data,'source_repos',[])
- self.depth = self.load_item(seed_data,'depth',0)
+ self.parent = self.load_item(seed_data,'parent')
+ self.name = self.load_item(seed_data,'name')
+ self.owners = self.load_item(seed_data,'owners',self.settings.default_ownership)
+ self.kernel = self.load_item(seed_data,'kernel')
+ self.initrd = self.load_item(seed_data,'initrd')
+ self.kernel_options = self.load_item(seed_data,'kernel_options')
+ self.kernel_options_post = self.load_item(seed_data,'kernel_options_post')
+ self.ks_meta = self.load_item(seed_data,'ks_meta')
+ self.arch = self.load_item(seed_data,'arch','i386')
+ self.breed = self.load_item(seed_data,'breed','redhat')
+ self.source_repos = self.load_item(seed_data,'source_repos',[])
+ self.depth = self.load_item(seed_data,'depth',0)
# backwards compatibility enforcement
self.set_arch(self.arch)
@@ -160,17 +162,18 @@ class Distro(item.Item):
Return a serializable datastructure representation of this object.
"""
return {
- 'name' : self.name,
- 'kernel' : self.kernel,
- 'initrd' : self.initrd,
- 'kernel_options' : self.kernel_options,
- 'ks_meta' : self.ks_meta,
- 'arch' : self.arch,
- 'breed' : self.breed,
- 'source_repos' : self.source_repos,
- 'parent' : self.parent,
- 'depth' : self.depth,
- 'owners' : self.owners
+ 'name' : self.name,
+ 'kernel' : self.kernel,
+ 'initrd' : self.initrd,
+ 'kernel_options' : self.kernel_options,
+ 'kernel_options_post' : self.kernel_options_post,
+ 'ks_meta' : self.ks_meta,
+ 'arch' : self.arch,
+ 'breed' : self.breed,
+ 'source_repos' : self.source_repos,
+ 'parent' : self.parent,
+ 'depth' : self.depth,
+ 'owners' : self.owners
}
def printable(self):
@@ -179,26 +182,28 @@ class Distro(item.Item):
"""
kstr = utils.find_kernel(self.kernel)
istr = utils.find_initrd(self.initrd)
- buf = _("distro : %s\n") % self.name
- buf = buf + _("breed : %s\n") % self.breed
- buf = buf + _("architecture : %s\n") % self.arch
- buf = buf + _("initrd : %s\n") % istr
- buf = buf + _("kernel : %s\n") % kstr
- buf = buf + _("kernel options : %s\n") % self.kernel_options
- buf = buf + _("ks metadata : %s\n") % self.ks_meta
- buf = buf + _("owners : %s\n") % self.owners
+ buf = _("distro : %s\n") % self.name
+ buf = buf + _("breed : %s\n") % self.breed
+ buf = buf + _("architecture : %s\n") % self.arch
+ buf = buf + _("initrd : %s\n") % istr
+ buf = buf + _("kernel : %s\n") % kstr
+ buf = buf + _("kernel options : %s\n") % self.kernel_options
+ buf = buf + _("post kernel options : %s\n") % self.kernel_options_post
+ buf = buf + _("ks metadata : %s\n") % self.ks_meta
+ buf = buf + _("owners : %s\n") % self.owners
return buf
def remote_methods(self):
return {
- 'name' : self.set_name,
- 'kernel' : self.set_kernel,
- 'initrd' : self.set_initrd,
- 'kopts' : self.set_kernel_options,
- 'arch' : self.set_arch,
- 'ksmeta' : self.set_ksmeta,
- 'breed' : self.set_breed,
- 'owners' : self.set_owners
+ 'name' : self.set_name,
+ 'kernel' : self.set_kernel,
+ 'initrd' : self.set_initrd,
+ 'kopts' : self.set_kernel_options,
+ 'kopts_post' : self.set_kernel_options_post,
+ 'arch' : self.set_arch,
+ 'ksmeta' : self.set_ksmeta,
+ 'breed' : self.set_breed,
+ 'owners' : self.set_owners
}
diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py
index 0e16f46..b87d0db 100644
--- a/cobbler/item_profile.py
+++ b/cobbler/item_profile.py
@@ -33,40 +33,42 @@ class Profile(item.Item):
"""
Reset this object.
"""
- self.name = None
- self.owners = self.settings.default_ownership
- self.distro = (None, '<<inherit>>')[is_subobject]
- self.kickstart = (self.settings.default_kickstart , '<<inherit>>')[is_subobject]
- self.kernel_options = ({}, '<<inherit>>')[is_subobject]
- self.ks_meta = ({}, '<<inherit>>')[is_subobject]
- self.virt_cpus = (1, '<<inherit>>')[is_subobject]
- self.virt_file_size = (self.settings.default_virt_file_size, '<<inherit>>')[is_subobject]
- self.virt_ram = (self.settings.default_virt_ram, '<<inherit>>')[is_subobject]
- self.repos = ([], '<<inherit>>')[is_subobject]
- self.depth = 1
- self.virt_type = (self.settings.default_virt_type, '<<inherit>>')[is_subobject]
- self.virt_path = ("", '<<inherit>>')[is_subobject]
- self.virt_bridge = (self.settings.default_virt_bridge, '<<inherit>>')[is_subobject]
- self.dhcp_tag = ("default", '<<inherit>>')[is_subobject]
- self.parent = ''
- self.server = "<<inherit>>"
+ self.name = None
+ self.owners = self.settings.default_ownership
+ self.distro = (None, '<<inherit>>')[is_subobject]
+ self.kickstart = (self.settings.default_kickstart , '<<inherit>>')[is_subobject]
+ self.kernel_options = ({}, '<<inherit>>')[is_subobject]
+ self.kernel_options_post = ({}, '<<inherit>>')[is_subobject]
+ self.ks_meta = ({}, '<<inherit>>')[is_subobject]
+ self.virt_cpus = (1, '<<inherit>>')[is_subobject]
+ self.virt_file_size = (self.settings.default_virt_file_size, '<<inherit>>')[is_subobject]
+ self.virt_ram = (self.settings.default_virt_ram, '<<inherit>>')[is_subobject]
+ self.repos = ([], '<<inherit>>')[is_subobject]
+ self.depth = 1
+ self.virt_type = (self.settings.default_virt_type, '<<inherit>>')[is_subobject]
+ self.virt_path = ("", '<<inherit>>')[is_subobject]
+ self.virt_bridge = (self.settings.default_virt_bridge, '<<inherit>>')[is_subobject]
+ self.dhcp_tag = ("default", '<<inherit>>')[is_subobject]
+ self.parent = ''
+ self.server = "<<inherit>>"
def from_datastruct(self,seed_data):
"""
Load this object's properties based on seed_data
"""
- self.parent = self.load_item(seed_data,'parent','')
- self.name = self.load_item(seed_data,'name')
- self.owners = self.load_item(seed_data,'owners',self.settings.default_ownership)
- self.distro = self.load_item(seed_data,'distro')
- self.kickstart = self.load_item(seed_data,'kickstart')
- self.kernel_options = self.load_item(seed_data,'kernel_options')
- self.ks_meta = self.load_item(seed_data,'ks_meta')
- self.repos = self.load_item(seed_data,'repos', [])
- self.depth = self.load_item(seed_data,'depth', 1)
- self.dhcp_tag = self.load_item(seed_data,'dhcp_tag', 'default')
- self.server = self.load_item(seed_data,'server', '<<inherit>>')
+ self.parent = self.load_item(seed_data,'parent','')
+ self.name = self.load_item(seed_data,'name')
+ self.owners = self.load_item(seed_data,'owners',self.settings.default_ownership)
+ self.distro = self.load_item(seed_data,'distro')
+ self.kickstart = self.load_item(seed_data,'kickstart')
+ self.kernel_options = self.load_item(seed_data,'kernel_options')
+ self.kernel_options_post = self.load_item(seed_data,'kernel_options_post')
+ self.ks_meta = self.load_item(seed_data,'ks_meta')
+ self.repos = self.load_item(seed_data,'repos', [])
+ self.depth = self.load_item(seed_data,'depth', 1)
+ self.dhcp_tag = self.load_item(seed_data,'dhcp_tag', 'default')
+ self.server = self.load_item(seed_data,'server', '<<inherit>>')
# backwards compatibility
if type(self.repos) != list:
@@ -214,23 +216,24 @@ class Profile(item.Item):
Return hash representation for the serializer
"""
return {
- 'name' : self.name,
- 'owners' : self.owners,
- 'distro' : self.distro,
- 'kickstart' : self.kickstart,
- 'kernel_options' : self.kernel_options,
- 'virt_file_size' : self.virt_file_size,
- 'virt_ram' : self.virt_ram,
- 'virt_bridge' : self.virt_bridge,
- 'virt_cpus' : self.virt_cpus,
- 'ks_meta' : self.ks_meta,
- 'repos' : self.repos,
- 'parent' : self.parent,
- 'depth' : self.depth,
- 'virt_type' : self.virt_type,
- 'virt_path' : self.virt_path,
- 'dhcp_tag' : self.dhcp_tag,
- 'server' : self.server,
+ 'name' : self.name,
+ 'owners' : self.owners,
+ 'distro' : self.distro,
+ 'kickstart' : self.kickstart,
+ 'kernel_options' : self.kernel_options,
+ 'kernel_options_post' : self.kernel_options_post,
+ 'virt_file_size' : self.virt_file_size,
+ 'virt_ram' : self.virt_ram,
+ 'virt_bridge' : self.virt_bridge,
+ 'virt_cpus' : self.virt_cpus,
+ 'ks_meta' : self.ks_meta,
+ 'repos' : self.repos,
+ 'parent' : self.parent,
+ 'depth' : self.depth,
+ 'virt_type' : self.virt_type,
+ 'virt_path' : self.virt_path,
+ 'dhcp_tag' : self.dhcp_tag,
+ 'server' : self.server,
}
@@ -238,24 +241,25 @@ class Profile(item.Item):
"""
A human readable representaton
"""
- buf = _("profile : %s\n") % self.name
+ buf = _("profile : %s\n") % self.name
if self.distro == "<<inherit>>":
- buf = buf + _("parent : %s\n") % self.parent
+ buf = buf + _("parent : %s\n") % self.parent
else:
- buf = buf + _("distro : %s\n") % self.distro
- buf = buf + _("dhcp tag : %s\n") % self.dhcp_tag
- buf = buf + _("kernel options : %s\n") % self.kernel_options
- buf = buf + _("kickstart : %s\n") % self.kickstart
- buf = buf + _("ks metadata : %s\n") % self.ks_meta
- buf = buf + _("owners : %s\n") % self.owners
- buf = buf + _("repos : %s\n") % self.repos
- buf = buf + _("server : %s\n") % self.server
- buf = buf + _("virt bridge : %s\n") % self.virt_bridge
- buf = buf + _("virt cpus : %s\n") % self.virt_cpus
- buf = buf + _("virt file size : %s\n") % self.virt_file_size
- buf = buf + _("virt path : %s\n") % self.virt_path
- buf = buf + _("virt ram : %s\n") % self.virt_ram
- buf = buf + _("virt type : %s\n") % self.virt_type
+ buf = buf + _("distro : %s\n") % self.distro
+ buf = buf + _("dhcp tag : %s\n") % self.dhcp_tag
+ buf = buf + _("kernel options : %s\n") % self.kernel_options
+ buf = buf + _("post kernel options : %s\n") % self.kernel_options_post
+ buf = buf + _("kickstart : %s\n") % self.kickstart
+ buf = buf + _("ks metadata : %s\n") % self.ks_meta
+ buf = buf + _("owners : %s\n") % self.owners
+ buf = buf + _("repos : %s\n") % self.repos
+ buf = buf + _("server : %s\n") % self.server
+ buf = buf + _("virt bridge : %s\n") % self.virt_bridge
+ buf = buf + _("virt cpus : %s\n") % self.virt_cpus
+ buf = buf + _("virt file size : %s\n") % self.virt_file_size
+ buf = buf + _("virt path : %s\n") % self.virt_path
+ buf = buf + _("virt ram : %s\n") % self.virt_ram
+ buf = buf + _("virt type : %s\n") % self.virt_type
return buf
@@ -267,6 +271,7 @@ class Profile(item.Item):
'distro' : self.set_distro,
'kickstart' : self.set_kickstart,
'kopts' : self.set_kernel_options,
+ 'kopts_post' : self.set_kernel_options_post,
'virt-file-size' : self.set_virt_file_size,
'virt-ram' : self.set_virt_ram,
'ksmeta' : self.set_ksmeta,
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
index 15d8fae..1cb3746 100644
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -29,25 +29,26 @@ class System(item.Item):
return cloned
def clear(self,is_subobject=False):
- self.name = None
- self.owners = self.settings.default_ownership
- self.profile = None
- self.image = None
- self.kernel_options = {}
- self.ks_meta = {}
- self.interfaces = {}
- self.netboot_enabled = True
- self.depth = 2
- self.kickstart = "<<inherit>>" # use value in profile
- self.server = "<<inherit>>" # "" (or settings)
- self.virt_path = "<<inherit>>" # ""
- self.virt_type = "<<inherit>>" # ""
- self.virt_cpus = "<<inherit>>" # ""
- self.virt_file_size = "<<inherit>>" # ""
- self.virt_ram = "<<inherit>>" # ""
- self.virt_type = "<<inherit>>" # ""
- self.virt_path = "<<inherit>>" # ""
- self.virt_bridge = "<<inherit>>" # ""
+ self.name = None
+ self.owners = self.settings.default_ownership
+ self.profile = None
+ self.image = None
+ self.kernel_options = {}
+ self.kernel_options_post = {}
+ self.ks_meta = {}
+ self.interfaces = {}
+ self.netboot_enabled = True
+ self.depth = 2
+ self.kickstart = "<<inherit>>" # use value in profile
+ self.server = "<<inherit>>" # "" (or settings)
+ self.virt_path = "<<inherit>>" # ""
+ self.virt_type = "<<inherit>>" # ""
+ self.virt_cpus = "<<inherit>>" # ""
+ self.virt_file_size = "<<inherit>>" # ""
+ self.virt_ram = "<<inherit>>" # ""
+ self.virt_type = "<<inherit>>" # ""
+ self.virt_path = "<<inherit>>" # ""
+ self.virt_bridge = "<<inherit>>" # ""
def delete_interface(self,name):
"""
@@ -86,17 +87,18 @@ class System(item.Item):
# and store (in-memory) in the new format.
# (the main complexity here is the migration to NIC data structures)
- self.parent = self.load_item(seed_data, 'parent')
- self.name = self.load_item(seed_data, 'name')
- self.owners = self.load_item(seed_data, 'owners', self.settings.default_ownership)
- self.profile = self.load_item(seed_data, 'profile')
- self.image = self.load_item(seed_data, 'image')
- self.kernel_options = self.load_item(seed_data, 'kernel_options', {})
- self.ks_meta = self.load_item(seed_data, 'ks_meta', {})
- self.depth = self.load_item(seed_data, 'depth', 2)
- self.kickstart = self.load_item(seed_data, 'kickstart', '<<inherit>>')
- self.netboot_enabled = self.load_item(seed_data, 'netboot_enabled', True)
- self.server = self.load_item(seed_data, 'server', '<<inherit>>')
+ self.parent = self.load_item(seed_data, 'parent')
+ self.name = self.load_item(seed_data, 'name')
+ self.owners = self.load_item(seed_data, 'owners', self.settings.default_ownership)
+ self.profile = self.load_item(seed_data, 'profile')
+ self.image = self.load_item(seed_data, 'image')
+ self.kernel_options = self.load_item(seed_data, 'kernel_options', {})
+ self.kernel_options_post = self.load_item(seed_data, 'kernel_options_post', {})
+ self.ks_meta = self.load_item(seed_data, 'ks_meta', {})
+ self.depth = self.load_item(seed_data, 'depth', 2)
+ self.kickstart = self.load_item(seed_data, 'kickstart', '<<inherit>>')
+ self.netboot_enabled = self.load_item(seed_data, 'netboot_enabled', True)
+ self.server = self.load_item(seed_data, 'server', '<<inherit>>')
# virt specific
self.virt_path = self.load_item(seed_data, 'virt_path', '<<inherit>>')
@@ -392,44 +394,46 @@ class System(item.Item):
def to_datastruct(self):
return {
- 'name' : self.name,
- 'kernel_options' : self.kernel_options,
- 'depth' : self.depth,
- 'interfaces' : self.interfaces,
- 'ks_meta' : self.ks_meta,
- 'kickstart' : self.kickstart,
- 'netboot_enabled' : self.netboot_enabled,
- 'owners' : self.owners,
- 'parent' : self.parent,
- 'profile' : self.profile,
- 'image' : self.image,
- 'server' : self.server,
- 'virt_cpus' : self.virt_cpus,
- 'virt_bridge' : self.virt_bridge,
- 'virt_file_size' : self.virt_file_size,
- 'virt_path' : self.virt_path,
- 'virt_ram' : self.virt_ram,
- 'virt_type' : self.virt_type
+ 'name' : self.name,
+ 'kernel_options' : self.kernel_options,
+ 'kernel_options_post' : self.kernel_options_post,
+ 'depth' : self.depth,
+ 'interfaces' : self.interfaces,
+ 'ks_meta' : self.ks_meta,
+ 'kickstart' : self.kickstart,
+ 'netboot_enabled' : self.netboot_enabled,
+ 'owners' : self.owners,
+ 'parent' : self.parent,
+ 'profile' : self.profile,
+ 'image' : self.image,
+ 'server' : self.server,
+ 'virt_cpus' : self.virt_cpus,
+ 'virt_bridge' : self.virt_bridge,
+ 'virt_file_size' : self.virt_file_size,
+ 'virt_path' : self.virt_path,
+ 'virt_ram' : self.virt_ram,
+ 'virt_type' : self.virt_type
}
def printable(self):
- buf = _("system : %s\n") % self.name
- buf = buf + _("profile : %s\n") % self.profile
- buf = buf + _("image : %s\n") % self.image
- buf = buf + _("kernel options : %s\n") % self.kernel_options
- buf = buf + _("kickstart : %s\n") % self.kickstart
- buf = buf + _("ks metadata : %s\n") % self.ks_meta
-
- buf = buf + _("netboot enabled? : %s\n") % self.netboot_enabled
- buf = buf + _("owners : %s\n") % self.owners
- buf = buf + _("server : %s\n") % self.server
+ buf = _("system : %s\n") % self.name
+ buf = buf + _("profile : %s\n") % self.profile
+ buf = buf + _("image : %s\n") % self.image
+ buf = buf + _("kernel options : %s\n") % self.kernel_options
+ buf = buf + _("kernel options post : %s\n") % self.kernel_options_post
+ buf = buf + _("kickstart : %s\n") % self.kickstart
+ buf = buf + _("ks metadata : %s\n") % self.ks_meta
+
+ buf = buf + _("netboot enabled? : %s\n") % self.netboot_enabled
+ buf = buf + _("owners : %s\n") % self.owners
+ buf = buf + _("server : %s\n") % self.server
- buf = buf + _("virt cpus : %s\n") % self.virt_cpus
- buf = buf + _("virt file size : %s\n") % self.virt_file_size
- buf = buf + _("virt path : %s\n") % self.virt_path
- buf = buf + _("virt ram : %s\n") % self.virt_ram
- buf = buf + _("virt type : %s\n") % self.virt_type
+ buf = buf + _("virt cpus : %s\n") % self.virt_cpus
+ buf = buf + _("virt file size : %s\n") % self.virt_file_size
+ buf = buf + _("virt path : %s\n") % self.virt_path
+ buf = buf + _("virt ram : %s\n") % self.virt_ram
+ buf = buf + _("virt type : %s\n") % self.virt_type
counter = 0
@@ -469,6 +473,7 @@ class System(item.Item):
'profile' : self.set_profile,
'image' : self.set_image,
'kopts' : self.set_kernel_options,
+ 'kopts_post' : self.set_kernel_options_post,
'ksmeta' : self.set_ksmeta,
'hostname' : self.set_hostname,
'kickstart' : self.set_kickstart,
diff --git a/cobbler/modules/cli_distro.py b/cobbler/modules/cli_distro.py
index 853b51d..d971fa7 100644
--- a/cobbler/modules/cli_distro.py
+++ b/cobbler/modules/cli_distro.py
@@ -43,10 +43,11 @@ class DistroFunction(commands.CobblerFunction):
if self.matches_args(args,["add"]):
p.add_option("--clobber", dest="clobber", help="allow add to overwrite existing objects", action="store_true")
if not self.matches_args(args,["dumpvars","remove","report","list"]):
- p.add_option("--initrd", dest="initrd", help="absolute path to initrd.img (REQUIRED)")
- p.add_option("--kernel", dest="kernel", help="absolute path to vmlinuz (REQUIRED)")
- p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'")
- p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
+ p.add_option("--initrd", dest="initrd", help="absolute path to initrd.img (REQUIRED)")
+ p.add_option("--kernel", dest="kernel", help="absolute path to vmlinuz (REQUIRED)")
+ p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'")
+ p.add_option("--kopts-post", dest="kopts_post", help="ex: 'clocksource=pit'")
+ p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
if not self.matches_args(args,["find"]):
p.add_option("--in-place", action="store_true", default=False, dest="inplace", help="edit items in kopts or ksmeta without clearing the other items")
@@ -85,6 +86,8 @@ class DistroFunction(commands.CobblerFunction):
obj.set_initrd(self.options.initrd)
if self.options.kopts:
obj.set_kernel_options(self.options.kopts,self.options.inplace)
+ if self.options.kopts_post:
+ obj.set_kernel_options_post(self.options.kopts_post,self.options.inplace)
if self.options.ksmeta:
obj.set_ksmeta(self.options.ksmeta,self.options.inplace)
if self.options.breed:
diff --git a/cobbler/modules/cli_profile.py b/cobbler/modules/cli_profile.py
index 25ca635..a9de7a6 100644
--- a/cobbler/modules/cli_profile.py
+++ b/cobbler/modules/cli_profile.py
@@ -43,14 +43,15 @@ class ProfileFunction(commands.CobblerFunction):
if not self.matches_args(args,["dumpvars","remove","report","list"]):
- p.add_option("--distro", dest="distro", help="ex: 'RHEL-5-i386' (REQUIRED)")
- p.add_option("--dhcp-tag", dest="dhcp_tag", help="for use in advanced DHCP configuration")
- p.add_option("--inherit", dest="inherit", help="inherit from this profile name, defaults to no")
+ p.add_option("--distro", dest="distro", help="ex: 'RHEL-5-i386' (REQUIRED)")
+ p.add_option("--dhcp-tag", dest="dhcp_tag", help="for use in advanced DHCP configuration")
+ p.add_option("--inherit", dest="inherit", help="inherit from this profile name, defaults to no")
p.add_option("--kickstart", dest="kickstart", help="absolute path to kickstart template (RECOMMENDED)")
- p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
- p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'")
+ p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
+ p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'")
+ p.add_option("--kopts-post", dest="kopts_post",help="ex: 'clocksource=pit'")
if not self.matches_args(args,["find"]):
- p.add_option("--in-place",action="store_true", dest="inplace", default=False, help="edit items in kopts or ksmeta without clearing the other items")
+ p.add_option("--in-place",action="store_true", dest="inplace", default=False, help="edit items in kopts, kopts_post or ksmeta without clearing the other items")
p.add_option("--name", dest="name", help="a name for the profile (REQUIRED)")
@@ -99,6 +100,7 @@ class ProfileFunction(commands.CobblerFunction):
if self.options.distro: obj.set_distro(self.options.distro)
if self.options.kickstart: obj.set_kickstart(self.options.kickstart)
if self.options.kopts: obj.set_kernel_options(self.options.kopts,self.options.inplace)
+ if self.options.kopts_post: obj.set_kernel_options_post(self.options.kopts_post,self.options.inplace)
if self.options.ksmeta: obj.set_ksmeta(self.options.ksmeta,self.options.inplace)
if self.options.virt_file_size: obj.set_virt_file_size(self.options.virt_file_size)
if self.options.virt_ram: obj.set_virt_ram(self.options.virt_ram)
diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py
index fbf40cb..4c7bb67 100644
--- a/cobbler/modules/cli_system.py
+++ b/cobbler/modules/cli_system.py
@@ -51,10 +51,11 @@ class SystemFunction(commands.CobblerFunction):
p.add_option("--ip", dest="ip", help="ex: 192.168.1.55, (RECOMMENDED)")
p.add_option("--kickstart", dest="kickstart", help="override profile kickstart template")
p.add_option("--kopts", dest="kopts", help="ex: 'noipv6'")
+ p.add_option("--kopts-post", dest="kopts_post", help="ex: 'clocksource=pit'")
p.add_option("--ksmeta", dest="ksmeta", help="ex: 'blippy=7'")
p.add_option("--mac", dest="mac", help="ex: 'AA:BB:CC:DD:EE:FF', (RECOMMENDED)")
if not self.matches_args(args, ["find"]):
- p.add_option("--in-place", action="store_true", default=False, dest="inplace", help="edit items in kopts or ksmeta without clearing the other items")
+ p.add_option("--in-place", action="store_true", default=False, dest="inplace", help="edit items in kopts, kopts_post or ksmeta without clearing the other items")
p.add_option("--name", dest="name", help="a name for the system (REQUIRED)")
@@ -101,6 +102,7 @@ class SystemFunction(commands.CobblerFunction):
if self.options.profile: obj.set_profile(self.options.profile)
if self.options.image: obj.set_image(self.options.image)
if self.options.kopts: obj.set_kernel_options(self.options.kopts,self.options.inplace)
+ if self.options.kopts_post: obj.set_kernel_options_post(self.options.kopts_post,self.options.inplace)
if self.options.ksmeta: obj.set_ksmeta(self.options.ksmeta,self.options.inplace)
if self.options.kickstart: obj.set_kickstart(self.options.kickstart)
if self.options.netboot_enabled: obj.set_netboot_enabled(self.options.netboot_enabled)
diff --git a/cobbler/utils.py b/cobbler/utils.py
index a2adfa6..c77e3f1 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -427,6 +427,11 @@ def blender(api_handle,remove_hashes, root_obj):
if len(kernel_txt) < 244:
results["kernel_options"]["kssendmac"] = None
+ # convert post kernel options to string
+ if results["kernel_options_post"]:
+ results["kernel_options_post"] = hash_to_string(results["kernel_options_post"])
+
+
# make interfaces accessible without Cheetah-voodoo in the templates
# EXAMPLE: $ip == $ip0, $ip1, $ip2 and so on.
diff --git a/webui_templates/distro_edit.tmpl b/webui_templates/distro_edit.tmpl
index be96e7a..10ae09e 100644
--- a/webui_templates/distro_edit.tmpl
+++ b/webui_templates/distro_edit.tmpl
@@ -146,6 +146,20 @@ function disablename(value)
<tr>
<td>
+ <label for="kopts_post">Post Kernel Options</label>
+ </td>
+ <td>
+ <input type="text" size="255" style="width: 400px;" name="kopts_post" id="kopts_post"
+ #if $distro
+ value="$distro.kernel_options_post"
+ #end if
+ />
+ <p class="context-tip">Example: clocksource=pit nosmp noapic nolapic</p>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
<label for="ksmeta">Kickstart Metadata</label>
</td>
<td>
diff --git a/webui_templates/profile_edit.tmpl b/webui_templates/profile_edit.tmpl
index 0c8f156..79a9bc7 100644
--- a/webui_templates/profile_edit.tmpl
+++ b/webui_templates/profile_edit.tmpl
@@ -23,7 +23,7 @@ function disablename(value)
<!--
cobbler profile add -name=string -distro=string [-kickstart=url]
- [-kopts=string] [-ksmeta=string] [-virt-file-size=gigabytes]
+ [-kopts=string] [-kopts_post=string] [-ksmeta=string] [-virt-file-size=gigabytes]
[-virt-ram=megabytes] [-virt-type=string] [-virt-path=string]
-->
@@ -157,6 +157,20 @@ function disablename(value)
<tr>
<td>
+ <label for="kopts_post">Post Kernel Options</label>
+ </td>
+ <td>
+ <input type="text" size="255" style="width: 400px;" name="kopts_post" id="kopts_post"
+ #if $profile
+ value="$profile.kernel_options_post"
+ #end if
+ />
+ <p class="context-tip">Example: clocksource=pit nosmp noapic nolapic</p>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
<label for="ksmeta">Kickstart Metadata</label>
</td>
<td>
diff --git a/webui_templates/system_edit.tmpl b/webui_templates/system_edit.tmpl
index b996520..72b1b81 100644
--- a/webui_templates/system_edit.tmpl
+++ b/webui_templates/system_edit.tmpl
@@ -176,6 +176,20 @@ function page_onload() {
<tr id="id9005">
<td>
+ <label for="kopts_post">Post Kernel Options</label>
+ </td>
+ <td>
+ <input type="text" size="255" style="width: 400px;" name="kopts_post" id="kopts_post"
+ #if $system
+ value="$system.kernel_options_post"
+ #end if
+ />
+ <p class="context-tip">Example: clocksource=pit nosmp noapic nolapic</p>
+ </td>
+ </tr>
+
+ <tr id="id9006">
+ <td>
<label for="ksmeta">Kickstart Metadata</label>
</td>
<td>
@@ -188,7 +202,7 @@ function page_onload() {
</td>
</tr>
- <tr id="id9006">
+ <tr id="id9007">
<td>
<label for="netboot">Netboot Enabled</label>
</td>
#set $kernel_options_post = $getVar('$kernel_options_post', {})
#if len($kernel_options_post) > 0
%post
/sbin/grubby --update-kernel=`/sbin/grubby --default-kernel` --args="$kernel_options_post"
#end if