On Thu, Sep 4, 2008 at 10:53 PM, Michael DeHaan <mdehaan(a)redhat.com> wrote:
(B) When attempting to correct this (removing the archmap code), the
following command now fails to work:
make devinstall && make eraseconfig && cobbler import --name=RHEL3U3
--mirror=/mnt/engarchive2/released/RHEL-3/U3/AS/ --available-as=http://foo
[...]
And imports all of the distributions, creating objects for each. For
instance, it will find the appropriate tree distros:
[...]
Now I see clearly the problem. I thought that the idea was to import a single
distribution from a single media, but if understand right, you have multiple
distributions stored under a single directory, and while importing with that
root directory as "mirror", you actually get a separate import for every single
distribution found there.
If that is the case, and I'm pretty sure it is, then I can tell you
exactly why the
patch failed, and why the new one will also fail.
What import is currently doing is to find every vmlinuz/initrd pair.
Then, checks
the path name against the known architectures, and if there is no match (there
isn't for unsupported archs), tries to find it from the included packages.
Here is where the problem comes, in method learn_arch_from_tree(dirname).
In the initial form it starts searching two directories above where the kernel
and initrd where found. That uses two facts :
- The vmlinuz & initrd at isolinux were explicitly rejected
- Current media for RedHat based distros hosts all the remaining vmlinux
and initrd at images/xxx/
That explains why the path walking starts two nodes above where the distro
was found, and is ok for RedHat, but that does not hold for debian media.
On debian media that is not true, and they are just one directory below the
media root. So, if you jump two directories you reach the ks_mirror directory,
which is not the right place to start. To avoid this, I used the code from
get_proposed_name to find the root of the imported tree, and search from
there (although I now realize that ks_mirror/name might have tree from
multiple media).
There is other point related (on arch_walker method) where the import
could fail,
even for a real single distribution media. Instead of returning only
one architecture,
the patched versions returns the list with all the architectures
found, and raises
an exception if there are more than one. That is intended to reject importing of
media for multiple architectures, that exists for debian and might have greater
impact on other portions of cobbler not related to import.
The new archwalker in this patch seems to not identify an arch for
"ls
/mnt/engarchive2/released/RHEL-3/U3/" which means it stopped too early,
which is why I am suggesting that Debian support be added without trying
to refactor/cleanup the code -- basically we just need to keep it
simple. Try to get the bare minimum to add the import in there, so
I'm not sure if the points I explained above are clear, but I really
don't think that
extensions to other distros could be done without some refactoring. The same
pieced of code will hardly allow import multiple RedHat trees at the same time,
with the ability to import a variety of distros. Moreover, the presence of some
command line arguments (arch and breed) does not fit well if many of them
could be imported with a single run. The only "easy" path that I see is disable
the multi-tree import (hopefully, only temporarily), or at least add a
new command
line option to enable it (thought it's unclear how to handle this in the code).
Javier Palacios