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

It works now

I found the cause, it's my bad. The VHD file I used has parent,
obliviously it can't work.

Thanks for all your help.

Now I know how pygrub works,
before run pygrub, VM system disk is plugged into dom0 as /dev/xvd*
pygrub grab kernel&initrd from it
then this disk is unplugged from dom0.

A curious question,
When I run HVM VM, VM system disk is still plugged into dom0
temporarily, I don't think it is necessary. because it is VM bootloader
to load kernel&initrd in HVM. Maybe I'm missing something here.

at last, I'd like to get confirmation from you guys, that dd vhd file to
lvm volume(with same virtual disk size) works,  though it works in my

Thanks again

- Anthony

On Mon, 2010-01-25 at 14:22 -0800, Anil Madhavapeddy wrote:
> 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 
> /var/xensource/xapi.log.
> If you're not in a XenServer dom0 for some reason, then the script is in the 
> repo at 
> http://xenbits.xen.org/xapi/xen-api.hg?file/25e9038fce00/scripts/xe-edit-bootloader
> -anil

xen-api mailing list