]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
xen-image-maker: add support vor XenCenter xva image output.
authorArne Fitzenreiter <arne_f@ipfire.org>
Thu, 22 May 2014 16:40:13 +0000 (18:40 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Thu, 22 May 2014 16:40:13 +0000 (18:40 +0200)
config/xen-image/README
config/xen-image/ipfire.cfg
config/xen-image/xen-image-maker.sh

index 3813572e00287031349e7abb0d67c46125a99ca4..a59b6fabb3928b24cec6e54884ef5ca823dd0d15 100644 (file)
@@ -18,3 +18,7 @@ other usefull commands from the Dom0:
 - shutdown the fire: "xm shutdown ipfire-xen"
 - reset the fire: "xm destroy ipfire-xen"
 - look what is going on: "xm top" or "xm list"
+
+This script can also build a Citrix XenCenter xva image.
+- run "XEN_IMAGE_TYPE=xva sh xen-image-maker.sh" to build an xva image.
+- import the vm with "xe vm-import file=ipfire.xfa"
index 594c82a5f9c3fcf844662069e4369ec847fa9986..38bfdff5e5146aa6f182f1cacc051bab1d5bb43a 100644 (file)
@@ -17,8 +17,8 @@ vif         = [
 
 
 disk = [
-               'file:/mnt/test/ipfire-boot.img,xvda1,w',
-               'file:/mnt/test/ipfire-swap.img,xvda2,w',
-               'file:/mnt/test/ipfire-root.img,xvda3,w',
-               'file:/mnt/test/ipfire-var.img,xvda4,w'
+               'file:./ipfire-boot.img,xvda1,w',
+               'file:./ipfire-swap.img,xvda2,w',
+               'file:./ipfire-root.img,xvda3,w',
+               'file:./ipfire-var.img,xvda4,w'
        ] #### Change path
index 762a86ec892a634b68eb3a86f72677710235152a..06f9f2e56452d98c15c6d6ef48a2b4ebace3b6a5 100644 (file)
@@ -51,6 +51,25 @@ IMGvar=./$SNAME-var.img
 
 KERNEL=linux-$KERN_TYPE-$KVER-$KERN_PACK.ipfire
 
+if [ "$XEN_IMG_TYPE" == "xva" ]; then
+       # download xva.py if it not exist.
+       if [ ! -e xva.py ]; then
+               wget http://source.ipfire.org/source-2.x/xva.py
+       fi
+       # XenCenter use other devicenames and
+       # xvdd seems to be reserved (converter bug?).
+       P1=xvda
+       P2=xvdb
+       P3=xvdc
+       P4=xvde
+else
+       # old style xen image partition names
+       P1=xvda1
+       P2=xvda2
+       P3=xvda3
+       P4=xvda4
+fi
+
 rm -rf $TMPDIR && mkdir -p $MNThdd && mkdir -p $ISODIR
 echo --------------------------------------------------------
 echo - Download $SOURCEISO ...
@@ -97,7 +116,8 @@ mount -o loop $IMGboot $MNThdd/boot
 mount -o loop $IMGvar $MNThdd/var
 
 # Install IPFire without kernel modules
-tar -C $MNThdd/ -xvf $ISODIR/$SNAME-$VERSION.tlz --lzma \
+xz -d < $ISODIR/$SNAME-$VERSION.tlz > $TMPDIR/$SNAME-$VERSION.tar
+tar -C $MNThdd/ -xvf $TMPDIR/$SNAME-$VERSION.tar \
        --exclude=lib/modules* --exclude=boot* --numeric-owner
 
 #Install Kernel
@@ -110,7 +130,7 @@ mkdir $MNThdd/boot/grub
 echo "timeout 10"                          > $MNThdd/boot/grub/grub.conf
 echo "default 0"                          >> $MNThdd/boot/grub/grub.conf
 echo "title IPFire ($KERN_TYPE-kernel)"   >> $MNThdd/boot/grub/grub.conf
-echo "  kernel /vmlinuz-$KVER-ipfire-$KERN_TYPE root=/dev/xvda3 rootdelay=10 panic=10 console=$CONSOLE ro" \
+echo "  kernel /vmlinuz-$KVER-ipfire-$KERN_TYPE root=/dev/$P3 rootdelay=10 panic=10 console=$CONSOLE ro" \
                                          >> $MNThdd/boot/grub/grub.conf
 echo "  initrd /ipfirerd-$KVER-$KERN_TYPE.img" >> $MNThdd/boot/grub/grub.conf
 echo "# savedefault 0" >> $MNThdd/boot/grub/grub.conf
@@ -139,10 +159,10 @@ mount --bind /proc $MNThdd/proc
 mount --bind /dev  $MNThdd/dev
 mount --bind /sys  $MNThdd/sys
 chroot $MNThdd /usr/bin/perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
-sed -i -e "s|DEVICE1|/dev/xvda1|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE2|/dev/xvda2|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE3|/dev/xvda3|g" $MNThdd/etc/fstab
-sed -i -e "s|DEVICE4|/dev/xvda4|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE1|/dev/$P1|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE2|/dev/$P2|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE3|/dev/$P3|g" $MNThdd/etc/fstab
+sed -i -e "s|DEVICE4|/dev/$P4|g" $MNThdd/etc/fstab
 
 sed -i -e "s|FSTYPE|$FSTYPE|g" $MNThdd/etc/fstab
 
@@ -181,6 +201,11 @@ umount $MNThdd
 
 umount $ISODIR
 rm -rf ./ipfire-tmp
+
+if [ "$XEN_IMG_TYPE" == "xva" ]; then
+       python xva.py --sparse -c $SNAME.cfg -f $SNAME.xva
+       rm -f $SNAME*.img
+fi
 echo --------------------------------------------------------
 echo - Done.
 echo --------------------------------------------------------