Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume size ignored when creating from snapshot #320

Open
Cosmicoppai opened this issue Sep 21, 2024 · 2 comments
Open

Volume size ignored when creating from snapshot #320

Cosmicoppai opened this issue Sep 21, 2024 · 2 comments

Comments

@Cosmicoppai
Copy link

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.

@caiohsramos
Copy link
Contributor

@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.

@Cosmicoppai
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants