Skip to content

Commit 47c8ed9

Browse files
authored
create BlockStorage v3 as copy of v2 (#378)
1 parent 1cad223 commit 47c8ed9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+487
-314
lines changed

.github/workflows/integration_tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ jobs:
8484
echo OS_FLAVOR=1
8585
echo OS_DOMAIN_ID=default
8686
} >> "$GITHUB_ENV"
87-
- name: Execute Block Storage tests
87+
- name: Execute Block Storage v2 tests
8888
if: matrix.block_storage_v2 == true
89-
run: php ./tests/integration/run.php -s=BlockStorage
89+
run: php ./tests/integration/run.php -s=BlockStorage -v=v2
90+
- name: Execute Block Storage v3 tests
91+
run: php ./tests/integration/run.php -s=BlockStorage -v=v3
9092
- name: Execute Compute tests
91-
if: matrix.block_storage_v2 == true
9293
run: php ./tests/integration/run.php -s=Compute
9394
- name: Execute Identity tests
9495
run: php ./tests/integration/run.php -s=Identity

COVERAGE.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# OpenStack services coverage
22

3-
|Name|PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
4-
|---|:--:|:--:|:--:|:--:|:--:|:--:|
5-
|Block Storage v2|✓|✓|✓|✓|✓|✓|
6-
|Compute v2|✓|✓|✓|✓|✓|✓|
7-
|Compute v2 exts|||||||
8-
|Data Processing v1|||||||
9-
|Database v1|||||||
10-
|Identity v2|✓|✓|✓||||
11-
|Identity v2 exts|||||||
12-
|Identity v3|✓|✓|✓|✓|✓|✓|
13-
|Identity v3 exts|||||||
14-
|Images v2|✓|✓|✓|✓|✓|✓|
15-
|Networking v2|✓|✓|✓|✓|✓|✓|
16-
|Networking v2 exts|||||||
17-
|Object Storage v1|✓|✓|✓|✓|✓|✓|
18-
|Orchestration v1|||||||
19-
|Telemetry v2|||||||
3+
| Name |PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
4+
|--------------------|:--:|:--:|:--:|:--:|:--:|:--:|
5+
| Block Storage v2 |✓|✓|✓||✓||
6+
| Block Storage v3 |✓|✓|✓|✓|✓|✓|
7+
| Compute v2 |✓|✓|✓|✓|✓|✓|
8+
| Compute v2 exts |||||||
9+
| Data Processing v1 |||||||
10+
| Database v1 |||||||
11+
| Identity v2 |✓|✓|✓||||
12+
| Identity v2 exts |||||||
13+
| Identity v3 |✓|✓|✓|✓|✓|✓|
14+
| Identity v3 exts |||||||
15+
| Images v2 |✓|✓|✓|✓|✓|✓|
16+
| Networking v2 |✓|✓|✓|✓|✓|✓|
17+
| Networking v2 exts |||||||
18+
| Object Storage v1 |✓|✓|✓|✓|✓|✓|
19+
| Orchestration v1 |||||||
20+
| Telemetry v2 |||||||
2021

2122
## Key
2223

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Block Storage v2
22
================
33

4-
.. toctree::
5-
:maxdepth: 3
4+
Block Storage v2 API is deprecated since Pike release and was removed in the Xena release.
5+
It is recommended to use Block Storage v3 API instead. However most of endpoints are identical, so if you still need
6+
to use Block Storage v2 API, you can use the change `$openstack->blockStorageV3()` to `$openstack->blockStorageV2()` in examples.
7+
In most cases it will work without any other changes.
68

7-
volumes
8-
volume-types
9-
snapshots
9+
.. sample:: BlockStorage/v2/create_service.php
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Block Storage v3
2+
================
3+
4+
.. toctree::
5+
:maxdepth: 3
6+
7+
volumes
8+
volume-types
9+
snapshots

doc/services/block-storage/v2/snapshots.rst renamed to doc/services/block-storage/v3/snapshots.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Snapshots
44
List volumes
55
------------
66

7-
.. sample:: BlockStorage/v2/snapshots/list.php
7+
.. sample:: BlockStorage/v3/snapshots/list.php
88
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listSnapshots
99

1010
Each iteration will return a php:class:`Snapshot` instance <OpenStack/BlockStorage/v2/Models/Snapshot.html>.
@@ -23,4 +23,4 @@ Possible values for sort_dir are:
2323
* asc
2424
* desc
2525

26-
.. sample:: BlockStorage/v2/snapshots/list_sorted.php
26+
.. sample:: BlockStorage/v3/snapshots/list_sorted.php

doc/services/block-storage/v2/volume-types.rst renamed to doc/services/block-storage/v3/volume-types.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Volume Types
33

44
Listing volume types
55
--------------------
6-
.. sample:: BlockStorage/v2/volume_types/list.php
6+
.. sample:: BlockStorage/v3/volume_types/list.php
77
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumeTypes
88

99
Each iteration will return a :php:class:`VolumeType` instance <OpenStack/BlockStorage/v2/Models/VolumeType.html>.
@@ -17,7 +17,7 @@ Create volume type
1717
The only attributes that are required when creating a volume are a name. The simplest example
1818
would therefore be this:
1919

20-
.. sample:: BlockStorage/v2/volume_types/create.php
20+
.. sample:: BlockStorage/v3/volume_types/create.php
2121
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_createVolumeType
2222

2323

