Attached is an updated version of the patch to add boot loader support for guest domains. Changes from the initial set of patches: * Per Ian''s request, adds an option to specify booting a specific kernel from the host domain (you can specify it either with the title of the boot loader config entry or with the grub 0-based index) * Reduces some of the code duplication for finding out what the virtual disk to boot off of is * Improved error handling to use the standard Xen logging and error facilities At this point, I think that we handle the use cases where a user just wants to have everything specified from within the guest domain, creating a domain with xm create and wanting to be able to interactively select a kernel and asking for a specific entry from the grub.conf to be booted when creating a domain. Future things (which I think are fine to do after the initial pass is committed) include * Reworking to use the planned new console infrastructure [1] * Handling whole disks * More filesystem support -- the code is generic and has all the hooks, I just haven''t delved deep enough into any of the other fs libraries * Further improvements for the menu interface Signed-off-by: Jeremy Katz <katzj@redhat.com> Jeremy [1] And I foolishly told Ian I''d start a discussion about this last week and still haven''t. Hopefully tonight. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/26/05, Jeremy Katz <katzj@redhat.com> wrote:> Attached is an updated version of the patch to add boot loader support > for guest domains. > > Changes from the initial set of patches: > * Per Ian''s request, adds an option to specify booting a specific kernel > from the host domain (you can specify it either with the title of the > boot loader config entry or with the grub 0-based index) > * Reduces some of the code duplication for finding out what the virtual > disk to boot off of is > * Improved error handling to use the standard Xen logging and error > facilities > > At this point, I think that we handle the use cases where a user just > wants to have everything specified from within the guest domain, > creating a domain with xm create and wanting to be able to interactively > select a kernel and asking for a specific entry from the grub.conf to be > booted when creating a domain. > > Future things (which I think are fine to do after the initial pass is > committed) include > * Reworking to use the planned new console infrastructure [1] > * Handling whole disks > * More filesystem support -- the code is generic and has all the hooks, > I just haven''t delved deep enough into any of the other fs libraries > * Further improvements for the menu interface > > Signed-off-by: Jeremy Katz <katzj@redhat.com> > > Jeremy > > [1] And I foolishly told Ian I''d start a discussion about this last week > and still haven''t. Hopefully tonight.Jeremy, I tried it out with the latest xen-unstable got from the homepage and patch with xen-booloader.patch. There are few "hunk". What xen-unstable version are you using? By the way, did you forget __init__.py in pygrub/src/ ? pygrub is a python package, and looks like we need it. At the moment compilation spit out an error "... __init__.py not found...". Quick fix: touch tools/pygrub/src/__init__.py then no more complain. regards, aq _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/26/05, aq <aquynh@gmail.com> wrote:> On 4/26/05, Jeremy Katz <katzj@redhat.com> wrote: > > Attached is an updated version of the patch to add boot loader support > > for guest domains. > > > > Changes from the initial set of patches: > > * Per Ian''s request, adds an option to specify booting a specific kernel > > from the host domain (you can specify it either with the title of the > > boot loader config entry or with the grub 0-based index) > > * Reduces some of the code duplication for finding out what the virtual > > disk to boot off of is > > * Improved error handling to use the standard Xen logging and error > > facilities > >Jeremy, I looked at your code, and find few lines like this: exec("%s = r\"%s\"" %(self.commands[com], arg.strip())) Looks like you dont need the above "r". Then the code should be: exec("%s = \"%s\"" %(self.commands[com], arg.strip())) Here is a small patch (against your patch) to remove those typos. $ diffstat booloader1.patch xen-bootloader2.patch | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 2005-04-26 at 18:32 +0900, aq wrote:> Jeremy, I tried it out with the latest xen-unstable got from the > homepage and patch with xen-booloader.patch. There are few "hunk". > What xen-unstable version are you using?Bah, bitkeeper foils me again. Rediffed to current -unstable attached. Thanks for catching that.> By the way, did you forget __init__.py in pygrub/src/ ? pygrub is a > python package, and looks like we need it. At the moment compilation > spit out an error "... __init__.py not found...".It was there at one point... added it as well for this diff. As for your other comment, the r quoting of the strings is to make sure that the strings are interpreted as raw strings instead of trying to handle escaping which helps in cases where you have "odd" things in your grub.conf. Jeremy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/27/05, Jeremy Katz <katzj@redhat.com> wrote:> On Tue, 2005-04-26 at 18:32 +0900, aq wrote: > > Jeremy, I tried it out with the latest xen-unstable got from the > > homepage and patch with xen-booloader.patch. There are few "hunk". > > What xen-unstable version are you using? > > Bah, bitkeeper foils me again. Rediffed to current -unstable attached. > Thanks for catching that. > > > By the way, did you forget __init__.py in pygrub/src/ ? pygrub is a > > python package, and looks like we need it. At the moment compilation > > spit out an error "... __init__.py not found...". > > It was there at one point... added it as well for this diff. > > As for your other comment, the r quoting of the strings is to make sure > that the strings are interpreted as raw strings instead of trying to > handle escaping which helps in cases where you have "odd" things in your > grub.conf.ok, i see the point. other question: pygrub::get_config(fn) tries to read "/boot/grub/grub.conf". Normally this should be "/boot/grub/menu.lst". I wonder which distro are you working on? I expect this code will be in -unstable soon, so we can work on the same code base. sending patch would be easier. thank you, aq _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> ok, i see the point. > > other question: pygrub::get_config(fn) tries to read > "/boot/grub/grub.conf". Normally this should be "/boot/grub/menu.lst". > I wonder which distro are you working on?I''m betting he''s using RedHat :-) My FC3 box has menu.lst as a symlink to grub.conf. Grub seems to be happy with either of these names. Painful experience suggests that if both files are present, then "menu.lst" will "win". Jeremy: for distros that just have menu.lst, could you search for this too? Perhaps it''s worth implementing a grub-style precedence for menu.lst when present and grub.conf if not? Cheers, Mark> I expect this code will be in -unstable soon, so we can work on the > same code base. sending patch would be easier. > > thank you, > aq > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/27/05, Jeremy Katz <katzj@redhat.com> wrote:> On Tue, 2005-04-26 at 18:32 +0900, aq wrote: > > Jeremy, I tried it out with the latest xen-unstable got from the > > homepage and patch with xen-booloader.patch. There are few "hunk". > > What xen-unstable version are you using? > > Bah, bitkeeper foils me again. Rediffed to current -unstable attached. > Thanks for catching that. > > > By the way, did you forget __init__.py in pygrub/src/ ? pygrub is a > > python package, and looks like we need it. At the moment compilation > > spit out an error "... __init__.py not found...". > > It was there at one point... added it as well for this diff. > > As for your other comment, the r quoting of the strings is to make sure > that the strings are interpreted as raw strings instead of trying to > handle escaping which helps in cases where you have "odd" things in your > grub.conf. > > Jeremy >I checked the new patch. src/__init__.py is not in yet? $ diffstat xen-bootloader-2.patch Makefile | 1 pygrub/Makefile | 18 ++ pygrub/setup.py | 25 ++ pygrub/src/GrubConf.py | 229 ++++++++++++++++++++++++++ pygrub/src/fsys/__init__.py | 61 ++++++ pygrub/src/fsys/ext2/__init__.py | 38 ++++ pygrub/src/fsys/ext2/ext2module.c | 332 ++++++++++++++++++++++++++++++++++++++ pygrub/src/fsys/ext2/test.py | 15 + pygrub/src/pygrub | 270 ++++++++++++++++++++++++++++++ python/xen/xend/XendBootloader.py | 95 ++++++++++ python/xen/xend/XendDomainInfo.py | 42 ++++ python/xen/xend/server/blkif.py | 9 + python/xen/xm/create.py | 34 +++ 13 files changed, 1165 insertions(+), 4 deletions(-) when i use diff to produce the patch, if the src/__init__.py is empty, diff would ignore that file, too. so the trick is to create __init__.py with a space inside ;-) regards, aq _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Katz wrote:> Attached is an updated version of the patch to add boot loader support > for guest domains.In relation to this, did anyone consider porting Grub to run inside a domU? Jacob _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 2005-04-26 at 15:11, Jacob Gorm Hansen wrote:> Jeremy Katz wrote: > > Attached is an updated version of the patch to add boot loader support > > for guest domains. > > In relation to this, did anyone consider porting Grub to run inside a domU?While it seems appealing, a large amount of the grub code is device drivers, real mode boot strapping code, etc. You''d probably get very little useful code from grub in porting it to domU. Regards,> Jacob > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel-- Anthony Liguori Linux Technology Center (LTC) - IBM Austin E-mail: aliguori@us.ibm.com Phone: (512) 838-1208 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Mark Williamson wrote:>>ok, i see the point. >> >>other question: pygrub::get_config(fn) tries to read >>"/boot/grub/grub.conf". Normally this should be "/boot/grub/menu.lst". >>I wonder which distro are you working on? > > My FC3 box has menu.lst as a symlink to grub.conf. Grub seems to be happy > with either of these names. Painful experience suggests that if both files > are present, then "menu.lst" will "win".GRUB only looks for menu.lst; distros create symlinks because that''s a terrible name for a config file. In other words, no code should be opening grub.conf... -- Hollis Blanchard IBM Linux Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Anthony Liguori wrote:> On Tue, 2005-04-26 at 15:11, Jacob Gorm Hansen wrote: > >>Jeremy Katz wrote: >> >>>Attached is an updated version of the patch to add boot loader support >>>for guest domains. >> >>In relation to this, did anyone consider porting Grub to run inside a domU? > > > While it seems appealing, a large amount of the grub code is device > drivers, real mode boot strapping code, etc.The interesting things you would get from Grub would be the filesystem-decoding stuff, the elf decoder, the two-stage loader, and the nice and well-tested config-file parsing, in a format that lots of users already understand. Tftp and bootp/dhcp support could also be nice in some scenarios. And by having the bootloader in the domU you would get stronger security as well. Jacob _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
> GRUB only looks for menu.lst; distros create symlinks because that''s a > terrible name for a config file. In other words, no code should be > opening grub.conf...OK, I''ve investigated this using my sacrificial FC3 laptop ;-) I''d not fully investigated this before. Redhat''s grub looks for grub.conf and not menu.lst. Standard grub looks for menu.lst. If the loader is to be flexible for different domU distros, it''d be nice to look for both, in one order or the other. Cheers, Mark _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/27/05, Hollis Blanchard <hollisb@us.ibm.com> wrote:> Mark Williamson wrote: > >>ok, i see the point. > >> > >>other question: pygrub::get_config(fn) tries to read > >>"/boot/grub/grub.conf". Normally this should be "/boot/grub/menu.lst". > >>I wonder which distro are you working on? > > > > My FC3 box has menu.lst as a symlink to grub.conf. Grub seems to be happy > > with either of these names. Painful experience suggests that if both files > > are present, then "menu.lst" will "win". > > GRUB only looks for menu.lst; distros create symlinks because that''s a > terrible name for a config file. In other words, no code should be > opening grub.conf... >ok, so here is a quick patch to fix the "/boot/grub/grub.conf" problem. Please apply this after applying the last Jeremy''s patch. list of changes: - make a dummy file tools/pygrub/src/__init__.py - open and parse /boot/grub/menu.lst instead of /boot/grub/grub.conf $ diffstat xen-bootloader.aq.patch __init__.py | 1 + pygrub | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/27/05, Mark Williamson <mark.williamson@cl.cam.ac.uk> wrote:> > GRUB only looks for menu.lst; distros create symlinks because that''s a > > terrible name for a config file. In other words, no code should be > > opening grub.conf... > > OK, I''ve investigated this using my sacrificial FC3 laptop ;-) I''d not fully > investigated this before. > > Redhat''s grub looks for grub.conf and not menu.lst. Standard grub looks for > menu.lst. > > If the loader is to be flexible for different domU distros, it''d be nice to > look for both, in one order or the other. >in that case, this patch is better for you, Mark ;-). Please apply this on top of Jeremy''s patch. list of changes: - make a dummy file tools/pygrub/src/__init__.py - tools/src/pygrub looks for either /boot/grub/menu.lst or /boot/grub/grub.conf, in that order. $ diffstat xen-bootloader.aq2.patch __init__.py | 1 + pygrub | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Thanks for the patch. I haven''t looked at Jeremy''s code but won''t the os.path.isfile() break when the kernel (and the boot options) are being loaded from within a domain''s filesystem, rather than dom0? Cheers, Mark On Tuesday 26 April 2005 22:02, aq wrote:> On 4/27/05, Mark Williamson <mark.williamson@cl.cam.ac.uk> wrote: > > > GRUB only looks for menu.lst; distros create symlinks because that''s a > > > terrible name for a config file. In other words, no code should be > > > opening grub.conf... > > > > OK, I''ve investigated this using my sacrificial FC3 laptop ;-) I''d not > > fully investigated this before. > > > > Redhat''s grub looks for grub.conf and not menu.lst. Standard grub looks > > for menu.lst. > > > > If the loader is to be flexible for different domU distros, it''d be nice > > to look for both, in one order or the other. > > in that case, this patch is better for you, Mark ;-). Please apply > this on top of Jeremy''s patch. > > list of changes: > - make a dummy file tools/pygrub/src/__init__.py > - tools/src/pygrub looks for either /boot/grub/menu.lst or > /boot/grub/grub.conf, in that order. > > $ diffstat xen-bootloader.aq2.patch > __init__.py | 1 + > pygrub | 11 +++++++++-- > 2 files changed, 10 insertions(+), 2 deletions(-) > > Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 4/27/05, Mark Williamson <mark.williamson@cl.cam.ac.uk> wrote:> Thanks for the patch. > > I haven''t looked at Jeremy''s code but won''t the os.path.isfile() break when > the kernel (and the boot options) are being loaded from within a domain''s > filesystem, rather than dom0?ah you right here. my bad mistake. so we need another patch for this problem. Perhaps the abstract of filesystem should be extended for this case also. I am working on it. thank you, aq _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 2005-04-26 at 21:47 +0100, Mark Williamson wrote:> > GRUB only looks for menu.lst; distros create symlinks because that''s a > > terrible name for a config file. In other words, no code should be > > opening grub.conf... > > OK, I''ve investigated this using my sacrificial FC3 laptop ;-) I''d not fully > investigated this before. > > Redhat''s grub looks for grub.conf and not menu.lst. Standard grub looks for > menu.lst. > > If the loader is to be flexible for different domU distros, it''d be nice to > look for both, in one order or the other.Yeah, oops... I forgot about that. I''ve been doing grub.conf so long now that my mind forgets that Okuji didn''t want to take the patch for upstream grub at times. Just checking both is the easy answer and aq has already sent the patch to do so (thanks!) Jeremy _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel