Skip to content

Commit

Permalink
feat(instance): add support for unified volume type (#2338)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémy Léone <rleone@scaleway.com>
  • Loading branch information
scaleway-bot and remyleone committed Jun 6, 2022
1 parent 147b4de commit 19eae5c
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ARGS:
[additional-snapshots.{index}.id] UUID of the snapshot to add
[additional-snapshots.{index}.name] Name of the additional snapshot
[additional-snapshots.{index}.size] Size of the additional snapshot
[additional-snapshots.{index}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd)
[additional-snapshots.{index}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd | unified)
[additional-snapshots.{index}.project-id] Project ID that own the additional snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[tags.{index}] The tags of the image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ ARGS:
[boot-type] (local | bootscript | rescue)
[tags.{index}] Tags of the server
[volumes.{key}.boot=false] Force the server to boot on this volume
[volumes.{key}.base-snapshot] The ID of the snapshot on which this volume will be based
[volumes.{key}.project] Project ID of the volume
[volumes.{key}.organization] Organization ID of the volume
[bootscript]
[dynamic-ip-required]
[enable-ipv6]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ARGS:
volume-id UUID of the volume
[tags.{index}] The tags of the snapshot
[project-id] Project ID to use. If none is passed the default project ID will be used
[volume-type] The volume type of the snapshot (unknown_volume_type | l_ssd | b_ssd | unified)
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
[zone=fr-par-1] Zone to target. If none is passed will use default zone from the config (fr-par-1 | fr-par-2 | fr-par-3 | nl-ams-1 | nl-ams-2 | pl-waw-1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ have a server with a volume containing the OS and another one
containing the application data, and you want to use different
snapshot strategies on both volumes).

Snapshots only work on `l_ssd` volume type at the moment. `b_ssd`
snapshots will be available starting 2020.
A snapshot's volume type can be either its original volume's type
(`l_ssd` or `b_ssd`) or `unified`. Similarly, volumes can be created as well from snapshots
of their own type or `unified`. Therefore, to migrate data from a `l_ssd` volume
to a `b_ssd` volume, one can create a `unified` snapshot from the original volume
and a new `b_ssd` volume from this snapshot. The newly created volume will hold a copy
of the data of the original volume.

USAGE:
scw instance snapshot <command>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARGS:
[name=<generated>] The volume name
[project-id] Project ID to use. If none is passed the default project ID will be used
[tags.{index}] The volume tags
[volume-type] The volume type (l_ssd | b_ssd)
[volume-type] The volume type (l_ssd | b_ssd | unified)
[size] The volume disk size
[base-volume] The ID of the volume on which this volume will be based
[base-snapshot] The ID of the snapshot on which this volume will be based
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ EXAMPLES:
scw instance volume list volume-type=b_ssd name=foobar

ARGS:
[volume-type] Filter by volume type (l_ssd | b_ssd)
[volume-type] Filter by volume type (l_ssd | b_ssd | unified)
[project-id] Filter volume by project ID
[tags.{index}] Filter volumes with these exact tags (to filter with several tags, use commas to separate them)
[name] Filter volume by name (for eg. "vol" will return "myvolume" but not "data")
Expand Down
3 changes: 3 additions & 0 deletions cmd/scw/testdata/test-all-usage-instance-volume-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ We have two different types of volume (`volume_type`):
your instance is running. As of today, `b_ssd` is only available
for `DEV1`, `GP1` and `RENDER` offers.

note: The `unified` volume type is not available for volumes. This
type can only be used on snapshots.

Minimum and maximum volume sizes for each volume types can be queried
from the zone `/products/volumes` API endpoint. _I.e_ for:
- `fr-par-1` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes
Expand Down
21 changes: 16 additions & 5 deletions docs/commands/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ scw instance image create [arg=value ...]
| additional-snapshots.{index}.id | | UUID of the snapshot to add |
| additional-snapshots.{index}.name | | Name of the additional snapshot |
| additional-snapshots.{index}.size | | Size of the additional snapshot |
| additional-snapshots.{index}.volume-type | One of: `l_ssd`, `b_ssd` | Underlying volume type of the additional snapshot |
| additional-snapshots.{index}.volume-type | One of: `l_ssd`, `b_ssd`, `unified` | Underlying volume type of the additional snapshot |
| additional-snapshots.{index}.project-id | | Project ID that own the additional snapshot |
| ~~additional-snapshots.{index}.organization-id~~ | Deprecated | Organization ID that own the additional snapshot |
| project-id | | Project ID to use. If none is passed the default project ID will be used |
Expand Down Expand Up @@ -1764,6 +1764,9 @@ scw instance server update <server-id ...> [arg=value ...]
| boot-type | One of: `local`, `bootscript`, `rescue` | |
| tags.{index} | | Tags of the server |
| volumes.{key}.boot | Default: `false` | Force the server to boot on this volume |
| volumes.{key}.base-snapshot | | The ID of the snapshot on which this volume will be based |
| volumes.{key}.project | | Project ID of the volume |
| volumes.{key}.organization | | Organization ID of the volume |
| bootscript | | |
| dynamic-ip-required | | |
| enable-ipv6 | | |
Expand Down Expand Up @@ -1897,8 +1900,12 @@ have a server with a volume containing the OS and another one
containing the application data, and you want to use different
snapshot strategies on both volumes).

Snapshots only work on `l_ssd` volume type at the moment. `b_ssd`
snapshots will be available starting 2020.
A snapshot's volume type can be either its original volume's type
(`l_ssd` or `b_ssd`) or `unified`. Similarly, volumes can be created as well from snapshots
of their own type or `unified`. Therefore, to migrate data from a `l_ssd` volume
to a `b_ssd` volume, one can create a `unified` snapshot from the original volume
and a new `b_ssd` volume from this snapshot. The newly created volume will hold a copy
of the data of the original volume.