@@ -27,7 +27,7 @@ Retrieve details of a volume type
2727
When retrieving a volume type, sometimes you only want to operate on it - say to update or delete it. If this is the
2828
case, then there is no need to perform an initial GET request to the API:
2929

30-
.. sample:: BlockStorage/v2/volume_types/get.php
30+
.. sample:: BlockStorage/v3/volume_types/get.php
3131

3232
If, however, you *do* want to retrieve all the details of a remote volume type from the API, you just call:
3333

@@ -46,7 +46,7 @@ Update a volume type
4646
The first step when updating a volume type is modifying the attributes you want updated. By default, only a volume
4747
type's name can be edited.
4848

49-
.. sample:: BlockStorage/v2/volume_types/update.php
49+
.. sample:: BlockStorage/v3/volume_types/update.php
5050
.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_update
5151

5252

@@ -55,5 +55,5 @@ Delete volume type
5555

5656
To permanently delete a volume type:
5757

58-
.. sample:: BlockStorage/v2/volume_types/delete.php
58+
.. sample:: BlockStorage/v3/volume_types/delete.php
5959
.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_delete

doc/services/block-storage/v2/volumes.rst renamed to doc/services/block-storage/v3/volumes.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Volumes
44
List volumes
55
------------
66

7-
.. sample:: BlockStorage/v2/volumes/list.php
7+
.. sample:: BlockStorage/v3/volumes/list.php
88
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumes
99

1010
Each iteration will return a php:class:`Volume` instance <OpenStack/BlockStorage/v2/Models/Volume.html>.
@@ -17,15 +17,15 @@ Detailed information
1717
By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information
1818
for a flavor, you must enable detailed information, like so:
1919

20-
.. sample:: BlockStorage/v2/volumes/list_detail.php
20+
.. sample:: BlockStorage/v3/volumes/list_detail.php
2121

2222
Create volume
2323
-------------
2424

2525
The only attributes that are required when creating a volume are a size in GiB. The simplest example
2626
would therefore be this:
2727

28-
.. sample:: BlockStorage/v2/volumes/create.php
28+
.. sample:: BlockStorage/v3/volumes/create.php
2929

3030
You can further configure your new volume, however, by following the below sections, which instruct you how to add
3131
specific functionality.
@@ -35,17 +35,17 @@ specific functionality.
3535
Create from image
3636
~~~~~~~~~~~~~~~~~
3737

38-
.. sample:: BlockStorage/v2/volumes/create_from_image.php
38+
.. sample:: BlockStorage/v3/volumes/create_from_image.php
3939

4040
Create from snapshot
4141
~~~~~~~~~~~~~~~~~~~~
4242

43-
.. sample:: BlockStorage/v2/volumes/create_from_snapshot.php
43+
.. sample:: BlockStorage/v3/volumes/create_from_snapshot.php
4444

4545
Create from source volume
4646
~~~~~~~~~~~~~~~~~~~~~~~~~
4747

48-
.. sample:: BlockStorage/v2/volumes/create_from_source_volume.php
48+
.. sample:: BlockStorage/v3/volumes/create_from_source_volume.php
4949

5050

5151
Retrieve volume details
@@ -54,7 +54,7 @@ Retrieve volume details
5454
When retrieving a volume, sometimes you only want to operate on it - say to update or delete it. If this is the case,
5555
then there is no need to perform an initial GET request to the API:
5656

57-
.. sample:: BlockStorage/v2/volumes/get.php
57+
.. sample:: BlockStorage/v3/volumes/get.php
5858

5959
If, however, you *do* want to retrieve all the details of a remote volume from the API, you just call:
6060

@@ -73,13 +73,13 @@ Update volume
7373
The first step when updating a volume is modifying the attributes you want updated. By default, only a volume's name
7474
and description can be edited.
7575

76-
.. sample:: BlockStorage/v2/volumes/update.php
76+
.. sample:: BlockStorage/v3/volumes/update.php
7777
.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_update
7878

7979
Delete volume
8080
-------------
8181

8282
To permanently delete a volume:
8383

84-
.. sample:: BlockStorage/v2/volumes/delete.php
84+
.. sample:: BlockStorage/v3/volumes/delete.php
8585
.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_delete
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
require 'vendor/autoload.php';
4+
5+
$openstack = new OpenStack\OpenStack([
6+
'authUrl' => '{authUrl}',
7+
'region' => '{region}',
8+
'user' => ['id' => '{userId}', 'password' => '{password}'],
9+
'scope' => ['project' => ['id' => '{projectId}']]
10+
]);
11+
12+
$service = $openstack->blockStorageV3();

samples/BlockStorage/v2/snapshots/create.php renamed to samples/BlockStorage/v3/snapshots/create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'scope' => ['project' => ['id' => '{projectId}']]
1010
]);
1111

12-
$service = $openstack->blockStorageV2();
12+
$service = $openstack->blockStorageV3();
1313

1414
$snapshot = $service->createSnapshot([
1515
'volumeId' => '{volumeId}',

samples/BlockStorage/v2/snapshots/delete.php renamed to samples/BlockStorage/v3/snapshots/delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'scope' => ['project' => ['id' => '{projectId}']]
1010
]);
1111

12-
$service = $openstack->blockStorageV2();
12+
$service = $openstack->blockStorageV3();
1313

1414
$snapshot = $service->getSnapshot('{snapshotId}');
1515
$snapshot->delete();

0 commit comments

Comments
 (0)