Bug 1308563 - Adding a host with a name that is already in use returns a Bad Request (code 400)
Summary: Adding a host with a name that is already in use returns a Bad Request (code ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ovirt-4.0.0-beta
: 4.0.0
Assignee: Boriso
QA Contact: Petr Kubica
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-15 14:04 UTC by Idan Shaby
Modified: 2017-10-16 06:26 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-07-05 07:52:27 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 57192 0 master MERGED restapi: Fixed HTTP error code for host name duplication error. 2016-05-09 10:41:20 UTC

Description Idan Shaby 2016-02-15 14:04:11 UTC
Description of problem:
Adding a host with a name that is already in use returns a bad request (code 400), while doing the same with a Data Center returns a conflict (code 409).

Version-Release number of selected component (if applicable):
6ca8b0e75a7e59f3e86e17aa876499214ab4d521

How reproducible:
100%

Steps to Reproduce:
1. Add a host through the REST-API.
2. Add the same host again.
3.

Actual results:
Bad request (code 400) with the message: "Cannot add Host. The Host name is already in use, please choose a unique name and try again."

Expected results:
We should get a conflict, not a bad request.

Additional info:
Adding a data center with a name that is already in use returns a conflict (code 409) with the message: "Cannot create Data Center. The Data Center name is already in use."

Comment 1 Juan Hernández 2016-02-24 12:25:45 UTC
The API translates the error messages returned by the backend into HTTP codes according to the value returned by the ErrorMessage.getErrorType() message. The error returned by the backend when the name of the host is already in use is ACTION_TYPE_FAILED_NAME_ALREADY_USED, and the corresponding ErrorType is BAD_PARAMETERS, not CONFLICT. Not sure why it isn't CONFLICT. The change is simple, but it may have a backwards compatibility effect in existing clients, so I think it is better to not change it in the 3.6 branch.

Ori, do you know why this error type isn't classified as CONFLICT?

Comment 2 Sandro Bonazzola 2016-05-02 09:59:39 UTC
Moving from 4.0 alpha to 4.0 beta since 4.0 alpha has been already released and bug is not ON_QA.

Comment 3 Petr Kubica 2016-06-07 12:43:34 UTC
Verified in 
ovirt-engine-restapi-4.1.0-0.0.master.20160606111312.gitc7af584.el7.centos.noarch

Response: 409 Conflict: Cannot add Host. Host with the same address already exists.

Comment 4 Sandro Bonazzola 2016-07-05 07:52:27 UTC
oVirt 4.0.0 has been released, closing current release.

Comment 5 Eduard Florea 2017-10-13 20:32:42 UTC
I just installed oVirt 4.1.6 ...that latest release on a new instance of the latest release of CentOS 7.4.1708.

After a setup attempt..."Datacenter" config, ..."Host" config, and "Storage" config...I realized I made a mistake in the config of the "Storage"->POSIX compliant FS Domain ...I basically setup an NFS Share in the wrong place...and instead of having access to 500GB I only had access to 40GB...

So after several failed attempts to undo this ...I decided that a "Force Remove" of the Data Center...was probably my best solution and just rebuild the setup fresh... I quickly found out that this was a BAD idea !!! as the "Force Remove" option under "Data Centers" did almost nothing in the PostgreSQL DB...

So I'm now left to clean entries in the Database to resolve this exact issue...that's supposed to be CLOSED !!! 

I did find this response, that describe where to locate the password of your PostgreSQL DB Instance : 
http://lists.ovirt.org/pipermail/users/2016-February/038035.html

I just assumed that the password I used at install was the same password being used to create the database.... Not so...

The setup was to figure out where in the 153 Tables do this stagnant entry for my IP Address exist...

Found that answer here : 
http://lists.ovirt.org/pipermail/users/2014-January/019257.html

Next tidbit... oVirt uses Contraints on Foreign Keys in the DB....so to delete the bad records...you have to delete in this order..

1. vds_dynamic
2. vds_statistics
3. vds_static

After this, all was good again... I must say...this 4 hour ordeal...could have been avoided by the fact that on a new install of oVirt...with NO ...Zero...VM's running or even configured...I should be allowed to edit...the "Domain" storage entry...I made a simple mistake by mounting the wrong NFS Share and adding it to the oVirt setup...and it cost me half the work day. 

Thanks guys, reminds me why I used VMware in the Past

Comment 6 Idan Shaby 2017-10-16 06:26:45 UTC
Hi Eduard,

I am sorry to hear that you've had a bad experience with oVirt.
Since you already managed to fix your env, I'll just say that next time you can send a question to users. Usually you will get a quick answer to these kind of questions.

Idan


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