Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 991470 - Storage connection is left in db table in case adding storage domain fails
Summary: Storage connection is left in db table in case adding storage domain fails
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: 3.4.0
Assignee: Daniel Erez
QA Contact: Leonid Natapov
URL:
Whiteboard: storage
: 991739 1018250 (view as bug list)
Depends On:
Blocks: 1052231 rhev3.4beta 1142926
TreeView+ depends on / blocked
 
Reported: 2013-08-02 13:30 UTC by Jakub Libosvar
Modified: 2016-05-25 17:20 UTC (History)
18 users (show)

Fixed In Version: ovirt-3.4.0-beta2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-19 11:33:57 UTC
oVirt Team: Storage
Target Upstream Version:
scohen: Triaged+
scohen: Triaged+


Attachments (Terms of Use)
Backend log (deleted)
2013-08-02 13:30 UTC, Jakub Libosvar
no flags Details


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 23487 None None None Never

Description Jakub Libosvar 2013-08-02 13:30:42 UTC
Created attachment 781966 [details]
Backend log

Description of problem:
If adding a new storage domain fails due to sd name is containing a space then path of this nfs export is left in storage_server_connections. After fixing name of storage domain, storage domain cannot be added because storage connection already exists. This can be done via API only because frontend won't let user to use name with space.

Version-Release number of selected component (if applicable):
rhevm-3.3.0-0.9.master.el6ev.noarch

How reproducible:
Always

Steps to Reproduce:
1. Create an NFS storage domain using API. Domain name must contain space (this should fail nicely)
2. Try to create storage domain with the same path
3.

Actual results:
Step 2 fails because storage connection already exists

Expected results:
Step 2 succeeds

Additional info:
Works in 3.2, breaks storage regression test
2013-08-02 01:12:23,332 WARN  [org.ovirt.engine.core.bll.storage.AddNFSStorageDomainCommand] (ajp-/127.0.0.1:8702-1) CanDoAction of action AddNFSStorageDomain failed. Reasons:VAR__TYPE__STORAGE__DOMAIN,VALIDATION.STORAGE_DOMAIN.NAME.INVALID
2013-08-02 01:12:23,338 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-1) Operation Failed: [Storage Domain name must be formed of "a-z0-9A-Z" or "-_"]
2013-08-02 01:12:26,199 INFO  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-3) [222] Lock Acquired to object EngineLock [exclusiveLocks= key: 10.35.64.106:/fastpass/jenkins-vm-09_nfs_2013_08_02_1_1_13_698848 value: STORAGE_CONNECTION
, sharedLocks= ]
2013-08-02 01:12:26,200 WARN  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-3) [222] CanDoAction of action AddStorageServerConnection failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__STORAGE__CONNECTION,ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS
2013-08-02 01:12:26,201 INFO  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-3) [222] Lock freed to object EngineLock [exclusiveLocks= key: 10.35.64.106:/fastpass/jenkins-vm-09_nfs_2013_08_02_1_1_13_698848 value: STORAGE_CONNECTION
, sharedLocks= ]
2013-08-02 01:12:26,204 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-3) Operation Failed: [Cannot add Storage Connection. Storage connection already exists.]
2013-08-02 01:12:34,351 INFO  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-6) [227] Lock Acquired to object EngineLock [exclusiveLocks= key: 10.35.64.106:/fastpass/jenkins-vm-09_nfs_2013_08_02_1_1_13_698848 value: STORAGE_CONNECTION
, sharedLocks= ]
2013-08-02 01:12:34,352 WARN  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-6) [227] CanDoAction of action AddStorageServerConnection failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__STORAGE__CONNECTION,ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS
2013-08-02 01:12:34,353 INFO  [org.ovirt.engine.core.bll.storage.AddStorageServerConnectionCommand] (ajp-/127.0.0.1:8702-6) [227] Lock freed to object EngineLock [exclusiveLocks= key: 10.35.64.106:/fastpass/jenkins-vm-09_nfs_2013_08_02_1_1_13_698848 value: STORAGE_CONNECTION
, sharedLocks= ]
2013-08-02 01:12:34,364 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-6) Operation Failed: [Cannot add Storage Connection. Storage connection already exists.]

Comment 4 Ayal Baron 2013-08-05 11:25:01 UTC
*** Bug 949291 has been marked as a duplicate of this bug. ***

Comment 5 Ayal Baron 2013-08-05 11:28:33 UTC
*** Bug 991739 has been marked as a duplicate of this bug. ***

