Skip to content

Commit 19eae5c

Browse files
feat(instance): add support for unified volume type (#2338)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent 147b4de commit 19eae5c

9 files changed

+74
-16
lines changed

cmd/scw/testdata/test-all-usage-instance-image-create-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ARGS:
1717
[additional-snapshots.{index}.id] UUID of the snapshot to add
1818
[additional-snapshots.{index}.name] Name of the additional snapshot
1919
[additional-snapshots.{index}.size] Size of the additional snapshot
20-
[additional-snapshots.{index}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd)
20+
[additional-snapshots.{index}.volume-type] Underlying volume type of the additional snapshot (l_ssd | b_ssd | unified)
2121
[additional-snapshots.{index}.project-id] Project ID that own the additional snapshot
2222
[project-id] Project ID to use. If none is passed the default project ID will be used
2323
[tags.{index}] The tags of the image

cmd/scw/testdata/test-all-usage-instance-server-update-usage.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ ARGS:
3232
[boot-type] (local | bootscript | rescue)
3333
[tags.{index}] Tags of the server
3434
[volumes.{key}.boot=false] Force the server to boot on this volume
35+
[volumes.{key}.base-snapshot] The ID of the snapshot on which this volume will be based
36+
[volumes.{key}.project] Project ID of the volume
37+
[volumes.{key}.organization] Organization ID of the volume
3538
[bootscript]
3639
[dynamic-ip-required]
3740
[enable-ipv6]

cmd/scw/testdata/test-all-usage-instance-snapshot-create-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ARGS:
2020
volume-id UUID of the volume
2121
[tags.{index}] The tags of the snapshot
2222
[project-id] Project ID to use. If none is passed the default project ID will be used
23+
[volume-type] The volume type of the snapshot (unknown_volume_type | l_ssd | b_ssd | unified)
2324
[organization-id] Organization ID to use. If none is passed the default organization ID will be used
2425
[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)
2526

cmd/scw/testdata/test-all-usage-instance-snapshot-usage.golden

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ have a server with a volume containing the OS and another one
99
containing the application data, and you want to use different
1010
snapshot strategies on both volumes).
1111

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

1519
USAGE:
1620
scw instance snapshot <command>

cmd/scw/testdata/test-all-usage-instance-volume-create-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ARGS:
1919
[name=<generated>] The volume name
2020
[project-id] Project ID to use. If none is passed the default project ID will be used
2121
[tags.{index}] The volume tags
22-
[volume-type] The volume type (l_ssd | b_ssd)
22+
[volume-type] The volume type (l_ssd | b_ssd | unified)
2323
[size] The volume disk size
2424
[base-volume] The ID of the volume on which this volume will be based
2525
[base-snapshot] The ID of the snapshot on which this volume will be based

cmd/scw/testdata/test-all-usage-instance-volume-list-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ EXAMPLES:
2222
scw instance volume list volume-type=b_ssd name=foobar
2323

2424
ARGS:
25-
[volume-type] Filter by volume type (l_ssd | b_ssd)
25+
[volume-type] Filter by volume type (l_ssd | b_ssd | unified)
2626
[project-id] Filter volume by project ID
2727
[tags.{index}] Filter volumes with these exact tags (to filter with several tags, use commas to separate them)
2828
[name] Filter volume by name (for eg. "vol" will return "myvolume" but not "data")

cmd/scw/testdata/test-all-usage-instance-volume-usage.golden

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ We have two different types of volume (`volume_type`):
1313
your instance is running. As of today, `b_ssd` is only available
1414
for `DEV1`, `GP1` and `RENDER` offers.
1515

16+
note: The `unified` volume type is not available for volumes. This
17+
type can only be used on snapshots.
18+
1619
Minimum and maximum volume sizes for each volume types can be queried
1720
from the zone `/products/volumes` API endpoint. _I.e_ for:
1821
- `fr-par-1` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes

