Skip to content

Commit a6f5052

Browse files
committed
CLOUDSTACK-1066: Wait for appliance to shutdown before exporting to various fmts
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent c97653b commit a6f5052

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎tools/appliance/build.sh‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
set -x
19+
set -e
1920

2021
appliance="systemvmtemplate"
2122
build_date=`date +%Y-%m-%d`
@@ -30,9 +31,15 @@ veewee vbox destroy $appliance
3031
veewee vbox build $appliance --nogui
3132
veewee vbox halt $appliance
3233

34+
while [[ `vboxmanage list runningvms | grep $appliance | wc -l` -ne 0 ]];
35+
do
36+
echo "Waiting for $appliance to shutdown"
37+
sleep 2;
38+
done
39+
3340
# Get appliance uuids
3441
machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'`
35-
hdd_uuid=`vboxmanage showvminfo $appliance | grep vhd | head -1 | awk '{print $8}' | cut -d ')' -f 1`
42+
hdd_uuid=`vboxmanage showvminfo $appliance | grep vmdk | head -1 | awk '{print $8}' | cut -d ')' -f 1`
3643

3744
# Start exporting
3845
rm -fr dist
@@ -45,18 +52,15 @@ vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.o
4552
# Export for HyperV
4653
vboxmanage clonehd $hdd_uuid $appliance-$build_date-$branch-hyperv.vhd --format VHD
4754
bzip2 $appliance-$build_date-$branch-hyperv.vhd
48-
rm $appliance-$build_date-$branch-hyperv.vhd
4955

5056
# Export for KVM
5157
vboxmanage clonehd $hdd_uuid raw.img --format RAW
5258
qemu-img convert -f raw -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2
5359
bzip2 $appliance-$build_date-$branch-kvm.qcow2
54-
rm $appliance-$build_date-$branch-kvm.qcow2
5560

5661
# Export for Xen
5762
# This will be an overwrite convert so, do it at the end
5863
vhd-util convert -s 0 -t 1 -i raw.img -o $appliance-$build_date-$branch-xen.vhd
59-
bzip2 $appliance-$build_date-$branch-hyperv.vhd
60-
rm $appliance-$build_date-$branch-hyperv.vhd
64+
bzip2 $appliance-$build_date-$branch-xen.vhd
6165

6266
cd $rootdir

‎tools/appliance/definitions/systemvmtemplate/definition.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Veewee::Definition.declare({
22
:cpu_count => '1',
33
:memory_size=> '256',
4-
:disk_size => '2048', :disk_format => 'VHD', :hostiocache => 'off',
4+
:disk_size => '2048', :disk_format => 'VMDK', :hostiocache => 'off',
55
:os_type_id => 'Debian',
66
:iso_file => "debian-wheezy-DI-b4-i386-netinst.iso",
77
:iso_src => "http://cdimage.debian.org/cdimage/wheezy_di_beta4/i386/iso-cd/debian-wheezy-DI-b4-i386-netinst.iso",

0 commit comments

Comments
 (0)