From 19b594e8740726226e494eed125a71f357d38577 Mon Sep 17 00:00:00 2001 From: Alessandro Costantini Date: Wed, 19 Jun 2024 19:11:13 +0200 Subject: [PATCH] VolumeCreationTime variable added --- caso/extract/openstack/cinder.py | 1 + caso/record.py | 2 ++ requirements.txt | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/caso/extract/openstack/cinder.py b/caso/extract/openstack/cinder.py index 034794a1..ebed0518 100644 --- a/caso/extract/openstack/cinder.py +++ b/caso/extract/openstack/cinder.py @@ -66,6 +66,7 @@ def _build_record(self, volume, extract_from, extract_to): active_duration=active_duration, measure_time=measure_time, start_time=vol_created, + volume_creation=int(dateutil.parser.parse(vol_start).timestamp()), capacity=volume.size, user_dn=user, ) diff --git a/caso/record.py b/caso/record.py index 2ca04ff7..cd78c143 100644 --- a/caso/record.py +++ b/caso/record.py @@ -345,6 +345,7 @@ class StorageRecord(_BaseRecord): attached_to: typing.Optional[str] measure_time: datetime.datetime start_time: datetime.datetime + volume_creation: int storage_type: typing.Optional[str] = "Block Storage (cinder)" @@ -410,6 +411,7 @@ def map_fields(field: str) -> str: "attached_duration": "AttachedDuration", "cloud_type": "CloudType", "compute_service": "CloudComputeService", + "volume_creation": "VolumeCreationTime", } return d.get(field, field) diff --git a/requirements.txt b/requirements.txt index 4667ee56..17182add 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,4 +20,4 @@ python-neutronclient>=6.7.0 # Apache-2.0 keystoneauth1>=3.4.0 # Apache-2.0 stevedore -pydantic +pydantic==1.10.7