[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Re: [XCP] converting a .img to xva



Just a bit of info for you all.

There is a small bug in xva.py.

If your VM has a kernel/initrd loaded from Dom0, the xva that is produced will still be set to boot with pygrub.

In order to fix this, blank the PV-bootloader parameter on the VM:


xe vm-param-set uuid=<VM UUID>  PV-bootloader=""

Regards,

David


On 3 August 2011 14:17, Carsten from Virtastic <carsten@xxxxxxxxxxxxx> wrote:
Hi there,

> Hi, i have the same problem.
> Did you resolve it? if Yes, how?

The xva format has got a bit awkward structure. Basically it's a tar file that contains loads of numbered files of 1M size each, or an img file cut in stripes, if you will.

For example, the tar file would contain:

Ref:xxx/
 00000001
 00000002
 00000003
 ....
 00001029


If one of those stripes consists entirely of zero-bytes, it won't be included in the xva.
Names are always just numeric and 8 bytes in length, padded and filled with zeros as above.

I've only done the reverse process myself, that is converting xva into img, for about 40 VMs. What I've done is:

- unpack tar file
- go into the Ref:xxx folder (xxx is numeric, no idea how that is determined)
- run this very simple script:

================
#!/bin/bash

dd if =/dev/zero of=blank bs=1024 count=1k
test -f image.img && rm -f image.img
touch image.img

max=`ls ???????? | sort | tail -n1`

for i in `seq 0 $max`; do

 fn=`printf "%08d" $i`
 echo -n "$fn of $max"

if [ -f "$fn" ]; then
 echo " - appending chunk"
 cat $fn >> image.img
else
 echo " - filling blank"
 cat blank >> image.img
fi
done

rm -f blank

echo
"Done."
==============

Then I end up with an img file, which works perfectly fine with open source Xen.
Maybe that can help you reverse-engineer it :-)



Cheers
Carsten






_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.