koan
koan copied to clipboard
koan: Allow alternate source for kernel/initrd than kickstart install URL
I like to test out Fedora staged install images with koan. However I'm not able to get this quite right. Currently I set:
- initrd:
/data/repos/fedora/stage/20-Alpha-RC1/Fedora/x86_64/os/images/pxeboot/initrd.img
- kernel:
/data/repos/fedora/stage/20-Alpha-RC1/Fedora/x86_64/os/images/pxeboot/vmlinuz
- kernel_options :
ksdevice=bootif lang= nokill text kssendmac inst.stage2=http://fedstage.cora.nwra.com/20-Alpha-RC1/Fedora/x86_64/os
- ks_meta :
tree=http://fedora.cora.nwra.com/development/20/x86_64/os
I need to use the development url for the tree in order to get the packages (the staged images only have the kernel/initrd/installer-image.
So, would it be possible to have koan retrieve the kernel/initrd directly from cobbler or from the inst.stage2
location if given?
It would, and in certain situations I think koan will actually use the kernel/initrd directly for virt-install (but I believe that's on the xen detection path). Feel free to work on this, as it would be somewhat lower priority for me right now.
This seems a koan-specific feature request. It would be good to be able to filter those. github supports custom labels (eg koan)? Otherwise we could just add a tag to the issue title.
ICurrently koan does this:
# If breed is ubuntu/debian we need to source the install tree
differently
# as preseeds are used instead of kickstarts.
if profile_data["breed"] in ["ubuntu", "debian", "suse"]:
self.get_install_tree_from_profile_data(profile_data)
else:
# find_kickstart source tree in the kickstart file
self.get_install_tree_from_kickstart(profile_data)
I guess the kickstart data is in general better than the profile data as the kickstart template could conceivably not use the $tree variable at all.
Perhaps add a new function, so something like:
if profile_data["breed"] in ["ubuntu", "debian", "suse"]:
self.get_install_tree_from_profile_data(profile_data)
else:
# find install source tree from kernel options
if not self.get_install_tree_from_kernel_options(profile_data)
# Otherwise find kickstart source tree in the kickstart file
self.get_install_tree_from_kickstart(profile_data)
def get_install_tree_from_kernel_options(self, profile_data):
"""
Split kernel options to obtain the inst.stage2 path. Generate the
install_tree
using the http_server and the tree obtained from the inst.stage2 path
"""
try:
tree = profile_data["kernel_options"].split()
# Ensure we only take the tree in case ks_meta args are passed
# First check for tree= in ks_meta arguments
meta_re = re.compile('inst.stage2=')
tree_found = ''
for entry in tree:
if meta_re.match(entry):
tree_found = entry.split("=")[-1]
break
if tree_found == '':
return False
else:
tree = tree_found
tree_re = re.compile('(http|ftp|nfs):')
# Next check for installation tree on remote server
if tree_re.match(tree):
tree = tree.replace(
"@@http_server@@",
profile_data["http_server"])
profile_data["install_tree"] = tree
else:
# Now take the first parameter as the local path
profile_data["install_tree"] = "http://" + \
profile_data["http_server"] + tree
if self.safe_load(profile_data, "install_tree"):
print("install_tree:", profile_data["install_tree"])
else:
print("warning: kickstart found but no install_tree found")
except:
pass
There's a fair amount of duplication with get_install_tree_from_profile_data(), so perhaps a helper function is in order.
Thoughts?