Comment 6 Alissa 2013-08-05 11:43:32 UTC
Here's what I understand from the tests flow and the difference between versions:

The flow:

test#51:
create a storage domain with invalid name (with space)
and with legal storage connection details.

test#52
create a storage domain with valid name and with
the same storage connection details as in test#51  

Results in 3.2:
test#51 fails due to invalid storage domain name
but the storage connection is created anyway due to bug 949291 which I opened a while ago.

test#52 passes because it creates the same storage connection again in the db with different id
(I am pretty sure if you take a look at storage_server_connections table you will find there
2 entries with exact same details except for different connection id.

Results in 3.3:
test#51 fails due to invalid storage domain name
but the storage connection is created due to bug 949291 which I opened a while ago.

test#52 fails due to "connection already exists" error - which is correct because
several months ago this validation was introduced in storage connection creation (not in storage domain creation flow)
to avoid creating several duplicate connections
entries pointing to same storage - to avoid garbage in db and different domains working with same storage.

Conclusions and solutions:
1. storage connection creation in 3.3 avoids adding multiple connections with same details to db by verifying before creation that
another similar connection exists. it's a bug fix/enhancement which is logical and correct to have, and it wasn't there in 3.2.
2. don't use same connection details in different tests. it's not a clean test anyway, unless you are actually trying to
test whether same connection can be recreated more than once. this will immediately solve the problem and hence it's not a test blocker.
3. bug 949291 no doubt needs a solution, but it's not urgent because in 3.3 user can do one of the following in the case storage domain fails due to "connection already exists" error:
a. delete the problematic connection via new option of connection deletion in REST [1]
b. during domain creation supply the existing connection id in REST of storage domain creation (please note this one is in review and is not merged yet, should be any day) [2]

[1]
http://www.ovirt.org/Features/Manage_Storage_Connections#Delete_connection_.28DELETE.29

[2]
http://www.ovirt.org/Features/Manage_Storage_Connections#Add_new_file_.28nfs.2Fposix.2Flocal.29_storage_domain_with_existing_storage_connection_.28POST.29

Comment 11 Allon Mureinik 2013-10-13 12:31:02 UTC
*** Bug 1018250 has been marked as a duplicate of this bug. ***

Comment 14 Meital Bourvine 2014-02-17 12:21:18 UTC
POST
URL: https://10.35.163.52/api/storagedomains
BODY:
<storage_domain>
    <name>data1 bla</name>
    <type>data</type>
    <host id="6c3c4675-4294-44ca-ab26-522d16ca5b69"/>
    <storage>
        <type>nfs</type>
        <address>10.35.160.108</address>
        <path>/RHEV/mbourvin</path>
    </storage>
</storage_domain>

RESPONSE:
<fault>
<reason>Operation Failed</reason>
<detail>
[Storage Domain name must be formed of "a-z0-9A-Z" or "-_"]
</detail>
</fault>


POST
URL: https://10.35.163.52/api/storagedomains
BODY:
<storage_domain>
    <name>data1_bla</name>
    <type>data</type>
    <host id="6c3c4675-4294-44ca-ab26-522d16ca5b69"/>
    <storage>
        <type>nfs</type>
        <address>10.35.160.108</address>
        <path>/RHEV/mbourvin</path>
    </storage>
</storage_domain>

RESPONSE:
<storage_domain href= "/api/storagedomains/a7a55634-279f-4252-8458-2597af9efde7" id="a7a55634-279f-4252-8458-2597af9efde7">
<name>data1_bla</name>
<link href= "/api/storagedomains/a7a55634-279f-4252-8458-2597af9efde7/permissions" rel="permissions"/>
<link href= "/api/storagedomains/a7a55634-279f-4252-8458-2597af9efde7/disks" rel="disks"/>
<link href= "/api/storagedomains/a7a55634-279f-4252-8458-2597af9efde7/storageconnections" rel="storageconnections"/>
<type>data</type>
<status>
<state>unknown</state>
</status>
<master>false</master>
<storage>
<address>10.35.160.108</address>
<type>nfs</type>
<path>/RHEV/mbourvin</path>
</storage>
<available>2018634629120</available>
<used>143881404416</used>
<committed>0</committed>
<storage_format>v1</storage_format>
</storage_domain>

Comment 15 Itamar Heim 2014-06-12 14:08:09 UTC
Closing as part of 3.4.0


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