Bug 790186 - [ovirt] [vdsm] deactivate missing domain fails on UnboundLocal error
Summary: [ovirt] [vdsm] deactivate missing domain fails on UnboundLocal error
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: oVirt
Classification: Retired
Component: vdsm
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.3.4
Assignee: Dan Kenigsberg
QA Contact:
URL:
Whiteboard: storage
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-13 21:00 UTC by Haim
Modified: 2016-02-10 16:35 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-11 21:58:37 UTC
oVirt Team: Storage


Attachments (Terms of Use)

Description Haim 2012-02-13 21:00:24 UTC
Description of problem:

The following case is true when trying to deactivate missing storage domain (i.e - removed, deleted, no longer exists):

Thread-14935::WARNING::2012-02-13 22:42:52,096::sp::1063::Storage.StoragePool::(deactivateSD) deactivating missing domain 8150bd54-f64f-490e-98fd-e1efb7a250e1
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/sp.py", line 1057, in deactivateSD
    dom = sdCache.produce(sdUUID)
  File "/usr/share/vdsm/storage/sdc.py", line 91, in produce
    dom = self._findDomain(sdUUID)
  File "/usr/share/vdsm/storage/sdc.py", line 115, in _findDomain
    raise se.StorageDomainDoesNotExist(sdUUID)
StorageDomainDoesNotExist: Storage domain does not exist: ('8150bd54-f64f-490e-98fd-e1efb7a250e1',)
Thread-14935::ERROR::2012-02-13 22:42:52,097::task::855::TaskManager.Task::(_setError) Task=`f7c49c11-8195-4684-acce-d197e59f501b`::Unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 863, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/logUtils.py", line 38, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 897, in deactivateStorageDomain
    pool.deactivateSD(sdUUID, msdUUID, masterVersion)
  File "/usr/share/vdsm/storage/sp.py", line 1078, in deactivateSD
    dom.releaseHostId(self.id)
UnboundLocalError: local variable 'dom' referenced before assignment

Analysis: 

We start in sp,py, deactivateSD() function, we are trying to build domain list from cache, but exception is thrown, as 'domain' doesn't exits, code handles the following exceptions: se.StorageException, AttributeError, Timeout but not UnboundlocalError, so dom parameter object is not initialized, flow continues, and we try to use dom object in line 1078, but its not set. 

Result: domain stay up for good.

Comment 1 Haim 2012-02-13 21:10:49 UTC
(In reply to comment #0)
> Description of problem:
> 
> The following case is true when trying to deactivate missing storage domain
> (i.e - removed, deleted, no longer exists):
> 
> Thread-14935::WARNING::2012-02-13
> 22:42:52,096::sp::1063::Storage.StoragePool::(deactivateSD) deactivating
> missing domain 8150bd54-f64f-490e-98fd-e1efb7a250e1
> Traceback (most recent call last):
>   File "/usr/share/vdsm/storage/sp.py", line 1057, in deactivateSD
>     dom = sdCache.produce(sdUUID)
>   File "/usr/share/vdsm/storage/sdc.py", line 91, in produce
>     dom = self._findDomain(sdUUID)
>   File "/usr/share/vdsm/storage/sdc.py", line 115, in _findDomain
>     raise se.StorageDomainDoesNotExist(sdUUID)
> StorageDomainDoesNotExist: Storage domain does not exist:
> ('8150bd54-f64f-490e-98fd-e1efb7a250e1',)
> Thread-14935::ERROR::2012-02-13
> 22:42:52,097::task::855::TaskManager.Task::(_setError)
> Task=`f7c49c11-8195-4684-acce-d197e59f501b`::Unexpected error
> Traceback (most recent call last):
>   File "/usr/share/vdsm/storage/task.py", line 863, in _run
>     return fn(*args, **kargs)
>   File "/usr/share/vdsm/logUtils.py", line 38, in wrapper
>     res = f(*args, **kwargs)
>   File "/usr/share/vdsm/storage/hsm.py", line 897, in deactivateStorageDomain
>     pool.deactivateSD(sdUUID, msdUUID, masterVersion)
>   File "/usr/share/vdsm/storage/sp.py", line 1078, in deactivateSD
>     dom.releaseHostId(self.id)
> UnboundLocalError: local variable 'dom' referenced before assignment
> 
> Analysis: 
> 
> We start in sp,py, deactivateSD() function, we are trying to build domain list
> from cache, but exception is thrown, as 'domain' doesn't exits, code handles
> the following exceptions: se.StorageException, AttributeError, Timeout but not
> UnboundlocalError, so dom parameter object is not initialized, flow continues,
> and we try to use dom object in line 1078, but its not set. 

we shouldn't catch the UnboundlocalError, it happens due to the un-initialized object reference before assignment, we should not release host id once we fails though. 


> 
> Result: domain stay up for good.

Comment 2 Itamar Heim 2013-03-11 21:58:37 UTC
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.


Note You need to log in before you can comment on or make changes to this bug.