Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koan: Allow alternate source for kernel/initrd than kickstart install URL #39

Open
opoplawski opened this issue Sep 11, 2013 · 3 comments

Comments

@opoplawski
Copy link
Contributor

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?

@jimi-c
Copy link
Member

jimi-c commented Sep 15, 2013

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.

@alanoe
Copy link

alanoe commented Oct 2, 2014

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.

@opoplawski
Copy link
Contributor Author

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?

@opoplawski opoplawski changed the title Allow alternate source for kernel/initrd than kickstart install URL koan: Allow alternate source for kernel/initrd than kickstart install URL Oct 2, 2014
@SchoolGuy SchoolGuy transferred this issue from cobbler/cobbler Oct 16, 2019
@SchoolGuy SchoolGuy moved this to Inbox in Koan Sep 26, 2022
@SchoolGuy SchoolGuy added this to Koan Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

No branches or pull requests

3 participants