After volume.refresh we forget the volume is locally attached

Bug #1868153 reported by Gorka Eguileor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cinderlib
Fix Released
Undecided
Gorka Eguileor

Bug Description

If we locally attach a volume and we call the refresh method on it then we cannot just call the detach method on the volume directly or we'll get the following exception:

2020-03-19 14:44:50.256 29142 CRITICAL cinder [req-8b9d5c3e-01f7-4670-bde2-6be920658773 cinderlib cinderlib - - -] Unhandled error: cinderlib.exception.NotLocal: Volume d7e4b3be-1190-4eaf-83b2-704bc58aca88 doesn't seem to be attached locally.
2020-03-19 14:44:50.256 29142 ERROR cinder Traceback (most recent call last): 2020-03-19 14:44:50.256 29142 ERROR cinder File "<stdin>", line 1, in <module>
2020-03-19 14:44:50.256 29142 ERROR cinder File "/home/vagrant/cinderlib/cinderlib/objects.py", line 562, in detach
2020-03-19 14:44:50.256 29142 ERROR cinder raise exception.NotLocal(self.id)
2020-03-19 14:44:50.256 29142 ERROR cinder cinderlib.exception.NotLocal: Volume d7e4b3be-1190-4eaf-83b2-704bc58aca88 doesn't seem to be attached locally.
2020-03-19 14:44:50.256 29142 ERROR cinder

So this works:
   volume.attach()
   volume.detach()

But this doesn't:
   volume.attach()
   volume.refresh()
   volume.detach()

Gorka Eguileor (gorka)
Changed in cinderlib:
assignee: nobody → Gorka Eguileor (gorka)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinderlib (master)

Fix proposed to branch: master
Review: https://review.opendev.org/713964

Changed in cinderlib:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinderlib (master)

Reviewed: https://review.opendev.org/713964
Committed: https://git.openstack.org/cgit/openstack/cinderlib/commit/?id=4e4247b248c3549b04b8c700fb174861185a13ec
Submitter: Zuul
Branch: master

commit 4e4247b248c3549b04b8c700fb174861185a13ec
Author: Gorka Eguileor <email address hidden>
Date: Thu Mar 19 16:21:49 2020 +0100

    NotLocal exception after refresh

    If we locally attach a volume and we call the refresh method on it then
    we cannot just call the detach method on the volume directly or we'll
    get a `NotLocal` exception.

    So this works:
       volume.attach()
       volume.detach()

    But this doesn't:
       volume.attach()
       volume.refresh()
       volume.detach()

    This is because we don't carry the `local_attach` attribute from our
    current instance into the refresh.

    Closes-Bug: #1868153
    Change-Id: Iaaac5576d443b7917a46bb11458860a9651bd366

Changed in cinderlib:
status: In Progress → Fix Released
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.