WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: Dave Scott <Dave.Scott@xxxxxxxxxxxxx>
Subject: Re: [Xen-API] How Pygrub work on VHD
From: Ahmed Kamal <email.ahmedkamal@xxxxxxxxxxxxxx>
Date: Mon, 25 Jan 2010 23:24:24 +0200
Cc: Anthony Xu <anthony@xxxxxxxxx>, "xen-api@xxxxxxxxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 25 Jan 2010 13:27:40 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=DsF56gNKBZv36epkNKUnp/BgZTtMQmmjEcs/P7eHZAA=; b=UnsN7Ww6lEFmYfSowd9qKEB70xzQzaD/SQLryibYDFJJOu94fFqwkP2Y12EHR0Rv6c dzVPf0QEr1+VcOusJ4Hv3NQ+4mrjbXft6c4nInFOsFEGL1XoP0xVfvDIobHUYMePlUxe Ffq/x9qTgnlDlt0XjBJECl8kWN9ZDl5xXIjfY=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=X+1ud04l+2QfKkvm+3tDovuLBAUA/2cYdMlSfnmp4wp3zJXhhyeOGTSmbNBws3nGtu hdpQgGZVXe+EBGP+tNT2gAH4wK/D3zklgk6ceM9lpDWkbY9Lj3YViwL72lHiF6F2QMyw 8bWUC6YPogVPIs3KP/gtyfOjTIee1prqY36FA=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <81A73678E76EA642801C8F2E4823AD2143E92238EE@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <1264451889.2927.3.camel@mobl-ant> <81A73678E76EA642801C8F2E4823AD2143E92238EB@xxxxxxxxxxxxxxxxxxxxxxxxx> <1264452764.2927.14.camel@mobl-ant> <81A73678E76EA642801C8F2E4823AD2143E92238EE@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Another potential way to import disks, would be to use HTTP PUT to /import_raw_vdi
This destroys sparseness though

On Mon, Jan 25, 2010 at 11:13 PM, Dave Scott <Dave.Scott@xxxxxxxxxxxxx> wrote:
Hi Anthony,

> Thanks for your quick response,
>
> my understanding is driver (maybe in user space) behind /dev/xvda
> translates raw disk image format to VHD image format on demand, when
> pygrub works on /dev/xvda

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 I'm doing is,
>
> 1. Create a lvm vdi on iscsi SR,
> 2. dd a vhd file to this vdi,
> 3. attach this vdi to a (empty)PV vm as device 0(vbd),
> 4. mark this vbd bootable,
> 5. then start this vm

Unfortunately this isn't going to work. The choice of whether to use blktap (vhd-capable) or blkback (raw device only) is a function of the SR's content_type. The 'iscsi' SR uses blkback :(

To see what I mean, try something like this instead:

1. Create an 'lvmoiscsi' SR
2. create a VDI in the new SR
3. look inside the new LV -- it should have vhd metadata

Are you trying to import disks in .vhd format? The most future-proof way of doing this is to:
* create a VDI using the API
* hotplug the VDI into a VM (eg dom0 or a domU)
* decode the .vhd data, write() it to the raw block device and use seek() to preserve sparseness

Simply dd'ing an existing .vhd is risky because XCP is expecting the .vhd to have a particular, optimized layout. In particular:
* extra space is left at the beginning of the file for later resizing
* parent locators have a particular naming convention
* blocks are carefully aligned for performance

Cheers,
Dave


_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api