CLOUDSTACK-1066: Wait for appliance to shutdown before exporting to various fmts

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-02-19 11:33:45 +05:30
parent c97653b42e
commit a6f5052958
2 changed files with 10 additions and 6 deletions

View File

@ -16,6 +16,7 @@
# under the License.
set -x
set -e
appliance="systemvmtemplate"
build_date=`date +%Y-%m-%d`
@ -30,9 +31,15 @@ veewee vbox destroy $appliance
veewee vbox build $appliance --nogui
veewee vbox halt $appliance
while [[ `vboxmanage list runningvms | grep $appliance | wc -l` -ne 0 ]];
do
echo "Waiting for $appliance to shutdown"
sleep 2;
done
# Get appliance uuids
machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'`
hdd_uuid=`vboxmanage showvminfo $appliance | grep vhd | head -1 | awk '{print $8}' | cut -d ')' -f 1`
hdd_uuid=`vboxmanage showvminfo $appliance | grep vmdk | head -1 | awk '{print $8}' | cut -d ')' -f 1`
# Start exporting
rm -fr dist
@ -45,18 +52,15 @@ vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.o
# Export for HyperV
vboxmanage clonehd $hdd_uuid $appliance-$build_date-$branch-hyperv.vhd --format VHD
bzip2 $appliance-$build_date-$branch-hyperv.vhd
rm $appliance-$build_date-$branch-hyperv.vhd
# Export for KVM
vboxmanage clonehd $hdd_uuid raw.img --format RAW
qemu-img convert -f raw -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2
bzip2 $appliance-$build_date-$branch-kvm.qcow2
rm $appliance-$build_date-$branch-kvm.qcow2
# Export for Xen
# This will be an overwrite convert so, do it at the end
vhd-util convert -s 0 -t 1 -i raw.img -o $appliance-$build_date-$branch-xen.vhd
bzip2 $appliance-$build_date-$branch-hyperv.vhd
rm $appliance-$build_date-$branch-hyperv.vhd
bzip2 $appliance-$build_date-$branch-xen.vhd
cd $rootdir

View File

@ -1,7 +1,7 @@
Veewee::Definition.declare({
:cpu_count => '1',
:memory_size=> '256',
:disk_size => '2048', :disk_format => 'VHD', :hostiocache => 'off',
:disk_size => '2048', :disk_format => 'VMDK', :hostiocache => 'off',
:os_type_id => 'Debian',
:iso_file => "debian-wheezy-DI-b4-i386-netinst.iso",
:iso_src => "http://cdimage.debian.org/cdimage/wheezy_di_beta4/i386/iso-cd/debian-wheezy-DI-b4-i386-netinst.iso",