From 72da8249d910a307141bb9fec663d41cc28878bd Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 26 Jan 2022 13:35:20 -0500 Subject: [PATCH] Bugfix: Account for consumed space better When the volume service starts up, it goes through all volumes for a host in the db and adds up the volume size as a mechanism to account for that allocate space against the backend. The problem was that the volume manager was only counting volumes with a state of 'in-use' or 'available'. If a volume has a host set on it, then we account for it's allocated space. This patch adds other volume states to use to account for allocated space at volume service startup. Closes-Bug: 1910767 Change-Id: I90d5dfbe62e630dc8042e725d411cadc2762db56 --- cinder/volume/manager.py | 4 ++-- releasenotes/notes/bug-1910767-00f20702f5fc96db.yaml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1910767-00f20702f5fc96db.yaml diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 3aa32c66ee0..57ac77931e8 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -589,8 +589,8 @@ class VolumeManager(manager.CleanableManager, try: for volume in volumes: - # available volume should also be counted into allocated - if volume['status'] in ['in-use', 'available']: + # Account for volumes that have been provisioned already. + if volume['host']: # calculate allocated capacity for driver self._count_allocated_capacity(ctxt, volume) diff --git a/releasenotes/notes/bug-1910767-00f20702f5fc96db.yaml b/releasenotes/notes/bug-1910767-00f20702f5fc96db.yaml new file mode 100644 index 00000000000..2743e74dba3 --- /dev/null +++ b/releasenotes/notes/bug-1910767-00f20702f5fc96db.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + `Bug #1910767 `_: Fixed + the calculation of the allocated capacity for the volume manager. + The fix takes into account all volumes that have a host setting, not just + volumes with a status of 'in-use' or 'available'.