Expand All @@ -1921,6 +1928,7 @@ scw instance snapshot create [arg=value ...]
| volume-id | Required | UUID of the volume |
| tags.{index} | | The tags of the snapshot |
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| volume-type | One of: `unknown_volume_type`, `l_ssd`, `b_ssd`, `unified` | The volume type of the snapshot |
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
| zone | Default: `fr-par-1`<br />One of: `fr-par-1`, `fr-par-2`, `fr-par-3`, `nl-ams-1`, `nl-ams-2`, `pl-waw-1` | Zone to target. If none is passed will use default zone from the config |

Expand Down Expand Up @@ -2199,6 +2207,9 @@ We have two different types of volume (`volume_type`):
your instance is running. As of today, `b_ssd` is only available
for `DEV1`, `GP1` and `RENDER` offers.

note: The `unified` volume type is not available for volumes. This
type can only be used on snapshots.

Minimum and maximum volume sizes for each volume types can be queried
from the zone `/products/volumes` API endpoint. _I.e_ for:
- `fr-par-1` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes
Expand Down Expand Up @@ -2237,7 +2248,7 @@ scw instance volume create [arg=value ...]
| name | Default: `<generated>` | The volume name |
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| tags.{index} | | The volume tags |
| volume-type | One of: `l_ssd`, `b_ssd` | The volume type |
| volume-type | One of: `l_ssd`, `b_ssd`, `unified` | The volume type |
| size | | The volume disk size |
| base-volume | | The ID of the volume on which this volume will be based |
| base-snapshot | | The ID of the snapshot on which this volume will be based |
Expand Down Expand Up @@ -2341,7 +2352,7 @@ scw instance volume list [arg=value ...]

| Name | | Description |
|------|---|-------------|
| volume-type | One of: `l_ssd`, `b_ssd` | Filter by volume type |
| volume-type | One of: `l_ssd`, `b_ssd`, `unified` | Filter by volume type |
| project-id | | Filter volume by project ID |
| tags.{index} | | Filter volumes with these exact tags (to filter with several tags, use commas to separate them) |
| name | | Filter volume by name (for eg. "vol" will return "myvolume" but not "data") |
Expand Down
48 changes: 42 additions & 6 deletions internal/namespaces/instance/v1/instance_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ have a server with a volume containing the OS and another one
containing the application data, and you want to use different
snapshot strategies on both volumes).
Snapshots only work on ` + "`" + `l_ssd` + "`" + ` volume type at the moment. ` + "`" + `b_ssd` + "`" + `
snapshots will be available starting 2020.
A snapshot's volume type can be either its original volume's type
(` + "`" + `l_ssd` + "`" + ` or ` + "`" + `b_ssd` + "`" + `) or ` + "`" + `unified` + "`" + `. Similarly, volumes can be created as well from snapshots
of their own type or ` + "`" + `unified` + "`" + `. Therefore, to migrate data from a ` + "`" + `l_ssd` + "`" + ` volume
to a ` + "`" + `b_ssd` + "`" + ` volume, one can create a ` + "`" + `unified` + "`" + ` snapshot from the original volume
and a new ` + "`" + `b_ssd` + "`" + ` volume from this snapshot. The newly created volume will hold a copy
of the data of the original volume.
`,
Namespace: "instance",
Resource: "snapshot",
Expand Down Expand Up @@ -261,6 +265,9 @@ We have two different types of volume (` + "`" + `volume_type` + "`" + `):
your instance is running. As of today, ` + "`" + `b_ssd` + "`" + ` is only available
for ` + "`" + `DEV1` + "`" + `, ` + "`" + `GP1` + "`" + ` and ` + "`" + `RENDER` + "`" + ` offers.
note: The ` + "`" + `unified` + "`" + ` volume type is not available for volumes. This
type can only be used on snapshots.
Minimum and maximum volume sizes for each volume types can be queried
from the zone ` + "`" + `/products/volumes` + "`" + ` API endpoint. _I.e_ for:
- ` + "`" + `fr-par-1` + "`" + ` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes
Expand Down Expand Up @@ -588,7 +595,28 @@ func instanceServerUpdate() *core.Command {
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"l_ssd", "b_ssd"},
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
},
{
Name: "volumes.{key}.base-snapshot",
Short: `The ID of the snapshot on which this volume will be based`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "volumes.{key}.project",
Short: `Project ID of the volume`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "volumes.{key}.organization",
Short: `Organization ID of the volume`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "bootscript",
Expand Down Expand Up @@ -1061,7 +1089,7 @@ func instanceImageCreate() *core.Command {
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"l_ssd", "b_ssd"},
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
},
{
Name: "extra-volumes.{key}.project",
Expand Down Expand Up @@ -1252,6 +1280,14 @@ func instanceSnapshotCreate() *core.Command {
Positional: false,
},
core.ProjectArgSpec(),
{
Name: "volume-type",
Short: `The volume type of the snapshot`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown_volume_type", "l_ssd", "b_ssd", "unified"},
},
core.OrganizationArgSpec(),
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneFrPar3, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw1),
},
Expand Down Expand Up @@ -1382,7 +1418,7 @@ func instanceVolumeList() *core.Command {
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"l_ssd", "b_ssd"},
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
},
{
Name: "project",
Expand Down Expand Up @@ -1521,7 +1557,7 @@ func instanceVolumeCreate() *core.Command {
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"l_ssd", "b_ssd"},
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
},
{
Name: "size",
Expand Down

0 comments on commit 19eae5c

Please sign in to comment.