Bug 1221163 - [TEXT][REST] Wrong error is thrown when attempting an update command on a detached storage domain
Summary: [TEXT][REST] Wrong error is thrown when attempting an update command on a det...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.5.1
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.0.0-alpha
: 4.0.0
Assignee: Idan Shaby
QA Contact: Raz Tamir
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-13 12:00 UTC by Ori Gofen
Modified: 2016-08-23 20:24 UTC (History)
14 users (show)

Fixed In Version: ovirt 4.0.0 alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-23 20:24:09 UTC
oVirt Team: Storage
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2016:1743 0 normal SHIPPED_LIVE Red Hat Virtualization Manager 4.0 GA Enhancement (ovirt-engine) 2016-09-02 21:54:01 UTC
oVirt gerrit 47657 0 master MERGED backend: improve storage domain illegal status message 2020-10-19 23:45:02 UTC
oVirt gerrit 47850 0 ovirt-engine-3.6 ABANDONED backend: improve storage domain illegal status message 2020-10-19 23:45:01 UTC

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


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