diff options
author | obadz <git@obadz.com> | 2016-05-02 17:44:11 +0100 |
---|---|---|
committer | obadz <git@obadz.com> | 2016-05-07 19:44:39 +0100 |
commit | 364a4373cf49663044ea073c5906301bca696574 (patch) | |
tree | 2aadac8c1482f2790a6dd0b8f5c2ac4d88fc0459 /nixos/maintainers/scripts | |
parent | 1d2fcde841a602332a61cb39c4db5ca7aa6616ab (diff) | |
download | nixlib-364a4373cf49663044ea073c5906301bca696574.tar nixlib-364a4373cf49663044ea073c5906301bca696574.tar.gz nixlib-364a4373cf49663044ea073c5906301bca696574.tar.bz2 nixlib-364a4373cf49663044ea073c5906301bca696574.tar.lz nixlib-364a4373cf49663044ea073c5906301bca696574.tar.xz nixlib-364a4373cf49663044ea073c5906301bca696574.tar.zst nixlib-364a4373cf49663044ea073c5906301bca696574.zip |
ec2/create-amis.sh: specify the approriate size on snapshots
Should help with #15148
Diffstat (limited to 'nixos/maintainers/scripts')
-rwxr-xr-x | nixos/maintainers/scripts/ec2/create-amis.sh | 7 |
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 1bf2a9c5830b..192f608e138f 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" |