Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1221163

Summary: [TEXT][REST] Wrong error is thrown when attempting an update command on a detached storage domain
Product: Red Hat Enterprise Virtualization Manager Reporter: Ori Gofen <ogofen>
Component: ovirt-engineAssignee: Idan Shaby <ishaby>
Status: CLOSED ERRATA QA Contact: Raz Tamir <ratamir>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.5.1CC: acanan, amureini, bazulay, gklein, ishaby, juan.hernandez, lpeer, lsurette, rbalakri, Rhev-m-bugs, srevivo, tnisan, ykaul, ylavi
Target Milestone: ovirt-4.0.0-alpha   
Target Release: 4.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt 4.0.0 alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-23 20:24:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ori Gofen 2015-05-13 12:00:49 UTC
Description of problem:
When executing domain.update() on a domain which is not attached to any datacenter an error is thrown:

>>> sd.update()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 16793, in update
    headers={"Correlation-Id":correlation_id}
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 78, in update
    return self.request('PUT', url, body, headers)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 118, in request
    persistent_auth=self._persistent_auth)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 146, in __doRequest
    persistent_auth=persistent_auth
  File "/usr/lib/python2.7/site-packages/ovirtsdk/web/connection.py", line 134, in doRequest
    raise RequestError, response
RequestError:
status: 409
reason: Conflict
detail: Cannot edit Storage. The relevant Storage Domain's status is Unknown."

while the relevant storage domain's status is well known to oVirt engine:

>>> sd.get_status().get_state()
'unattached'


Version-Release number of selected component (if applicable):
vt14.4

How reproducible:
100%

Steps to Reproduce:
1.detach a storage domain
2. try to update this domain from api:
sd = api.storagedomains.get($STORAGE_NAME)
sd.update()

Actual results:
a wrong and misleading error message

Expected results:
should change to "Cannot edit Storage. The relevant Storage Domain's status is unattached." 

Additional info:

Comment 1 Juan Hernández 2015-05-13 13:45:06 UTC
Apparently what is happening here is that the backend "UpdateStorageDomainCommand" is getting the status of the storage domain using the "StorageDomain.getStatus()" method, but this is implemented as "getStoragePoolIsoMapData().getStatus()" which, if I understand correctly, is valid only when the storage command is attached to a data center.

Comment 2 Allon Mureinik 2015-05-13 15:19:23 UTC
(In reply to Juan Hernández from comment #1)
> Apparently what is happening here is that the backend
> "UpdateStorageDomainCommand" is getting the status of the storage domain
> using the "StorageDomain.getStatus()" method, but this is implemented as
> "getStoragePoolIsoMapData().getStatus()" which, if I understand correctly,
> is valid only when the storage command is attached to a data center.
Yup.
Should be rethought in 3.6.0

Comment 3 Sandro Bonazzola 2015-10-26 12:48:02 UTC
this is an automated message. oVirt 3.6.0 RC3 has been released and GA is targeted to next week, Nov 4th 2015.
Please review this bug and if not a blocker, please postpone to a later release.
All bugs not postponed on GA release will be automatically re-targeted to

- 3.6.1 if severity >= high
- 4.0 if severity < high

Comment 4 Raz Tamir 2016-04-10 11:19:25 UTC
Response body from PUT on api/storagedomains/{sd_id}

<storage_domain>
  <name>nfs_x</name>
</storage_domain>

status: 409
<fault>
    <detail>[Cannot edit Storage. The relevant Storage Domain's status is Unattached.]</detail>
    <reason>Operation Failed</reason>
</fault>

Comment 7 errata-xmlrpc 2016-08-23 20:24:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-1743.html