Skip to content

ec2: EC2Snapshot.VolumeSize is a constant, no CreateSnapshot exists, and a named snapshot is never checked #689

Closed

Description

@scttfrdmn

Blocks the sixth refusal deliberately dropped from #671: Ebs.VolumeSize smaller than the snapshot's.

Three coupled gaps:

  1. EC2Snapshot.VolumeSize is the literal 8 at its single producer, createImage (emulator/ec2_plugin.go:3225) — so a size-vs-snapshot comparison would test a constant rather than a value the caller controls.
  2. No CreateSnapshot operation exists, so a caller cannot produce a snapshot of any other size.
  3. A block device mapping naming Ebs.SnapshotId is never checked for existence, so a launch from snap-000000000000deadb succeeds. Real EC2 answers InvalidSnapshot.NotFound.

(3) is worth doing on its own and is the smallest of the three; (1) and (2) are what make the #671 refusal meaningful.

Acceptance criteria

  • CreateSnapshot records the source volume's actual size, and createImage's snapshot does too.
  • A mapping naming a nonexistent Ebs.SnapshotId is refused with InvalidSnapshot.NotFound, before any write, in the validator ec2: an invalid block device mapping is accepted instead of refused with InvalidBlockDeviceMapping #671 added.
  • Ebs.VolumeSize smaller than the snapshot's size is refused with InvalidBlockDeviceMapping, and the message names both sizes.
  • A volume created from a snapshot with no explicit VolumeSize takes the snapshot's size.
  • The comment in ec2CheckBlockDeviceMappings recording why this refusal was deferred is replaced by the refusal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ec2type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions