Commit Graph
79 Commits
Author SHA1 Message Date
Keir Fraser ada90ce49f pygrub: Correct pygrub return value
This is the patch to correct pygrub return value for checkPassword()
function. It didn't return False at the end of the function. It
returned None so it was working fine and it's most likely just a
cosmetic issue.

Also, the missing () were added to checkPassword() function when
calling hasPassword and the unnecessary comment was removed.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-15 09:21:34 +01:00
Keir Fraser fdb26f82e7 pygrub: trap exception when python module import fails
Fix the issue when importing 'crypt' module or crypt.crypt fails in
pygrub. The exception is written on the same line like "Failed!"
message but only if there is an exception. If there is no exception,
we don't bother users with details (probably the password they entered
was wrong) so we just display "Failed!" message. Also, the code for
hasPassword() was rewritten not to have try/except block here.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-07 13:50:55 +01:00
Keir Fraser 0bdd52018f pygrub: Match bare-metal GRUB behavior for passwords
The password support patch already merged didn't match the bare-metal
GRUB behavior so I created a patch to match it. If password is entered
in grub.conf file, pressing `p` is required exactly like when using
"real" (bare-metal) GRUB. New options are available after the correct
password is entered.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-09-02 11:38:24 +01:00
Keir Fraser 6c6b085bec pygrub: Set path in #! line of pygrub, too
pygrub currently has a hardcoded path of /usr/bin/python which is not
correct if the version of python at install time is not the same as
that at build time.  This patch uses the existing install-wrap and
python/get-path machinery.

