This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-API] How Pygrub work on VHD

On 25 Jan 2010, at 21:51, Ian Pratt wrote:

>>> That's correct. When a vhd-based VDI is attached to a domain,
>> blktap(kernel-space) + tapdisk(user-space) do the translation from raw
>> disk block accesses to vhd read/writes.
>> What you are talking about is how VM accesses vhd-based disk image. What
>> I want to know is how pygrub grabs kernel and initrd from vhd-based disk
>> image, pygrub is running on dom0, there is no /dev/xvda, which is inside
>> VM.
> Before booting a VM, xapi will set up blktap for each of the VM's disks. One 
> side effect of this is that a block device is exposed in dom0 that enables 
> tools in dom0 to also access the disk. For a HVM guest this is used by qemu 
> for accessing the guest's disk through emulation. It is this same device that 
> pygrub operates against.
> I'm not sure why pygrub isn't working for you. You should be able to run it 
> manually against the block device and see why its failing.

You can use the 'xe-edit-bootloader' script from dom0 to ensure that the 
dom0-block-attach is working correctly (valid VHD file, etc).

It drops you into a shell inside the guest filesystem to fix grub.conf issues 
which would otherwise leave a PV VM unbootable.  If the VHD file is block 
attached successfully, then the failing pygrub output should be in 

If you're not in a XenServer dom0 for some reason, then the script is in the 
repo at 

xen-api mailing list