volume manager under reports allocated space

Bug #1910767 reported by Walt Boring
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Medium
Walt Boring

Bug Description

When the volume service starts up, the volume manager calls init_host to initialize the service and collect stats from the backend as well as calculate the allocated capacity of volumes that exist in the db already for a host.

The problem is that the volume manager only looks at volumes with a status of 'in-use' and 'available'. This leaves out many valid status values and results in under reporting of actual allocated capacity.

This calculation is only done at service startup time. Once the service is up, the volumes in those 'other' states can change and become valid volumes that occupy storage, that then cinder doesn't account for.

You can see the filtering and calculation here:
https://github.com/openstack/cinder/blob/master/cinder/volume/manager.py#L529-L541

Here is the list of other potential status values that should be used/considered:
attached, error_extending, extending, maintenance, error_deleting, reserved, awaiting_transfer

Changed in cinder:
status: New → Triaged
tags: added: allocation manager volume
Changed in cinder:
importance: Undecided → Medium
Revision history for this message
Walt Boring (walter-boring) wrote :

This is leading to errors in reporting of the allocated_space_gb turning negative.

At startup a volume could be in reserved, and then later fixed to available.
If that volume is deleted it's size is subtracted from the existing available space, when it wasn't
accounted for, leading to negative allocated space

Revision history for this message
Walt Boring (walter-boring) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/826510

Changed in cinder:
status: Triaged → In Progress
Changed in cinder:
assignee: nobody → Walt Boring (walter-boring)
Revision history for this message
Walt Boring (walter-boring) wrote :

Other related problems that I have discovered with underreporting allocated space.

temporary volumes are not being accounted for on a backend.
For example,
https://github.com/openstack/cinder/blob/master/cinder/volume/manager.py#L1070-L1074

This is of concern because the data copy operation can take some time depending on many factors,
and the scheduler is unaware of that space being allocated against that backend during this process.

Revision history for this message
Walt Boring (walter-boring) wrote :

Migrated volumes aren't updating the allocated_capacity_gb

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/826510
Committed: https://opendev.org/openstack/cinder/commit/72da8249d910a307141bb9fec663d41cc28878bd
Submitter: "Zuul (22348)"
Branch: master

commit 72da8249d910a307141bb9fec663d41cc28878bd
Author: Hemna <email address hidden>
Date: Wed Jan 26 13:35:20 2022 -0500

    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

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/cinder/+/863276

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/yoga)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/863276
Committed: https://opendev.org/openstack/cinder/commit/aa920e2fd4b6d34feef758620507c1bb728b70a2
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit aa920e2fd4b6d34feef758620507c1bb728b70a2
Author: Hemna <email address hidden>
Date: Wed Jan 26 13:35:20 2022 -0500

    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
    (cherry picked from commit 72da8249d910a307141bb9fec663d41cc28878bd)

tags: added: in-stable-yoga
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 22.0.0.0rc1

This issue was fixed in the openstack/cinder 22.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 20.2.0

This issue was fixed in the openstack/cinder 20.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.