mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
CreateVolume, DeleteVolume, AttachVolume, DetachVolume, CreateTags and DeleteTags ignored DryRun=true and carried out the request. The AWS EBS CSI driver's controller sends a dry run CreateVolume, tagged CSIVolumeName=IopsLimitDryRun, every time it starts in order to probe the IOPS limits. AWS answers it with DryRunOperation and creates nothing, while Floci created a real 4 GiB volume, with its backing file, on every restart. A dry run DeleteVolume really deleted the volume. Each of these calls now runs the checks its real path makes and then answers DryRunOperation (HTTP 412) without changing anything, the convention ModifyVolume already follows. CreateVolume answers once its parameters and tag specification are read. DeleteVolume first requires the volume to exist and be detached. AttachVolume requires the volume, the instance, its state, the Availability Zone and the device to pass. DetachVolume requires the attachment to match and the root device rules to allow it. CreateTags checks the ids, the keys, the lengths, that each resource exists and the per-resource limit. DeleteTags checks the ids and the keys. No backing device is created, deleted, attached or detached by a dry run. Every handler read of DryRun goes through dryRun(p), which refuses a blank or non-boolean value with InvalidParameterValue, as DeleteSecurityGroup and DeleteLaunchTemplateVersions already did by hand; both now use it, and checkDryRun sits on it. Every DryRunOperation comes from Ec2Service.dryRunOperation(). Tests: a DryRun value that is not a boolean is refused on the six volume and tag calls; under IAM enforcement a dry run needs the caller's current permission. AwsSdkErrors.assertAwsError replaces the copies the route and S3 enforcement tests kept.