Skip to content

Commit

Permalink
fix compute v2
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ka committed Jan 19, 2024
1 parent d349536 commit fdfd5b6
Show file tree
Hide file tree
Showing 28 changed files with 175 additions and 197 deletions.
5 changes: 5 additions & 0 deletions doc/services/block-storage/v3/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Block Storage v3
================

OpenStack Block Storage API v3 (Cinder). Cinder is the OpenStack Block Storage service for providing volumes
to Nova virtual machines, Ironic bare metal hosts, containers and more.

.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/

.. toctree::
:maxdepth: 3

Expand Down
2 changes: 1 addition & 1 deletion doc/services/block-storage/v3/snapshots.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Snapshots
=========

a read-only point in time copy of a volume. The snapshot can be created from a volume that is currently in use
A snapshot is read-only point in time copy of a volume. The snapshot can be created from a volume that is currently in use
or in an available state. The snapshot can then be used to create a new volume.

.. osdoc:: https://docs.openstack.org/api-ref/block-storage/v3/#volume-snapshots-snapshots
Expand Down
12 changes: 12 additions & 0 deletions doc/services/compute/v2/create.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Create Service
==============

In order to work with the service you have to :doc:`setup the client </setup>` first.

Service can be created via ``blockStorageV3()`` method of the ``OpenStack`` object.

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

A list of additional options can be passed to the method. For example, to change the region:

.. sample:: BlockStorage/v3/create_with_region.php
46 changes: 18 additions & 28 deletions doc/services/compute/v2/flavors.rst
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
Flavors
=======

List flavors
------------
Flavors define the compute, memory, and storage capacity of nova computing instances. To put it simply, a flavor is
an available hardware configuration for a server. It defines the size of a virtual server that can be launched.

.. sample:: Compute/v2/flavors/list_flavors.php
.. refdoc:: OpenStack/Compute/v2/Service.html#method_listFlavors
.. osdoc:: https://docs.openstack.org/nova/latest/user/flavors.html

Each iteration will return a :php:class:`Flavor` instance <OpenStack/Compute/v2/Models/Flavor.html>.

.. include:: /common/generators.rst

Detailed information
~~~~~~~~~~~~~~~~~~~~
.. |models| replace:: flavors

By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information
for a flavor, you must pass ``true`` as the last parameter, like so:
.. include:: /common/service.rst

.. code-block:: php
Read
----

$flavors = $service->listFlavors([], function ($flavor) {
return $flavor;
}, true);
.. sample:: Compute/v2/flavors/read.php

Retrieve a flavor
-----------------
List
----

.. sample:: Compute/v2/flavors/get_flavor.php
.. refdoc:: OpenStack/Compute/v2/Service.html#method_getFlavor
.. sample:: Compute/v2/flavors/list.php

When retrieving a flavor, sometimes you only want to operate on it. If this is the case,
then there is no need to perform an initial ``GET`` request to the server:
Each iteration will return a :php:class:`Flavor` instance <OpenStack/Compute/v2/Models/Flavor.html>.

.. code-block:: php
.. include:: /common/generators.rst

// Get an unpopulated object
$flavor = $service->getFlavor(['id' => '{flavorId}']);
Detailed information
~~~~~~~~~~~~~~~~~~~~

If, however, you *do* want to retrieve all the details of a remote flavor from the API, you just call:
By default, only the ``id``, ``links`` and ``name`` attributes are returned. To return *all* information
for a flavor, you must pass ``true`` as the last parameter, like so:

.. code-block:: php
$flavor->retrieve();
$flavors = $service->listFlavors([], null, true);
which will update the state of the local object. This gives you an element of control over your app's performance.
18 changes: 6 additions & 12 deletions doc/services/compute/v2/images.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Images
======

.. warning::
These APIs are proxy calls to the :doc:`/services/images/v2/`Image service.
Nova has deprecated all the proxy APIs and users should use the native APIs instead.

.. osdoc:: https://docs.openstack.org/api-ref/compute/#images-deprecated

List images
-----------

Expand All @@ -9,7 +15,6 @@ List images
Each iteration will return an :apiref:Image instance <OpenStack/Compute/v2/Models/Image.html>_.

.. include:: /common/generators.rst
.. refdoc:: OpenStack/Compute/v2/Service.html#method_listImages

Detailed information
~~~~~~~~~~~~~~~~~~~~
Expand All @@ -28,7 +33,6 @@ When retrieving an image, sometimes you only want to operate on it - say to upda
then there is no need to perform an initial GET request to the server:

.. sample:: Compute/v2/images/get_image.php
.. refdoc:: OpenStack/Compute/v2/Service.html#method_getImage

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

Expand All @@ -42,7 +46,6 @@ Delete an image
---------------

.. sample:: Compute/v2/images/delete_image.php
.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_delete

Retrieve metadata
-----------------
Expand All @@ -53,8 +56,6 @@ This operation will retrieve the existing metadata for an image:

$metadata = $image->getMetadata();

.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_getMetadata

Reset metadata
--------------

Expand All @@ -63,8 +64,6 @@ Reset metadata
This operation will _replace_ all existing metadata with whatever is provided in the request. Any existing metadata
not specified in the request will be deleted.

.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_resetMetadata

Merge metadata
--------------

Expand All @@ -77,8 +76,6 @@ will be added. Any existing keys that are not specified in the request will rema
'foo' => 'bar',
]);

.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_mergeMetadata

Retrieve image metadata item
----------------------------

Expand All @@ -88,12 +85,9 @@ This operation allows you to retrieve the value for a specific metadata item:

$itemValue = $image->getMetadataItem('key');

.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_getMetadataItem

Delete image metadata item
--------------------------

This operation allows you to remove a specific metadata item:

.. sample:: Compute/v2/images/delete_image_metadata_item.php
.. refdoc:: OpenStack/Compute/v2/Models/Image.html#method_deleteMetadataItem
6 changes: 6 additions & 0 deletions doc/services/compute/v2/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Compute v2
==========

OpenStack Compute (Nova) API Version 2. Nova is the OpenStack project that provides a way to provision compute instances
(aka virtual servers).

.. osdoc:: https://docs.openstack.org/api-ref/compute/

.. toctree::
:maxdepth: 3

create
servers
flavors
images
Expand Down
Loading

0 comments on commit fdfd5b6

Please sign in to comment.