Add more metadata to volume.size and volume.backup.size pollster

When events are received from cinder, this includes the the volume_type_id
field (and not the volume_type name). Since Wallaby version it is now
possible to fetch this id from the API, so we can now make this poller
consistent with what is sent over the notification bus.

Another useful missing field for backups is the is_incremental field.

As the backup.user_id field was added in microversion 3.56, it makes sense
to add this information here as well to make it consistent with other
samples.

Closes-bug: #2064290
Change-Id: Ib109f399bab43ed8a6a0e0afea27ff0e5f7ae883
This commit is contained in:
Michel Nederlof 2024-04-30 16:23:38 +02:00
parent 15d080c465
commit 21f4484826
4 changed files with 28 additions and 3 deletions

View File

@ -63,6 +63,12 @@ VOLUME_LIST = [
u"size": u"1572864000"
},
'os-vol-mig-status-attr:name_id': None,
'group_id': None,
'provider_id': None,
'shared_targets': False,
'service_uuid': '2f6b5a18-0cd5-4421-b97e-d2c3e85ed758',
'cluster_name': None,
'volume_type_id': '65a9f65a-4696-4435-a09d-bc44d797c529',
'name': None,
'bootable': 'false',
'created_at': '2016-06-23T08:27:45.000000',
@ -95,6 +101,7 @@ SNAPSHOT_LIST = [
u"min_ram": u"0",
u"size": u"1572864000"
},
"group_snapshot_id": None,
'name': None})
]
@ -121,6 +128,8 @@ BACKUP_LIST = [
'6824974c08974d4db864bbaa6bc08303',
'fail_reason': u"",
'is_incremental': False,
'metadata': {},
'user_id': 'be255bd31eb944578000fc762fde6dcf',
'id': '75a52125-85ff-4a8d-b2aa-580f3b22273f',
'size': 1})
]

View File

@ -39,6 +39,7 @@ class VolumeSizePollster(_Base):
FIELDS = ['name',
'status',
'volume_type',
'volume_type_id',
'availability_zone',
'os-vol-host-attr:host',
'migration_status',
@ -96,6 +97,7 @@ class VolumeBackupSize(_Base):
return 'volume_backups'
FIELDS = ['name',
'is_incremental',
'object_count',
'container',
'volume_id',
@ -109,7 +111,7 @@ class VolumeBackupSize(_Base):
type=sample.TYPE_GAUGE,
unit='GB',
volume=backup.size,
user_id=None,
user_id=backup.user_id,
project_id=getattr(
backup, 'os-backup-project-attr:project_id', None),
resource_id=backup.id,

View File

@ -28,10 +28,12 @@ class _BaseDiscovery(plugin_base.DiscoveryBase):
def __init__(self, conf):
super(_BaseDiscovery, self).__init__(conf)
creds = conf.service_credentials
# NOTE(tobias-urdin): We set 3.43 (the maximum for Pike) because
# NOTE(mnederlof): We set 3.64 (the maximum for Wallaby) because:
# we need atleast 3.41 to get user_id on snapshots.
# we need atleast 3.56 for user_id and project_id on backups.
# we need atleast 3.63 for volume_type_id on volumes.
self.client = cinder_client.Client(
version='3.43',
version='3.64',
session=keystone_client.get_session(conf),
region_name=creds.region_name,
interface=creds.interface,

View File

@ -0,0 +1,12 @@
---
features:
- >
Add volume.volume_type_id and backup.is_incremental metadata for cinder
pollsters. Also user_id information is now included for backups with the
generated samples.
upgrade:
- >
The cinder api microversion has been increased from Pike to Wallaby
version (3.64) for volume/snapshot/backup related pollsters.
These might not work until the cinder API has been upgraded up to this
microversion.