diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2009-02-05 17:11:21 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2009-02-05 17:11:21 -0500 |
commit | e936148a8c215bce88fd81e4b559ad5d6c19c7af (patch) | |
tree | be83a5a75935e6af5780e8047403faf730e79ddd | |
parent | f7f0bf4f2cfb1d99b06ddd861be06ad94c92d131 (diff) | |
download | cobbler-e936148a8c215bce88fd81e4b559ad5d6c19c7af.tar.gz cobbler-e936148a8c215bce88fd81e4b559ad5d6c19c7af.tar.xz cobbler-e936148a8c215bce88fd81e4b559ad5d6c19c7af.zip |
s390 hacking
-rw-r--r-- | cobbler/pxegen.py | 22 | ||||
-rw-r--r-- | cobbler/settings.py | 1 | ||||
-rw-r--r-- | cobbler/utils.py | 8 | ||||
-rw-r--r-- | installer_templates/settings.template | 11 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | templates/s390x_conf.template | 54 | ||||
-rw-r--r-- | templates/s390x_parm.template | 3 |
7 files changed, 98 insertions, 3 deletions
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py index ff403c1d..bbe27ec8 100644 --- a/cobbler/pxegen.py +++ b/cobbler/pxegen.py @@ -485,7 +485,22 @@ class PXEGen: if not image_based and distro.arch == "s390x": f2 = os.path.join(self.bootloc, "s390x", "s_%s" % system.name) if system.netboot_enabled: + cf = "%s_conf" % f2 + pf = "%s_parm" % f2 + template_cf = open("/etc/cobbler/pxe/s390x_conf.template") + template_pf = open("/etc/cobbler/pxe/s390x_parm.template") self.write_pxe_file(f2,system,profile,distro,distro.arch) + blended = utils.blender(self.api, True, system) + self.templar.render(template_cf, blended, cf) + # FIXME: profiles also need this data! + kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (blended["http_server"], system.name) + meta2 = {} + meta2["kickstart_expanded"] = "ks=%s" % kickstart_path + ## FIXME: this may not work right for kernel options with + ## a space in them though there are not many of those. + meta2["kernel_options"] = "\n".join(blended["kernel_options"].split(" ")) + meta2["confname"] = "s_%s_conf" % system.name + self.templar.render(template_pf, meta2, pf) else: # ensure the file doesn't exist utils.rmfile(f2) @@ -704,9 +719,10 @@ class PXEGen: # Find the kickstart if we inherit from another profile if system: - kickstart_path = utils.blender(self.api, True, system)["kickstart"] + blended = utils.blender(self.api, True, system) else: - kickstart_path = utils.blender(self.api, True, profile)["kickstart"] + blended = utils.blender(self.api, True, profile) + kickstart_path = blended["kickstart"] else: # this is an image we are making available, not kernel+initrd @@ -760,7 +776,7 @@ class PXEGen: else: # not a system record, so this is a profile record - if distro.breed == "windows": + if distro is not None and distro.breed == "windows": template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_win.template") elif arch == "s390x": template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template") diff --git a/cobbler/settings.py b/cobbler/settings.py index c43987ab..e87536c7 100644 --- a/cobbler/settings.py +++ b/cobbler/settings.py @@ -68,6 +68,7 @@ DEFAULTS = { "text" : None, "ksdevice" : "eth0" }, + "kernel_options_s390x" : {}, "manage_dhcp" : 0, "manage_dns" : 0, "manage_xinetd" : 0, diff --git a/cobbler/utils.py b/cobbler/utils.py index e9be533a..a4101cff 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -454,6 +454,14 @@ def blender(api_handle,remove_hashes, root_obj): for node in tree: __consolidate(node,results) + # hack -- s390 nodes get additional default kernel options + arch = results.get("arch","?") + if arch == "s390x": + keyz = settings.kernel_options_s390x.keys() + for k in keyz: + if not results.has_key(k): + results[k] = settings.kernel_options_s390x[k] + # determine if we have room to add kssendmac to the kernel options line kernel_txt = hash_to_string(results["kernel_options"]) if len(kernel_txt) < 244: diff --git a/installer_templates/settings.template b/installer_templates/settings.template index dbbb08de..1733b49e 100644 --- a/installer_templates/settings.template +++ b/installer_templates/settings.template @@ -125,6 +125,17 @@ kernel_options: lang: ' ' text: ~ +# s390 systems require additional kernel options in addition to the +# above defaults + +kernel_options_s390x: + ramdisk_size: 40000 + root: /dev/ram0 + ro: ~ + ip: off + CMSDASD: 191 + RUNKS: 1 + # configuration options if using the authn_ldap module. See the # the Wiki for details. This can be ignored if you are not using # LDAP for WebUI/XMLRPC authentication. @@ -195,6 +195,8 @@ if __name__ == "__main__": (pxepath, ['templates/pxesystem.template']), (pxepath, ['templates/pxesystem_s390x.template']), (pxepath, ['templates/pxeprofile_s390x.template']), + (pxepath, ['templates/s390x_conf.template']), + (pxepath, ['templates/s390x_parm.template']), (pxepath, ['templates/pxesystem_ia64.template']), (pxepath, ['templates/pxesystem_ppc.template']), (pxepath, ['templates/pxeprofile.template']), diff --git a/templates/s390x_conf.template b/templates/s390x_conf.template new file mode 100644 index 00000000..ad569d21 --- /dev/null +++ b/templates/s390x_conf.template @@ -0,0 +1,54 @@ +DASD=100-101,200 +SUBCHANNELS=0.0.0600,0.0.0601,0.0.0602 +NETTYPE=qeth +#if $interfaces.has_key("eth0") + $set $hostname=$interfaces['eth0'].get('hostname','') + #set $ip=$interfaces['eth0'].get('ip_address','') + #set $netmask=$interfaces['eth0'].get('subnet','') + #set $gateway=$interfaces['eth0'].get('gateway','') + #set $nameservers=':'.join($interfaces['eth0'].get('nameservers','')) + #set $dnssearch=':'.join($interfaces['eth0'].get('dnssearch','')) + #if $ip != '' + #set $tokens = $ip.split('.') + #set $tokens = $tokens[0:-1] + #set $broadcast = " ".join($tokens) + ".255" + #else + #set $broadcast = "" + #end if +#else + #set $hostname="" + #set $ip="" + #set $netmask="" + #set $gateway="" + #set $nameservers="" + #set $dnssearch="" + #set $broadcast = "" +#end if +#if $hostname != '' +HOSTNAME=$hostname +#end if +#if $ip != '' +IPADDR=$ip +#end if +## FIXME: don't know what to do with this? +## NETWORK=192.168.5.0 +#if $netmask != '' +NETMASK=$netmask +#end if +#if $dnssearch != '' +SEARCHDNS=$dnssearch +#end if +#if $gateway != '' +GATEWAY=$gateway +#end if +#if $nameservers != '' +DNS=$name_servers +#end if +## FIXME: the hack that generates this assumes ip with 255 as last octet +## FIXME: if this is wrong, don't change here, change at the top where it's set +#if $broadcast != '' +BROADCAST=$broadcast +#end if +MTU=1500 +PORTNAME=UNASSIGNED +LAYER2=0 diff --git a/templates/s390x_parm.template b/templates/s390x_parm.template new file mode 100644 index 00000000..39b977ad --- /dev/null +++ b/templates/s390x_parm.template @@ -0,0 +1,3 @@ +$kickstart_expanded +CMSCONFFILE=$confname +$kernel_options |