mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* fix(ec2): create the EBS volumes a launch's block device mappings describe RunInstances gave every instance one 8 GiB root at /dev/xvda and took only the root's VolumeType from its block device mappings. Launches now plan their volumes before anything is stored: the AMI's mappings, or an 8 GiB root when it maps none, with the launch's own entries merged over them field by field, under either spelling of a device. The instance is rooted at the AMI's RootDeviceName. NoDevice removes an AMI device and a VirtualName entry takes one over, never the root. Snapshot sizes apply, a smaller size, a missing snapshot, a missing or invalid device name and a device named twice are refused with nothing stored, and IOPS and throughput are kept only for the types that take them. DescribeInstances lists every attached volume with its own state and DeleteOnTermination, and termination treats the root like any other volume. Volume reads settle attachments to an instance that ended terminated without TerminateInstances, as a failed container launch does. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): delete every volume of a launch that is rolled back A launch undone after its instances were stored, an instant CreateFleet whose later launch fails or a RunInstances whose capacity reservation was taken in the meantime, terminated its instances. Termination keeps the volumes whose DeleteOnTermination is false, so the refused launch left them behind as available. Each launch now records the volumes it creates on its reservation, and the rollback deletes those termination left unattached. The ids do not depend on attachments, which a read can end first when a failed container's volumes are settled. DeleteOnTermination is never changed, so an instance whose termination fails keeps its volumes as they were, and a volume attached to another instance since stays. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * fix(ec2): size a snapshot-only root from its snapshot For an AMI that maps no root device, the launch gave the root a fallback 8 GiB size before merging the launch's own entries, so a root entry naming only Ebs.SnapshotId kept that size and a larger snapshot was refused with InvalidBlockDeviceMapping. The fallback size now applies only after the merge, when the root names neither a size nor a snapshot. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> * perf(ec2): read volume attachments once per DescribeInstances Listing an instance's block device mapping scanned the whole volume store, once for every instance in a RunInstances or DescribeInstances response. The attachments of all the response's instances are now gathered in one scan per region and looked up per instance. Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com> --------- Signed-off-by: Jackson Price <59149601+jprice8@users.noreply.github.com>