Skip to content

Commit

Permalink
create BlockStorage v3 as copy of v2 (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka authored Jan 5, 2024
1 parent 1cad223 commit 47c8ed9
Show file tree
Hide file tree
Showing 51 changed files with 487 additions and 314 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ jobs:
echo OS_FLAVOR=1
echo OS_DOMAIN_ID=default
} >> "$GITHUB_ENV"
- name: Execute Block Storage tests
- name: Execute Block Storage v2 tests
if: matrix.block_storage_v2 == true
run: php ./tests/integration/run.php -s=BlockStorage
run: php ./tests/integration/run.php -s=BlockStorage -v=v2
- name: Execute Block Storage v3 tests
run: php ./tests/integration/run.php -s=BlockStorage -v=v3
- name: Execute Compute tests
if: matrix.block_storage_v2 == true
run: php ./tests/integration/run.php -s=Compute
- name: Execute Identity tests
run: php ./tests/integration/run.php -s=Identity
Expand Down
35 changes: 18 additions & 17 deletions COVERAGE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# OpenStack services coverage

|Name|PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
|---|:--:|:--:|:--:|:--:|:--:|:--:|
|Block Storage v2|✓|✓|✓|✓|✓|✓|
|Compute v2|✓|✓|✓|✓|✓|✓|
|Compute v2 exts|||||||
|Data Processing v1|||||||
|Database v1|||||||
|Identity v2|✓|✓|✓||||
|Identity v2 exts|||||||
|Identity v3|✓|✓|✓|✓|✓|✓|
|Identity v3 exts|||||||
|Images v2|✓|✓|✓|✓|✓|✓|
|Networking v2|✓|✓|✓|✓|✓|✓|
|Networking v2 exts|||||||
|Object Storage v1|✓|✓|✓|✓|✓|✓|
|Orchestration v1|||||||
|Telemetry v2|||||||
| Name |PHP classes|API definition|Unit tests|Sample files|Integration tests|Documentation|
|--------------------|:--:|:--:|:--:|:--:|:--:|:--:|
| Block Storage v2 |✓|✓|✓||✓||
| Block Storage v3 |✓|✓|✓|✓|✓|✓|
| Compute v2 |✓|✓|✓|✓|✓|✓|
| Compute v2 exts |||||||
| Data Processing v1 |||||||
| Database v1 |||||||
| Identity v2 |✓|✓|✓||||
| Identity v2 exts |||||||
| Identity v3 |✓|✓|✓|✓|✓|✓|
| Identity v3 exts |||||||
| Images v2 |✓|✓|✓|✓|✓|✓|
| Networking v2 |✓|✓|✓|✓|✓|✓|
| Networking v2 exts |||||||
| Object Storage v1 |✓|✓|✓|✓|✓|✓|
| Orchestration v1 |||||||
| Telemetry v2 |||||||

## Key

Expand Down
10 changes: 5 additions & 5 deletions doc/services/block-storage/v2/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Block Storage v2
================

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

volumes
volume-types
snapshots
.. sample:: BlockStorage/v2/create_service.php
9 changes: 9 additions & 0 deletions doc/services/block-storage/v3/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Block Storage v3
================

.. toctree::
:maxdepth: 3

volumes
volume-types
snapshots
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Snapshots
List volumes
------------

.. sample:: BlockStorage/v2/snapshots/list.php
.. sample:: BlockStorage/v3/snapshots/list.php
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listSnapshots

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

.. sample:: BlockStorage/v2/snapshots/list_sorted.php
.. sample:: BlockStorage/v3/snapshots/list_sorted.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Volume Types

Listing volume types
--------------------
.. sample:: BlockStorage/v2/volume_types/list.php
.. sample:: BlockStorage/v3/volume_types/list.php
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumeTypes

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

.. sample:: BlockStorage/v2/volume_types/create.php
.. sample:: BlockStorage/v3/volume_types/create.php
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_createVolumeType


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

.. sample:: BlockStorage/v2/volume_types/get.php
.. sample:: BlockStorage/v3/volume_types/get.php

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

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

.. sample:: BlockStorage/v2/volume_types/update.php
.. sample:: BlockStorage/v3/volume_types/update.php
.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_update


Expand All @@ -55,5 +55,5 @@ Delete volume type

To permanently delete a volume type:

.. sample:: BlockStorage/v2/volume_types/delete.php
.. sample:: BlockStorage/v3/volume_types/delete.php
.. refdoc:: OpenStack/BlockStorage/v2/Models/VolumeType.html#method_delete
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Volumes
List volumes
------------

.. sample:: BlockStorage/v2/volumes/list.php
.. sample:: BlockStorage/v3/volumes/list.php
.. refdoc:: OpenStack/BlockStorage/v2/Service.html#method_listVolumes

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

.. sample:: BlockStorage/v2/volumes/list_detail.php
.. sample:: BlockStorage/v3/volumes/list_detail.php

Create volume
-------------

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

.. sample:: BlockStorage/v2/volumes/create.php
.. sample:: BlockStorage/v3/volumes/create.php

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

.. sample:: BlockStorage/v2/volumes/create_from_image.php
.. sample:: BlockStorage/v3/volumes/create_from_image.php

Create from snapshot
~~~~~~~~~~~~~~~~~~~~

.. sample:: BlockStorage/v2/volumes/create_from_snapshot.php
.. sample:: BlockStorage/v3/volumes/create_from_snapshot.php

Create from source volume
~~~~~~~~~~~~~~~~~~~~~~~~~

.. sample:: BlockStorage/v2/volumes/create_from_source_volume.php
.. sample:: BlockStorage/v3/volumes/create_from_source_volume.php


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

.. sample:: BlockStorage/v2/volumes/get.php
.. sample:: BlockStorage/v3/volumes/get.php

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

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

.. sample:: BlockStorage/v2/volumes/update.php
.. sample:: BlockStorage/v3/volumes/update.php
.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_update

Delete volume
-------------

To permanently delete a volume:

.. sample:: BlockStorage/v2/volumes/delete.php
.. sample:: BlockStorage/v3/volumes/delete.php
.. refdoc:: OpenStack/BlockStorage/v2/Models/Volume.html#method_delete
12 changes: 12 additions & 0 deletions samples/BlockStorage/v2/create_service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => ['id' => '{userId}', 'password' => '{password}'],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV3();
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshot = $service->createSnapshot([
'volumeId' => '{volumeId}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshot = $service->getSnapshot('{snapshotId}');
$snapshot->delete();
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshot = $service->getSnapshot('{snapshotId}');
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$metadata = $service->getSnapshot('{snapshotId}')
->getMetadata();
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshots = $service->listSnapshots();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshots = $service->listSnapshots(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$snapshots = $service->listSnapshots(false, ['sortKey' => '{sortKey}', 'sortDir' => '{sortDir}']);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volumeType = $service->createVolumeType([
'name' => '{name}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volumeType = $service->getVolumeType('{volumeTypeId}');
$volumeType->delete();
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volumeType = $service->getVolumeType('{volumeTypeId}');
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volumeTypes = $service->listVolumeTypes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volumeType = $service->getVolumeType('{volumeTypeId}');
$volumeType->name = '{newName}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volume = $service->createVolume([
'description' => '{description}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volume = $service->createVolume([
'description' => '{description}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volume = $service->createVolume([
'description' => '{description}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'scope' => ['project' => ['id' => '{projectId}']]
]);

$service = $openstack->blockStorageV2();
$service = $openstack->blockStorageV3();

$volume = $service->createVolume([
'description' => '{description}',
Expand Down
Loading

0 comments on commit 47c8ed9

Please sign in to comment.