mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
ec2/create-amis.sh: specify the approriate size on snapshots
Should help with #15148
This commit is contained in:
parent
1d2fcde841
commit
364a4373cf
1 changed files with 6 additions and 1 deletions
|
@ -102,6 +102,11 @@ for type in hvm pv; do
|
||||||
mv $vhdFile.tmp $vhdFile
|
mv $vhdFile.tmp $vhdFile
|
||||||
fi
|
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)
|
taskId=$(cat $stateDir/$region.$type.task-id 2> /dev/null || true)
|
||||||
volId=$(cat $stateDir/$region.$type.vol-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)
|
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
|
rm -f $stateDir/$region.$type.vol-id
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extraFlags="-b /dev/sda1=$snapId:20:true:gp2"
|
extraFlags="-b /dev/sda1=$snapId:$vhdFileLogicalGigaBytes:true:gp2"
|
||||||
|
|
||||||
if [ $type = pv ]; then
|
if [ $type = pv ]; then
|
||||||
extraFlags+=" --root-device-name=/dev/sda1"
|
extraFlags+=" --root-device-name=/dev/sda1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue