[libvirt] [PATCH] libxl: do not use hardcoded pygrub path

Álvaro López García alvaro.lopez.garcia at cern.ch
Wed Aug 20 07:41:16 UTC 2014


Hi Jim,

thanks four your time. Some replies inline, but before let me clarify
some things:

- I am running libvirt + xen in Debian and Ubuntu hosts.

- /usr/bin/pygrub does not exist in Debian and Ubuntu, it is located
  in /usr/lib/xen-<version>/bin/pygrub instead.

- We have been running our guests without including a bootloader element
  in the XML files until we have migrated to libxl.

On Tue 19 Aug 2014 (23:15), Jim Fehlig wrote:
> On 08/19/2014 10:33 AM, Álvaro López García wrote:
> >On Tue 19 Aug 2014 (14:32), Daniel P. Berrange wrote:
> >>On Tue, Aug 19, 2014 at 01:54:12PM +0200, Alvaro Lopez Garcia wrote:
> >>>According to the Xen documentation the full path was only needed
> >>>for versions prior to 4.1: "Note: For older versions of Xen Project
> >>>software (4.1 or earlier) you need to know where in the filesystem
> >>>pygrub lies. (...) Newer versions of the toolstack know how to look
> >>>for the path themselves." [1]
> >>Regardless of whether they know how to find the path, it is expected
> >>that the libvirt XML is including/requiring the full path. So I'm
> >>not really considering this a bug that needs fixing
> >- Is it required that all the libvirt XML files needing a bootloader
> >   specify one? or
> 
> No.  But if you don't specify one, you get /usr/bin/pygrub, which is similar
> to xend's behavior.

AFAIK if the bootloader is not set, or if it is set to just "pygrub", 
xend searchs for it [1] in several locations [2]. If it is set to a
full path, it does not search for anything and uses that path. In our
case we didn't set a bootloader and xend finds it in LIBEXEC (that in
Debian/Ubuntu using Xen 4.4 points to /usr/lib/xen-4.4/bin/).

[1] http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/python/xen/xend/XendDomainInfo.py;h=8d4ff5c749f294c9c6509d84bb2b6a898acfc965;hb=stable-4.4#l3245
[2] http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/python/xen/util/auxbin.py;h=a690ad94d16583b5e9d0b3e180e653305f7fb210;hb=stable-4.4#l35

libvirt using libxl is setting the bootloader to /usr/bin/pygrub if it
is not set in the XML file. This produces the following warning in the
libvirt logs (coming from libxl [3]):

  libxl: warning: libxl_bootloader.c:413:bootloader_disk_attached_cb:
  bootloader='/usr/bin/pygrub' is deprecated; use bootloader='pygrub'
  instead

The boot process finally ends up failing since it cannot find
/usr/bin/pygrub

  libxl: cannot execute /usr/bin/pygrub: No such file or directory

Therefore I assume that when libxl sets the bootloader because it is
missing in the XML file it should set it just to "pygrub" not
"/usr/bin/pygrub", hence my patch, but maybe I am mistaken.

[3] http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxl/libxl_bootloader.c;h=3287bf77da9a64327736e6bf923608e0c2bb3a52;hb=stable-4.4#l411

> >- If the bootloader is specified, then it has to be a full path?
> 
> No.

Thanks for the clarification.

> >If it is the former case, we have been running libvirt with xend without
> >specifying a bootloader in the XML files for a long time.
> 
> If not specified, xend sets bootloader to 'usr/bin/pygrub'.

See my comments above, if not specified or if it is only "pygrub" xend 
searchs for it in any of the expected paths.

> >  We only have
> >found issues when we switched our hypervisors from xend to libxl.
> 
> What issues?  AFAIK, only a warning in the log.

Actually just one issue apart from the warning in the log: After the
migration from xend to libxl I am not able to boot anymore one of the
previously running guests. I have to set manually in each of the guests'
configuration the bootloader, pointing to the correct location.

Kind regards,
-- 
Álvaro López García                              aloga at ifca.unican.es
Instituto de Física de Cantabria         http://alvarolopez.github.io
Ed. Juan Jordá, Campus UC                      tel: (+34) 942 200 969
Avda. de los Castros s/n
39005 Santander (SPAIN)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140820/0bdaf139/attachment-0001.sig>


More information about the libvir-list mailing list