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

create server from snapshot #1998

Open
tormath1 opened this issue Feb 14, 2024 · 2 comments
Open

create server from snapshot #1998

tormath1 opened this issue Feb 14, 2024 · 2 comments
Assignees
Labels
documentation instance Instance issues, bugs and feature requests priority:medium Improvements that are not the main priority question Further information is requested

Comments

@tormath1
Copy link

Hello folks, I'm trying to create a server from an existing snapshot with:

res, err := a.instance.CreateServer(&instance.CreateServerRequest{
	Name:  "my-name",
	Volumes: map[string]*instance.VolumeServerTemplate{
		"0": {
			BaseSnapshot: "my-snapshot-uuid",
			VolumeType: instance.VolumeVolumeTypeLSSD,
		},
	},
	...
})

It fails with:

scaleway-sdk-go: invalid argument(s): image does not respect constraint, required key not provided; volumes.0.base_snapshot does not respect constraint, extra keys not allowed; volumes.0.id does not respect constraint, required key not provided; volumes.0.volume_type does not respect constraint, not a valid value

I have two questions:

  1. It seems that the Image field is required but I don't use an image since I'm using a snapshot to boot the instance so I'm not sure what to do with this.
  2. In the Volumes is there an expected key format ? I use 0 to match what I've seen in the API calls when creating an instance from a snapshot on the web console.

Thanks for any guidance :D

@Mia-Cross Mia-Cross added instance Instance issues, bugs and feature requests question Further information is requested labels Feb 14, 2024
@Codelax
Copy link
Member

Codelax commented Feb 14, 2024

Hi,
A Volume name is missing for the request to work, I understand that the error message is misleading, validation is subject to improvements.

You can find details about this behavior in our API doc.
For the use case "Create a volume from a snapshot", you need to specify those fields in your volume:

  • base_snapshot
  • name
  • volume_type

@tormath1
Copy link
Author

Ah yes perfect - providing a volume name did the trick. Out of curiosity, why do we need to provide the volume name and its ID? I would expect the ID to be enough or I miss something?

@remyleone remyleone added priority:medium Improvements that are not the main priority documentation labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation instance Instance issues, bugs and feature requests priority:medium Improvements that are not the main priority question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants