Bug 1014966 - RHEVM Backend: error code 409 (Conflict: Cannot add Storage Connection. Storage connection already exists.) retuned when trying to add storage domain
RHEVM Backend: error code 409 (Conflict: Cannot add Storage Connection. Stora...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.3.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.4.0
Assigned To: Daniel Erez
Gadi Ickowicz
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-03 04:48 EDT by Ilia Meerovich
Modified: 2016-07-04 20:07 EDT (History)
17 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
amureini: Triaged+


Attachments (Terms of Use)
Comment (84.40 KB, text/plain)
2013-10-08 07:14 EDT, Ilia Meerovich
no flags Details

  None (edit)
Description Ilia Meerovich 2013-10-03 04:48:59 EDT
import org.ovirt.engine.sdk.Api;
import org.ovirt.engine.sdk.decorators.Host;
import org.ovirt.engine.sdk.entities.PowerManagement;
import org.ovirt.engine.sdk.entities.Slaves;
import org.ovirt.engine.sdk.entities.Storage;
import org.ovirt.engine.sdk.entities.StorageDomain;


public class debugRemove {
        private static final String URL = "https://ilia-rhevm.qa.lab.tlv.redhat.com:443/api";

    public static void main(String[] args) throws Exception {
        Api api = new Api(URL, "admin@internal", "123456", true);
        StorageDomain st = new StorageDomain();
        st.setType("data");
        st.setHost((org.ovirt.engine.sdk.entities.Host) api.getHosts().list().get(0));
        Storage storage = new Storage();
        storage.setPath("/data/images2");
        storage.setType("localfs");
		st.setStorage(storage);
		api.getStorageDomains().add(st);
        api.close();
    }
}

causes to:
Exception in thread "main" 
code  : 409
reason: Conflict
detail: Cannot add Storage Connection. Storage connection already exists.
	at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:118)
	at org.ovirt.engine.sdk.web.HttpProxyBroker.add(HttpProxyBroker.java:209)
	at org.ovirt.engine.sdk.decorators.StorageDomains.add(StorageDomains.java:230)
	at debugRemove.main(debugRemove.java:21)
Comment 1 Michael Pasternak 2013-10-03 05:08:34 EDT
(In reply to Ilia Meerovich from comment #0)
> import org.ovirt.engine.sdk.Api;
> import org.ovirt.engine.sdk.decorators.Host;
> import org.ovirt.engine.sdk.entities.PowerManagement;
> import org.ovirt.engine.sdk.entities.Slaves;
> import org.ovirt.engine.sdk.entities.Storage;
> import org.ovirt.engine.sdk.entities.StorageDomain;
> 
> 
> public class debugRemove {
>         private static final String URL =
> "https://ilia-rhevm.qa.lab.tlv.redhat.com:443/api";
> 
>     public static void main(String[] args) throws Exception {
>         Api api = new Api(URL, "admin@internal", "123456", true);
>         StorageDomain st = new StorageDomain();
>         st.setType("data");
>         st.setHost((org.ovirt.engine.sdk.entities.Host)
> api.getHosts().list().get(0));
>         Storage storage = new Storage();
>         storage.setPath("/data/images2");
>         storage.setType("localfs");
> 		st.setStorage(storage);
> 		api.getStorageDomains().add(st);
>         api.close();
>     }
> }
> 
> causes to:
> Exception in thread "main" 
> code  : 409
> reason: Conflict
> detail: Cannot add Storage Connection. Storage connection already exists.
> 	at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:118)
> 	at org.ovirt.engine.sdk.web.HttpProxyBroker.add(HttpProxyBroker.java:209)
> 	at
> org.ovirt.engine.sdk.decorators.StorageDomains.add(StorageDomains.java:230)
> 	at debugRemove.main(debugRemove.java:21)

ilia,

can you reproduce this using native api?
Comment 2 anil 2013-10-06 03:54:13 EDT
I am also getting the same error while adding iso domain 
"Cannot add Storage Connection. Storage connection already exists."
Comment 3 Maor 2013-10-07 07:13:03 EDT
anil, can u please also query the DB, and add the output of the following query:
SELECT id,connection,iqn,port,portal,storage_type,mount_options,vfs_type FROM storage_server_connections;
Comment 4 Ilia Meerovich 2013-10-08 07:14:51 EDT
Created attachment 915776 [details]
Comment

(This comment was longer than 65,535 characters and has been moved to an attachment by Red Hat Bugzilla).
Comment 5 Daniel Erez 2013-10-09 03:42:45 EDT
Hi Ilia,

You may hit bug 991470 which has been closed; the proposed alternative is to reuse the storage connection. The means to do it was introduced as part of edit connections feature [1].

* Can you please verify that the proposed solution [1] resolves the issue?
* Have you encountered the described issue after invoking any operation through the rest-api (creating the domain/etc.)?

[1]
http://www.ovirt.org/Features/Manage_Storage_Connections#Add_new_file_.28nfs.2Fposix.2Flocal.29_storage_domain_with_existing_storage_connection_.28POST.29
Comment 6 Michael Pasternak 2013-10-09 05:36:53 EDT
Hi Daniel,

