Converting a raw image to XenServer - VHD

4:10 PM
Converting a raw image to XenServer - VHD -

If the choice of the XenServer hypervisor, and using the mail storage, virtual disks are stored in VHD format. I want to show how to convert a raw image to the VHD format.

The first option might be to use the qemu-img tool, specifying the vpc format. This solution works, until you decide to take a snapshot of this virtual disk. OpenStack is itself the creation of snapshots uploaded images, so I really need this feature. The road is to compile blktap2 utilities and patch. This patch is floating on the web, and needed some adjustments to work with version 4.2 xen

Patch and build

  1. Download the source xen vhd-util :.
     wget -q http://bits.xensource.com/oss-xen/release/4.2.0/xen-4.2.0.tar.gz
  2. Unpack the sources:
     tar - xzf xen-4.2.0.tar.gz 
  3. Go to tools:
     xen-4.2.0 cd / tools / 
  4. patch
     wget https://github.com/citrix-openstack/xenserver-utils/raw/master/blktap2.patch -qO - | patch -p0 
  5. Set
     ./ configure --disable-monitor --disable-ocamltools --disable-rombios --disable-seabios 
  6. Brand:
     do 

Create an image VHD

I'll use a qcow2 picture, convert plain with qemu-img, and use vhd-util to convert to vhd

  1.  cd blktap2 / vhd 
  2.  export LD_LIBRARY_PATH = lib / 
  3.  https wget: //launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
  4.  qemu-img convert crude Cirros -O-0.3 .0-x86_64-disk.img cirros.raw 
  5. as a time stamp is stored in the VHD file, and it is controlled by the plug-in xapi OpenStack, I have to turn back time, to avoid "invalid primary footer: creation date in future errors" that come from vhd-util check -n vhdfile , so using faketime:
     faketime '2010-01-01'. / vhd-util convert - s 0 -t 1 -i -o cirros.raw cirros.vhd 
  6.  faketime '01 .01.2010 './vhd-util convert -s -t 1 2 -i -o Cirros .vhd 0.vhd 

References

  • A report bug redhat / demand calling for the conversion feature
  • original patch Alfred song
  • Instructions on how to use the conversion function
Previous
Next Post »
0 Komentar