Errors in volume usage audit script

Bug #1220140 reported by Michael Kerrin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Michael Kerrin

Bug Description

We are seeing the following errors from the volume usage audit in relation to snapshots:

Traceback (most recent call last):
  File "/usr/bin/cinder-volume-usage-audit", line 103, in <module>
    extra_info)
  File "/usr/lib/python2.7/dist-packages/cinder/volume/utils.py", line 139, in notify_about_snapshot_usage
    usage_info = _usage_from_snapshot(context, snapshot, **extra_usage_info)
  File "/usr/lib/python2.7/dist-packages/cinder/volume/utils.py", line 117, in _usage_from_snapshot
    'availability_zone': snapshot_ref.volume['availability_zone'],
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 168, in __get__
    return self.impl.get(instance_state(instance),dict_)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py", line 453, in get
    value = self.callable_(state, passive)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/strategies.py", line 481, in _load_for_state
    (mapperutil.state_str(state), self.key)
DetachedInstanceError: Parent instance <Snapshot at 0x3c45050> is not bound to a Session; lazy load operation of attribute 'volume' cannot proceed

And later we found the following error:

Traceback (most recent call last):
  File "/usr/bin/cinder-volume-usage-audit", line 103, in <module>
    extra_info)
  File "/usr/lib/python2.7/dist-packages/cinder/volume/utils.py", line 139, in notify_about_snapshot_usage
    usage_info = _usage_from_snapshot(context, snapshot, **extra_usage_info)
  File "/usr/lib/python2.7/dist-packages/cinder/volume/utils.py", line 117, in _usage_from_snapshot
    'availability_zone': snapshot_ref.volume['availability_zone'],
TypeError: 'NoneType' object has no attribute '__getitem__'

These are both two issue but both relate to the query used to find active snapshots in the audit window so I am putting into the one ticket.

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

Fix proposed to branch: master
Review: https://review.openstack.org/44868

Changed in cinder:
assignee: nobody → Michael Kerrin (michael-kerrin-w)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/44868
Committed: http://github.com/openstack/cinder/commit/f5e4e39664a233ebe655914f280b699138c6d9b4
Submitter: Jenkins
Branch: master

commit f5e4e39664a233ebe655914f280b699138c6d9b4
Author: Michael Kerrin <email address hidden>
Date: Tue Sep 3 12:53:34 2013 +0000

    Fix errors in volume usage audit script

    The snapshot_get_active_by_window DB query was returning snapshots
    where we couldn't access the related volume object. This was due to
    a) the volume not been loaded and the join failing due to detached
    session object.
    and b) the related volume was deleted so it didn't show return from
    the join

    Fixes bug: 1220140

    Change-Id: I0de993ba0ca482fa9ab80d4d5cdb0ff5cc8e4d7a

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: havana-3 → 2013.2
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.