docs/commands/instance.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ scw instance image create [arg=value ...]
107107
| additional-snapshots.{index}.id | | UUID of the snapshot to add |
108108
| additional-snapshots.{index}.name | | Name of the additional snapshot |
109109
| additional-snapshots.{index}.size | | Size of the additional snapshot |
110-
| additional-snapshots.{index}.volume-type | One of: `l_ssd`, `b_ssd` | Underlying volume type of the additional snapshot |
110+
| additional-snapshots.{index}.volume-type | One of: `l_ssd`, `b_ssd`, `unified` | Underlying volume type of the additional snapshot |
111111
| additional-snapshots.{index}.project-id | | Project ID that own the additional snapshot |
112112
| ~~additional-snapshots.{index}.organization-id~~ | Deprecated | Organization ID that own the additional snapshot |
113113
| project-id | | Project ID to use. If none is passed the default project ID will be used |
@@ -1764,6 +1764,9 @@ scw instance server update <server-id ...> [arg=value ...]
17641764
| boot-type | One of: `local`, `bootscript`, `rescue` | |
17651765
| tags.{index} | | Tags of the server |
17661766
| volumes.{key}.boot | Default: `false` | Force the server to boot on this volume |
1767+
| volumes.{key}.base-snapshot | | The ID of the snapshot on which this volume will be based |
1768+
| volumes.{key}.project | | Project ID of the volume |
1769+
| volumes.{key}.organization | | Organization ID of the volume |
17671770
| bootscript | | |
17681771
| dynamic-ip-required | | |
17691772
| enable-ipv6 | | |
@@ -1897,8 +1900,12 @@ have a server with a volume containing the OS and another one
18971900
containing the application data, and you want to use different
18981901
snapshot strategies on both volumes).
18991902

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

19031910

19041911

@@ -1921,6 +1928,7 @@ scw instance snapshot create [arg=value ...]
19211928
| volume-id | Required | UUID of the volume |
19221929
| tags.{index} | | The tags of the snapshot |
19231930
| project-id | | Project ID to use. If none is passed the default project ID will be used |
1931+
| volume-type | One of: `unknown_volume_type`, `l_ssd`, `b_ssd`, `unified` | The volume type of the snapshot |
19241932
| organization-id | | Organization ID to use. If none is passed the default organization ID will be used |
19251933
| 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 |
19261934

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

2210+
note: The `unified` volume type is not available for volumes. This
2211+
type can only be used on snapshots.
2212+
22022213
Minimum and maximum volume sizes for each volume types can be queried
22032214
from the zone `/products/volumes` API endpoint. _I.e_ for:
22042215
- `fr-par-1` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes
@@ -2237,7 +2248,7 @@ scw instance volume create [arg=value ...]
22372248
| name | Default: `<generated>` | The volume name |
22382249
| project-id | | Project ID to use. If none is passed the default project ID will be used |
22392250
| tags.{index} | | The volume tags |
2240-
| volume-type | One of: `l_ssd`, `b_ssd` | The volume type |
2251+
| volume-type | One of: `l_ssd`, `b_ssd`, `unified` | The volume type |
22412252
| size | | The volume disk size |
22422253
| base-volume | | The ID of the volume on which this volume will be based |
22432254
| base-snapshot | | The ID of the snapshot on which this volume will be based |
@@ -2341,7 +2352,7 @@ scw instance volume list [arg=value ...]
23412352

23422353
| Name | | Description |
23432354
|------|---|-------------|
2344-
| volume-type | One of: `l_ssd`, `b_ssd` | Filter by volume type |
2355+
| volume-type | One of: `l_ssd`, `b_ssd`, `unified` | Filter by volume type |
23452356
| project-id | | Filter volume by project ID |
23462357
| tags.{index} | | Filter volumes with these exact tags (to filter with several tags, use commas to separate them) |
23472358
| name | | Filter volume by name (for eg. "vol" will return "myvolume" but not "data") |