(It does not address the currently-existing bug that the get-path
machinery works by assuming that `python' is a symlink, rather than
querying the python interpreter for its version.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-08-25 14:57:45 +01:00
Keir Fraser 8fac45ee6e pygrub: Fix elilo handling after password patch.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-08-21 17:11:40 +01:00
Keir Fraser fee98528ea pygrub: Add password support
It basically checks for the presence of password line in grub.conf
of the guest image and if this line is present, it supports both clear
text and md5 versions of the password. Editing the grub entries and
command-line are disabled when some password is set in domain's
grub.conf file but the password was not entered yet. Also, new option
to press 'p' in interactive pygrub has been added to allow entering
the grub password. It's been tested on x86_64 with PV guests and was
working fine. Also, the countdown has been stopped after key was
pressed, ie. the user is probably editing the boot configuration.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-08-20 16:17:16 +01:00
Keir Fraser be7c3e95bc pygrub: Revert 19322:3118041f2259, as it breaks timeout=0 behaviour
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-20 08:23:33 +01:00
Keir Fraser f78a13d5e9 pygrub: Remove bogus log.debug line.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-10 13:30:50 +01:00
Keir Fraser 727a00e80e Permit user to suppress passing --prefix to setup.py
We change all invocations of setup.py as follows:

* use $(PYTHON) instead of `python' so that the user can specify
  an alternative python version if they need to.  If not set it
  defaults to `python' in Config.mk.

* pass --prefix=$(PREFIX) via a new make variable
  $(PYTHON_PREFIX_ARG).  This allows a user to suppress the
  --prefix=... argument entirely by setting PYTHON_PREFIX_ARG=''.
  This will work around the bug described here
     https://bugs.launchpad.net/ubuntu/+bug/362570
  where passing --prefix=/usr/local (which ought to have no effect as
  /usr/local is the default prefix) changes which subdirectory
  distutils chooses, and results in the files being installed in
  site-packages which is not on the default search path.

  Users not affected by this python packaging bug should not set
  PYTHON_PREFIX_ARG and their builds will not be affected.  (Provided
  PREFIX did not contain spaces.  People who put spaces in PREFIX are
  being quite optimistic.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-05-07 19:32:10 +01:00
Keir Fraser 11e1149fe0 tools: Always use sane upstream (`native') python paths
Previously, by default we would install our python modules into
/usr/lib/python/xen, for example /usr/lib/python/xen/__init__.py.
Upstream python's standard install location (a) includes the Python
version number and (b) puts things in site-packages by default.

Our best conjecture for the reason for this was an attempt to make the
installs portable between different python versions.  However, that
doesn't work because compiled python modules (.pyc), and C python
extensions corresponding to one version of python, are not compatible
across different versions of python.

This is why upstream include the version number.

site-packages is the standard location for locally-installed packages
and is automatically included on the python search path.

In this change, we abandon our own unusual python path setup:

 * Invoke setup.py in an entirely standard manner.  We pass
   PREFIX and DESTDIR using the appropriate options provided by
   setup.py for those purposes (adding them to setup.py calls
   which were previously lacking them).

 * Since the installation locations are now on the standard
   python path, we no longer need to add anything to the path
   in any of our python utilities.  Therefore remove all that
   code from every python script.  (Many of these scripts
   unconditionally added /usr/lib/python and /usr/lib64/python which
   is wrong even in the old world.)

 * There is no longer any special `Xen python path'.  xen-python-path
   is no longer needed.  It is no longer called by anything in our
   tree.  However since out-of-tree callers may still invoke it, we
   retain it.  It now prints a fixed string referring to a directory
   which does not to exist; callers (who use it to augment their
   python path) will thus add a nonexistent directory to their python
   path which is harmless.

 * Remove various workarounds including use of setup.py --home
   (which is intended for something completely different).

 * Remove tests for the XEN_PYTHON_NATIVE_INSTALL build-time
   environment variable.  The new behaviour is the behaviour which we
   should have had if this variable had been set.  That is, it is now
   as if this variable was always set but also bugs in the resulting
   install have been fixed.

This should be a proper fix for the bug addressed by c/s 19515.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-04-08 19:13:04 +01:00
Keir Fraser ca01c742be tools: fix python installation
attached patch lets python install the modules into
DESTDIR/PREFIX as before, but lets python search
the modules in PREFIX rather DESTDIR/PREFIX.

This prevents failures about not finding python modules
after files have been installed into PREFIX.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-04-07 14:37:35 +01:00
Keir Fraser 98da66a3bd build: Get rid of some more hardcoded install paths
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-03-31 13:30:50 +01:00
Keir Fraser 3f64466b4b ia64, pygrub: Allow command-line editing in Lilo boot loader
On IA64 platform reset() function has one more parameter for Lilo
bootloader used by IA64 than for GRUB bootloader used for other
platforms.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-03-31 13:21:36 +01:00
Keir Fraser 6fe255bdc2 pygrub: More accurate try/except catch.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-03-31 11:17:51 +01:00
Keir Fraser f976214e1d pygrub: run first entry in config when invalid default boot option provided
This behaviour matches that of real GRUB.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
2009-03-20 15:37:33 +00:00
Keir Fraser 2b9e3c9a48 pygrub: Detect NetWare PV in pygrub
Signed-off-by: John Levon <john.levon@sun.com>
2009-03-12 11:10:22 +00:00
Keir Fraser dc350ed2b5 pygrub: Workaround for Solaris CR 1143256.
The Solaris curses library has a broken timeout() function: after a
first timeout() call with a positive value for an argument, subsequent
calls will fail to reset it. So, getch() always times out, confusing
the pygrub timer in the main loop. Add an extra check to avoid exiting
prematurely.

Signed-off-by: Frank van der Linden <frank.vanderlinden@sun.com>
2009-03-12 10:58:21 +00:00
Keir Fraser 178897b9f2 pygrub: Enable domU boot without xen specific arg
This patch makes domUs bring up without xen specific args to guest
kernels. A domU should be bootable without args parameter because
tools/examples/xmexample1 doesn't have one.

Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
2009-03-09 09:19:10 +00:00
Keir Fraser c796f3c14f pygrub: parse xen module option in grub
Add function for GrubConf to parse xen module option in grub.
Pygrub should pass args as domUloader did.

Signed-off-by: Wei Kong <weikong.cn@gmail.com>
2009-02-20 11:08:31 +00:00
Keir Fraser 9f8501582f Use -MMD -MF in tools/* rather than -Wp,-M...
If you use -MMD -MF then the correct .o filename is written to the
.*.d file as the compiler driver arranges everything.  This was done
in 19010:275abe1c5d24 for the hypervisor.

In this patch we do the same elsewhere in the xen-unstable tree,
particularly tools/.  Specifically:
 * Change tools/Rules.mk to add -MMD -MF ... to CFLAGS and set DEPS.
 * Remove -Wp,-MD... from every other Makefile
 * Remove setting of DEPS from every other Makefile
 * Ensure that every Makefile says -include $(DEPS)
 * Ensure that every Makefile's clean target removes $(DEPS)

Some Makefiles were already halfway there, but often for a different
variable name eg PROG_DEP.  The variable name is now standardised in
Rules.mk as DEPS.

I have done a test build with this change, on Debian etch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
2009-01-12 10:16:05 +00:00
Keir Fraser 688581c472 pygrub: fix the parameter default' and timeout' in elilo.conf
This patch fixes two issues related to the parameter `default' and
`timeout' in elilo.conf:

- LiloConf.py cannot interpret the parameter `default' and
  `timeout'. The first kernel always boot up even if the second kernel
  is specified by `default'. And `timeout' is ignored.

  This issue is introduced by cset 15953:70bb28b62ffb.

- If two kernels or more are installed, the last kernel cannot boot
  up even if it is specified by `default'.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2008-10-03 09:42:11 +01:00
Keir Fraser 63193f3f4d PyGRUB: fix menu flicker
To avoid flickers, PyGRUB has to avoid spurious ncurses refresh as
much as possible, in particular before the complete screen is drawn,
and eventually call doupdate last.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
2008-08-27 09:46:38 +01:00
Keir Fraser 1a1af72f08 pygrub: Add 64bit library path to pygrub default search path.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
2008-07-30 09:23:47 +01:00
Keir Fraser 622e368758 Add ZFS libfsimage support patch
Add support to pygrub and libfsimage to boot ZFS root filesystems.
Boot argument of zfs-bootfs is set to describe ZFS root pool and
boot filesystem object number.  Boot argument bootpath is set to
describe the virtual device root mirror components.

Signed-off-by: Susan Kamm-Worrell <susan.kamm-worrell@sun.com>
2008-05-01 16:38:56 +01:00
Keir Fraser 8d4aef298f pygrub: cleanup and support for NetBSD
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2008-03-26 14:41:47 +00:00
Keir Fraser dc5719607e Fix pygrub handling of many kernels
If there are a large number of kernel images configured in grub.conf
there will be too many to fit in the limited size pygrub display. This
patch fixes this so that the list of kernels scrolls as needed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-12-27 12:56:32 +00:00
Keir Fraser adbda3b6da Fix security vulnerability CVE-2007-4993.
Protect pygrub from possible malicious content in guest grub
config file.  This fixes CVE-2007-4993.  Original patch from
Jeremy Katz, I updated to close 2 remaining issues pointed out
by Christian and Keir, and to use setattr(self, ...).

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
2007-09-25 09:34:36 +01:00
kfraser@localhost.localdomain f26a3dbc36 pygrub: LiloConf.py supports root and read-only
LiloConf.py ignores the following options: root and read-only.
This patch fixes the issue.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2007-08-06 10:13:34 +01:00
kfraser@localhost.localdomain 320061b18e [IA64] Presently pygrub only looks in /efi/redhat/elilo.conf. It
should check for other distributions, plus a couple fallback
locations.

Signed-off-by: Aron Griffis <aron@hp.com>
2007-05-03 09:33:12 +01:00
kfraser@localhost.localdomain 5e0ae4b087 pygriub: Fix GPT support.
- 64 bit support for starting of a GPT partition.
- detect partition types precisely.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
2007-04-13 11:23:26 +01:00
kfraser@localhost.localdomain 29f97ec479 Fix pygrub for IA64 support.
Signed-off-by: Shinya Kuwamura <kuwa@jp.fujitsu.com>
Signed-off-by: Tomohiro Takahashi <takatom@jp.fujitsu.com>
2007-04-11 15:36:04 +01:00
kfraser@localhost.localdomain a6954d648b pygrub: Support GPT (GUID Partition Table) as used by EFI.
Signed-off-by: Shinya Kuwamura <kuwa@jp.fujitsu.com>
Signed-off-by: Tomohiro Takahashi <takatom@jp.fujitsu.com>
2007-04-11 15:27:14 +01:00
Tim Deegan d3454d2db9 Editing long lines in pygrub interactively could lead to tracebacks.
Attached patch fixes things.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
2007-03-28 09:12:16 +00:00
kfraser@localhost.localdomain 9de4f0c67d tools: Clean up use of 'install' command.
- convert raw "install" command to use $(INSTALL)
- convert some $(INSTALL) to $(INSTALL_DATA) as appropriate
- modify the specific $(INSTALL) definitions to use -p.

Original patch by Ben Thomas <ben@virtualiron.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-03-07 10:49:20 +00:00
kfraser@localhost.localdomain 6ad77059f1 Install pygrub according to auxbin rules.
Signed-off-by: Keir Fraser <keir@xensource.com>
2007-03-05 19:01:19 +00:00
john.levon@sun.com ec08a094b2 Filesystem implementations may need optional arguments in terms of
what to mount. Add an options string to the libfsimage API.

Signed-off-by: John Levon <john.levon@sun.com>
2007-02-19 20:44:42 -08:00
Tim Deegan 479f9c8a5d [PYGRUB] Invoke pygrub with TERM=vt100
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2007-02-01 15:03:37 +00:00
Keir Fraser 880562ad8b pygrub: fsimage binding must free objects with PyObject_DEL, not PyMem_DEL.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-01-30 17:50:39 +00:00
Tim Deegan 7f39243d68 [PYGRUB] Plumb bootloader I/O through xenconsole.
- xend forwards console traffic between the running bootloader and a pty
   which it writes to the store so the xenconsole client can see it.
 - the xenconsole client handles the domain's console pty changing.
 - xm create no longer runs the bootloader.
 - pygrub gets '-i' option to explicitly request an interactive session.
 - xend unlocks the domain list during bootloading so that "xm console"
   can see the domain and attach to its console pty.

Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2007-01-22 11:49:14 +00:00
Tim Deegan 5ba43a5774 [PYGRUB] Don't redraw the interactive menu screen if it doesn't need it.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2007-01-22 11:49:05 +00:00
john.levon@sun.com e34a812b5d Update pygrub for new Solaris directory names.
Signed-off-by: John Levon <john.levon@sun.com>
2007-01-18 18:19:54 -08:00
Tim Deegan d50a0b66da [PYGRUB] Make the boot-choice timeout actually time out.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2007-01-15 16:04:32 +00:00
kfraser@localhost.localdomain ce9e6668ac Parse Solaris VTOCs in pygrub.
Signed-off-by: John Levon <john.levon@sun.com>
2007-01-12 14:42:07 +00:00
Tim Deegan 9c9e43e5f0 Sniff for Solaris if not specified. This allows Solaris domU's to automatically
boot correctly without fiddling with domain configs.

Signed-off-by: John Levon <john.levon@sun.com>
2007-01-09 13:24:41 +00:00
Tim Deegan 8c119d2ee4 Pass in kernel/ramdisk settings to pygrub; if specified, don't try to use
grub.conf; this allows hands-off bootloading in the absence of a grub.conf.
It's also useful for specifying temporary changes etc.

Signed-off-by: John Levon <john.levon@sun.com>
2007-01-09 13:24:40 +00:00
kaf24@localhost.localdomain 5334214feb pygrub tmp files should live in /var/run/ not /var/lib/, as they are
indeed runtime only.

Also fix a race condition in making the pygrub fifo.

Signed-off-by: John Levon <john.levon@sun.com>
2006-12-09 15:04:27 +00:00
Tim Deegan 6f88f21ddc [PYGRUB] Fix a few bounds violations in pygrub's command-line editor.
Don't step off the end of the line, or delete characters that aren't there.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
2006-11-09 14:23:24 +00:00
Tim Deegan 0d58f56d57 Use libfsimage for reading filesystem images.
Signed-off-by: John Levon <john.levon@sun.com>
2006-11-09 14:11:11 +00:00
kfraser@localhost.localdomain a034a6ad0e Dynamically link to libgcc on Solaris. Also clean up duplicate -Wall flags.
Signed-off-by: John Levon <john.levon@sun.com>
2006-11-02 18:19:22 +00:00
kaf24@localhost.localdomain a12c7da3a8 Use $CC when building pygrub.
Signed-off-by: John Levon <john.levon@sun.com>
2006-10-22 17:36:28 +01:00