Retrieve metadata information from Openstack

Ceph is tightly integrated with Openstack and it is this latter the main access point to the storage from the user perspective. As a result, Openstack is the main source of information for the data stored on Ceph: Project names, project owners, quotas, etc. Some noteble exceptions remain, for example local S3 accounts on Gabe and the whole Nethub cluster.

This page collects some example of what it is possible to retrieve from Openstack to know better the storage items we manage.

The magic "services" project

To gain visibility on the metadata stored by Openstack, it is needed to have access to the services project in Openstack. Typically all members of ceph-admins are part of it. services is a special project with storage administrator capabilities that allows to retrieve various pieces of information on the whole Openstack instance and on existing projects, compute resources, storage, etc...

Use the services project simply by setting:

OS_PROJECT_NAME=services

Openstack Projects

Get the list of openstack projects with their names and IDs:

[ebocchi@aiadm81 ~]$ OS_PROJECT_NAME=services openstack project list | head -n 10
+--------------------------------------+------------------------------------------------------------------+
| ID                                   | Name                                                             |
+--------------------------------------+------------------------------------------------------------------+
| 0000d664-f697-423b-8595-57aea89be355 | Stuff...                                                         |
| 0007808b-2f41-41c5-bd7c-3bd1f1f94cb2 | Other stuff...                                                   |
| 00100a6d-b71c-415d-9dbc-3f78c2b8372a | Stuff continues...                                               |
| 001d902d-f76e-4222-a5d0-ca6529e8221f | ...                                                              |
| 0026e800-f134-4622-b0ef-4a03283a3965 | ...                                                              |
| 00292adf-92ad-4815-966c-a9296266b0a0 | ...                                                              |
| 004b5668-4ebe-418d-83bc-1cdadf059c85 | ...                                                              |

Get details of a project:

[ebocchi@aiadm81 ~]$ OS_PROJECT_NAME=services openstack project show 5d8ea54e-697d-446f-98f3-da1ce8f8b833
+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| chargegroup | af9298f2-041b-0944-7904-3b41fde4f97f |
| chargerole  | default                              |
| description | Ceph Storage Service                 |
| domain_id   | default                              |
| enabled     | True                                 |
| fim-lock    | True                                 |
| fim-skip    | True                                 |
| id          | 5d8ea54e-697d-446f-98f3-da1ce8f8b833 |
| is_domain   | False                                |
| name        | IT Ceph Storage Service              |
| options     | {}                                   |
| parent_id   | default                              |
| tags        | ['s3quota']                          |
| type        | service                              |
+-------------+--------------------------------------+

Identify the owner of a project:

[ebocchi@aiadm81 ~]$ OS_PROJECT_NAME=services openstack role assignment list --project 5d8ea54e-697d-446f-98f3-da1ce8f8b833 --names --role owner
+-------+------------------+-------+---------------------------------+--------+--------+-----------+
| Role  | User             | Group | Project                         | Domain | System | Inherited |
+-------+------------------+-------+---------------------------------+--------+--------+-----------+
| owner | dvanders@Default |       | IT Ceph Storage Service@Default |        |        | False     |
+-------+------------------+-------+---------------------------------+--------+--------+-----------+

Openstack Volumes

List the RBD volumes in a project:

[ebocchi@aiadm81 ~]$ OS_PROJECT_NAME=services openstack volume list --project 5d8ea54e-697d-446f-98f3-da1ce8f8b833
+--------------------------------------+--------------------+-----------+------+---------------------------------------------------------------+
| ID                                   | Name               | Status    | Size | Attached to                                                   |
+--------------------------------------+--------------------+-----------+------+---------------------------------------------------------------+
| 5143d9e4-8470-4ac4-821e-57ef99f24060 | buildkernel        | in-use    |  200 | Attached to 8afce55e-313f-432c-a764-b0ada783a268 on /dev/vdb  |
| c0f1a9f7-8308-412a-92da-afcc20db3c4c | clickhouse-data-01 | available |  500 |                                                               |
| 53406846-445f-4f47-b4c5-e8558bb1bbed | cephmirror-io1     | in-use    | 3000 | Attached to dfc9a14a-ff4b-490a-ab52-e6c9766205ad on /dev/vdc  |
| c2c31270-0b95-4e28-9ac0-6d9876ea7f32 | metrictank-data-01 | in-use    |  500 | Attached to fbdff7a0-7b5b-47c0-b496-5a8afcc8e528 on /dev/vdb  |
+--------------------------------------+--------------------+-----------+------+---------------------------------------------------------------+

Show details of a volume:

[ebocchi@aiadm81 ~]$ OS_PROJECT_NAME=services openstack volume show c0f1a9f7-8308-412a-92da-afcc20db3c4c
+--------------------------------+-------------------------------------------+
| Field                          | Value                                     |
+--------------------------------+-------------------------------------------+
| attachments                    | []                                        |
| availability_zone              | ceph-geneva-1                             |
| bootable                       | false                                     |
| consistencygroup_id            | None                                      |
| created_at                     | 2021-11-04T08:34:51.000000                |
| description                    |                                           |
| encrypted                      | False                                     |
| id                             | c0f1a9f7-8308-412a-92da-afcc20db3c4c      |
| migration_status               | None                                      |
| multiattach                    | False                                     |
| name                           | clickhouse-data-01                        |
| os-vol-host-attr:host          | cci-cinder-qa-w01.cern.ch@beesly#standard |
| os-vol-mig-status-attr:migstat | None                                      |
| os-vol-mig-status-attr:name_id | None                                      |
| os-vol-tenant-attr:tenant_id   | 5d8ea54e-697d-446f-98f3-da1ce8f8b833      |
| properties                     |                                           |
| replication_status             | None                                      |
| size                           | 500                                       |
| snapshot_id                    | None                                      |
| source_volid                   | None                                      |
| status                         | available                                 |
| type                           | io1                                       |
| updated_at                     | 2021-11-04T08:35:15.000000                |
| user_id                        | tmourati                                  |
+--------------------------------+-------------------------------------------+

Show the snapshots for a volume in a project:

[ebocchi@aiadm84 ~]$ OS_PROJECT_NAME=services openstack volume snapshot list --project 79b9e379-f89d-4b3a-9827-632b9bf16e98 --volume d182a910-b40a-4dc0-89b7-890d6fa01efd
+--------------------------------------+-------------------+-------------+-----------+-------+
| ID                                   | Name              | Description | Status    |  Size |
+--------------------------------------+-------------------+-------------+-----------+-------+
| 798d06dc-6af4-420d-89ce-1258104e1e0f | snapv_webstuff03  |             | available | 30000 |
+--------------------------------------+-------------------+-------------+-----------+-------+
Improve me !