internal/namespaces/instance/v1/instance_cli.go

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,12 @@ have a server with a volume containing the OS and another one
217217
containing the application data, and you want to use different
218218
snapshot strategies on both volumes).
219219
220-
Snapshots only work on ` + "`" + `l_ssd` + "`" + ` volume type at the moment. ` + "`" + `b_ssd` + "`" + `
221-
snapshots will be available starting 2020.
220+
A snapshot's volume type can be either its original volume's type
221+
(` + "`" + `l_ssd` + "`" + ` or ` + "`" + `b_ssd` + "`" + `) or ` + "`" + `unified` + "`" + `. Similarly, volumes can be created as well from snapshots
222+
of their own type or ` + "`" + `unified` + "`" + `. Therefore, to migrate data from a ` + "`" + `l_ssd` + "`" + ` volume
223+
to a ` + "`" + `b_ssd` + "`" + ` volume, one can create a ` + "`" + `unified` + "`" + ` snapshot from the original volume
224+
and a new ` + "`" + `b_ssd` + "`" + ` volume from this snapshot. The newly created volume will hold a copy
225+
of the data of the original volume.
222226
`,
223227
Namespace: "instance",
224228
Resource: "snapshot",
@@ -261,6 +265,9 @@ We have two different types of volume (` + "`" + `volume_type` + "`" + `):
261265
your instance is running. As of today, ` + "`" + `b_ssd` + "`" + ` is only available
262266
for ` + "`" + `DEV1` + "`" + `, ` + "`" + `GP1` + "`" + ` and ` + "`" + `RENDER` + "`" + ` offers.
263267
268+
note: The ` + "`" + `unified` + "`" + ` volume type is not available for volumes. This
269+
type can only be used on snapshots.
270+
264271
Minimum and maximum volume sizes for each volume types can be queried
265272
from the zone ` + "`" + `/products/volumes` + "`" + ` API endpoint. _I.e_ for:
266273
- ` + "`" + `fr-par-1` + "`" + ` use https://api.scaleway.com/instance/v1/zones/fr-par-1/products/volumes
@@ -588,7 +595,28 @@ func instanceServerUpdate() *core.Command {
588595
Required: false,
589596
Deprecated: false,
590597
Positional: false,
591-
EnumValues: []string{"l_ssd", "b_ssd"},
598+
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
599+
},
600+
{
601+
Name: "volumes.{key}.base-snapshot",
602+
Short: `The ID of the snapshot on which this volume will be based`,
603+
Required: false,
604+
Deprecated: false,
605+
Positional: false,
606+
},
607+
{
608+
Name: "volumes.{key}.project",
609+
Short: `Project ID of the volume`,
610+
Required: false,
611+
Deprecated: false,
612+
Positional: false,
613+
},
614+
{
615+
Name: "volumes.{key}.organization",
616+
Short: `Organization ID of the volume`,
617+
Required: false,
618+
Deprecated: false,
619+
Positional: false,
592620
},
593621
{
594622
Name: "bootscript",
@@ -1061,7 +1089,7 @@ func instanceImageCreate() *core.Command {
10611089
Required: false,
10621090
Deprecated: false,
10631091
Positional: false,
1064-
EnumValues: []string{"l_ssd", "b_ssd"},
1092+
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
10651093
},
10661094
{
10671095
Name: "extra-volumes.{key}.project",
@@ -1252,6 +1280,14 @@ func instanceSnapshotCreate() *core.Command {
12521280
Positional: false,
12531281
},
12541282
core.ProjectArgSpec(),
1283+
{
1284+
Name: "volume-type",
1285+
Short: `The volume type of the snapshot`,
1286+
Required: false,
1287+
Deprecated: false,
1288+
Positional: false,
1289+
EnumValues: []string{"unknown_volume_type", "l_ssd", "b_ssd", "unified"},
1290+
},
12551291
core.OrganizationArgSpec(),
12561292
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneFrPar3, scw.ZoneNlAms1, scw.ZoneNlAms2, scw.ZonePlWaw1),
12571293
},
@@ -1382,7 +1418,7 @@ func instanceVolumeList() *core.Command {
13821418
Required: false,
13831419
Deprecated: false,
13841420
Positional: false,
1385-
EnumValues: []string{"l_ssd", "b_ssd"},
1421+
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
13861422
},
13871423
{
13881424
Name: "project",
@@ -1521,7 +1557,7 @@ func instanceVolumeCreate() *core.Command {
15211557
Required: false,
15221558
Deprecated: false,
15231559
Positional: false,
1524-
EnumValues: []string{"l_ssd", "b_ssd"},
1560+
EnumValues: []string{"l_ssd", "b_ssd", "unified"},
15251561
},
15261562
{
15271563
Name: "size",

0 commit comments

Comments
 (0)