droplet_kit
droplet_kit copied to clipboard
Volume size ignored when creating from snapshot
When creating a new volume from a snapshot, the specified size is ignored, and the new volume takes on the size of the source snapshot instead.
Steps to reproduce:
require 'droplet_kit'
client = DropletKit::Client.new(access_token: 'api_token')
new_volume = DropletKit::Volume.new(
size_gigabytes: 200, # Attempting to create a 200GB volume
name: 'test-volume-from-snapshot',
region: 'nyc1',
snapshot_id: 'snapshot_id'
)
created_volume = client.volumes.create(new_volume)
puts "Created volume size: #{created_volume.size_gigabytes} GB"
Expected behavior: The new volume should be created with the specified size (200GB).
Actual behavior: The new volume is created with the size of the source snapshot (100 GB), ignoring the specified size_gigabytes parameter.
Environment:
- Ruby version: 3.1.0
- droplet_kit gem version: 3.21.0
- DigitalOcean API version: 2
This behavior makes it impossible to create a larger volume from a snapshot in a single API call.
@Cosmicoppai I think this isn't a issue with this project, it's just the way the API behaves. As described in the docs:
size_gigabytes (required|integer): The size of the block storage volume in GiB (1024^3). This field does not apply when creating a volume from a snapshot.
@caiohsramos Ah, thanks for pointing out. but it would be incredibly useful to have the option to specify a larger size when creating a volume from a snapshot.