If this workaround breaks/change the flow was used before storage-connections feature/3.3, - it's unacceptable ...

(In reply to Daniel Erez from comment #5)
> Hi Ilia,
> 
> You may hit bug 991470 which has been closed; the proposed alternative is to
> reuse the storage connection. The means to do it was introduced as part of
> edit connections feature [1].
> 
> * Can you please verify that the proposed solution [1] resolves the issue?
> * Have you encountered the described issue after invoking any operation
> through the rest-api (creating the domain/etc.)?
> 
> [1]
> http://www.ovirt.org/Features/Manage_Storage_Connections#Add_new_file_.28nfs.
> 2Fposix.2Flocal.29_storage_domain_with_existing_storage_connection_.28POST.29
Comment 7 Daniel Erez 2013-10-09 07:18:56 EDT
(In reply to Michael Pasternak from comment #6)
> Hi Daniel,
> 
> If this workaround breaks/change the flow was used before
> storage-connections feature/3.3, - it's unacceptable ...

afaik, the workaround has been introduced instead of a fallback logic in the rest-api: http://gerrit.ovirt.org/#/c/17658/

> 
> (In reply to Daniel Erez from comment #5)
> > Hi Ilia,
> > 
> > You may hit bug 991470 which has been closed; the proposed alternative is to
> > reuse the storage connection. The means to do it was introduced as part of
> > edit connections feature [1].
> > 
> > * Can you please verify that the proposed solution [1] resolves the issue?
> > * Have you encountered the described issue after invoking any operation
> > through the rest-api (creating the domain/etc.)?
> > 
> > [1]
> > http://www.ovirt.org/Features/Manage_Storage_Connections#Add_new_file_.28nfs.
> > 2Fposix.2Flocal.29_storage_domain_with_existing_storage_connection_.28POST.29
Comment 8 Michael Pasternak 2013-10-09 07:41:52 EDT
(In reply to Daniel Erez from comment #7)
> (In reply to Michael Pasternak from comment #6)
> > Hi Daniel,
> > 
> > If this workaround breaks/change the flow was used before
> > storage-connections feature/3.3, - it's unacceptable ...
> 
> afaik, the workaround has been introduced instead of a fallback logic in the
> rest-api: http://gerrit.ovirt.org/#/c/17658/
> 

this patch was "abandoned", also i'm not sure it related to the mention issue.
Comment 9 Ilia Meerovich 2013-10-09 08:30:02 EDT
Daniel,

I cannot use this workaround since ART backend is just providing needed api to tests so it is doing what tests are telling to it to do.
I just wrote simple programm in java sdk in order to reproduce this issue easily.
Actually it can be reproduced also via UI so customer may/will face this issue.
Comment 10 Daniel Erez 2013-10-09 08:44:01 EDT
(In reply to Ilia Meerovich from comment #9)
> Daniel,
> 
> I cannot use this workaround since ART backend is just providing needed api
> to tests so it is doing what tests are telling to it to do.
> I just wrote simple programm in java sdk in order to reproduce this issue
> easily.
> Actually it can be reproduced also via UI so customer may/will face this
> issue.

* Can you please provide reproduce steps for the issue solely through the UI?
(I need to know this for determining whether this issue is related to bug 991470)

* Can you please attach the relevant logs and preferably DB dump as well?
Comment 13 Ayal Baron 2013-10-09 12:41:43 EDT
This is a dup of bug 991470 which was closed.
Keeping this to track the future fix.
Comment 15 Allon Mureinik 2014-04-23 09:00:23 EDT
This was solved as part of bug 991470, please verify.
Comment 16 Gadi Ickowicz 2014-04-27 09:49:20 EDT
verified using the same steps described in bug 994170 (comment 14) on av7:

POST:
<storage_domain>
    <name>data1 bla</name>
    <type>data</type>
    <host id="66864669-9940-4482-8232-a83a8d01a77e"/>
    <storage>
        <type>nfs</type>
        <address>10.35.160.108</address>
        <path>/RHEV/gickowic/nfs2</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:
<storage_domain>
    <name>data1_bla</name>
    <type>data</type>
    <host id="66864669-9940-4482-8232-a83a8d01a77e"/>
    <storage>
        <type>nfs</type>
        <address>10.35.160.108</address>
        <path>/RHEV/gickowic/nfs2</path>
    </storage>
</storage_domain>

Response:
    Status Code: 201 Created
    Connection: close
    Content-Encoding: gzip
    Content-Length: 384
    Content-Type: application/xml
    Date: Sun, 27 Apr 2014 13:45:54 GMT
    Location: https://gadi-rhevm.scl.lab.tlv.redhat.com/api/api/storagedomains/c291c3ba-187d-428c-833b-e0463dbff95a
    Vary: Accept-Encoding
Comment 17 Itamar Heim 2014-06-12 10:08:28 EDT
Closing as part of 3.4.0

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