Server groups let you express affinity or anti-affinity placement rules for Nova servers.
.. osdoc:: https://docs.openstack.org/api-ref/compute/#server-groups-os-server-groups
.. sample:: Compute/v2/server_groups/list.php
Each iteration will return a :php:class:`ServerGroup` instance <OpenStack/Compute/v2/Models/ServerGroup.html>.
Admin-only listing across all projects is also available:
$serverGroups = $service->listServerGroups([
'allProjects' => true,
]);Use name and policies for the baseline Compute API:
.. sample:: Compute/v2/server_groups/create.php
If the Compute service is created with microversion 2.64 or later, you can use the singular policy field and
optional rules object instead:
.. sample:: Compute/v2/server_groups/create_2_64.php
When Nova responds with the newer singular policy field, the SDK also exposes that value as the first item in
policies for compatibility with the older response shape.
.. sample:: Compute/v2/server_groups/read.php
.. sample:: Compute/v2/server_groups/delete.php