aboutsummaryrefslogtreecommitdiff
path: root/nixos/maintainers
diff options
context:
space:
mode:
authorobadz <git@obadz.com>2016-05-02 17:44:11 +0100
committerobadz <git@obadz.com>2016-05-07 19:44:39 +0100
commit364a4373cf49663044ea073c5906301bca696574 (patch)
tree2aadac8c1482f2790a6dd0b8f5c2ac4d88fc0459 /nixos/maintainers
parent1d2fcde841a602332a61cb39c4db5ca7aa6616ab (diff)
ec2/create-amis.sh: specify the approriate size on snapshots
Should help with #15148
Diffstat (limited to 'nixos/maintainers')
-rwxr-xr-xnixos/maintainers/scripts/ec2/create-amis.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/maintainers/scripts/ec2/create-amis.sh b/nixos/maintainers/scripts/ec2/create-amis.sh
index 1bf2a9c5830..192f608e138 100755
--- a/nixos/maintainers/scripts/ec2/create-amis.sh
+++ b/nixos/maintainers/scripts/ec2/create-amis.sh
@@ -102,6 +102,11 @@ for type in hvm pv; do
mv $vhdFile.tmp $vhdFile
fi
+ vhdFileLogicalBytes="$(qemu-img info "$vhdFile" | grep ^virtual\ size: | cut -f 2 -d \( | cut -f 1 -d \ )"
+ vhdFileLogicalGigaBytes=$(((vhdFileLogicalBytes-1)/1024/1024/1024+1)) # Round to the next GB
+
+ echo "Disk size is $vhdFileLogicalBytes bytes. Will be registered as $vhdFileLogicalGigaBytes GB."
+
taskId=$(cat $stateDir/$region.$type.task-id 2> /dev/null || true)
volId=$(cat $stateDir/$region.$type.vol-id 2> /dev/null || true)
snapId=$(cat $stateDir/$region.$type.snap-id 2> /dev/null || true)
@@ -165,7 +170,7 @@ for type in hvm pv; do
rm -f $stateDir/$region.$type.vol-id
fi
- extraFlags="-b /dev/sda1=$snapId:20:true:gp2"
+ extraFlags="-b /dev/sda1=$snapId:$vhdFileLogicalGigaBytes:true:gp2"
if [ $type = pv ]; then
extraFlags+=" --root-device-name=/dev/sda1"