Bug 1529119 - Upgrade from RHV 4.1 to 4.2 with OVN provider name: ovirt-provider-ovn fails
Summary: Upgrade from RHV 4.1 to 4.2 with OVN provider name: ovirt-provider-ovn fails
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Setup.Engine
Version: 4.1.7
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ovirt-4.2.1
: ---
Assignee: Marcin Mirecki
QA Contact: Mor
URL:
Whiteboard:
Depends On:
Blocks: 1541233
TreeView+ depends on / blocked
 
Reported: 2017-12-26 14:21 UTC by Mor
Modified: 2018-02-12 11:52 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-12 11:52:59 UTC
oVirt Team: Network
Embargoed:
rule-engine: ovirt-4.2+
ylavi: blocker+


Attachments (Terms of Use)
engine setup log (9.20 MB, text/plain)
2017-12-26 14:21 UTC, Mor
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 85809 0 'None' 'MERGED' 'packaging: raise if network provider name is duplicated' 2019-12-09 04:21:50 UTC
oVirt gerrit 86858 0 'None' 'MERGED' 'packaging: raise if network provider name is duplicated' 2019-12-09 04:21:50 UTC
oVirt gerrit 87041 0 'None' 'MERGED' 'packaging: raise if network provider name is duplicated' 2019-12-09 04:21:50 UTC

Description Mor 2017-12-26 14:21:16 UTC
Created attachment 1372455 [details]
engine setup log

Description of problem:
When trying to upgrade RHV engine from 4.1 to 4.2 with existing OVN provider name 'ovirt-provider-ovn', engine-setup fails with postgresSQL error:
[ ERROR ] Failed to execute stage 'Misc configuration': duplicate key value violates unique constraint "providers_unique_name"
         DETAIL:  Key (name)=(ovirt-provider-ovn) already exists.
         CONTEXT:  SQL statement "INSERT INTO providers (
                 id,
                 name,
                 description,
                 url,
                 provider_type,
                 auth_required,
                 auth_username,
                 auth_password,
                 custom_properties,
                 tenant_name,
                 plugin_type,
                 agent_configuration,
                 additional_properties,
                 auth_url,
                 read_only
                 )
             VALUES (
                 v_id,
                 v_name,
                 v_description,
                 v_url,
                 v_provider_type,
                 v_auth_required,
                 v_auth_username,
                 v_auth_password,
                 v_custom_properties,
                 v_tenant_name,
                 v_plugin_type,
                 v_agent_configuration,
                 v_additional_properties,
                 v_auth_url,
                 v_read_only
                 )"
         PL/pgSQL function insertprovider(uuid,character varying,character varying,character varying,character varying,boolean,character varying,text,text,character varying,character varying,text,text,text,boolean) line 3 at SQL statement

Version-Release number of selected component (if applicable):
RHV Version 4.1.8.2-0.1.el7 (PLEASE NOTE! version is different then what is specified in bugzilla)
upgrade to --> RHV Version Version 4.2.0.2-0.1.el7

How reproducible:
100%

Steps to Reproduce:
1. On 4.1 ovirt-engine setup, add external OVN provider with the name 'ovirt-provider-ovn'.
2. Initiate upgrade process to 4.2

Actual results:
SQL error (see description).

Expected results:
Engine-setup should update the existing provider to match the new version requirements.

Additional info:

Comment 1 Marcin Mirecki 2017-12-28 15:45:42 UTC
We could fix this either by:
- creating a new provider with an index added to it's name: ovirt-provider-ovn-1
- assuming this is the correct behavior. If a provider is already installed by setup it should be present in the engine-setup config files and be handled properly. If there is not such entry the system is in an inconsistent state and we are unable to update it

Could you please check if there is an entry for the provider in:
    /etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf 
under:
    OVESETUP_OVN/ovirtProviderOvnId

I'm adding a patch which will add a new provider with an index appended name (but do we want this?)

Comment 2 Mor 2017-12-28 16:54:14 UTC
RHV 4.2:
OVESETUP_OVN/ovirtProviderOvnId=str:01e3d4fd-89a5-4832-930e-6ce99c51be29

Would it be possible/make sense to rename the old provider to something like 'ovirt-provider-ovn(old)' so we can expect the name 'ovirt-provider-ovn' to work after upgrade to 4.2?

Comment 3 Marcin Mirecki 2017-12-29 11:30:54 UTC
It would, but imho it would be misleading to rename existing entities.
Similarly, many file managers will cope with copying a duplicate name by adding an index to the new file.

Was OVESETUP_OVN/ovirtProviderOvnId present in the file before the update?

Comment 4 Mor 2017-12-31 07:50:33 UTC
Just checked on RHV 4.1 - it's not present. But how can it be present? did we added this on 4.1?

Comment 5 Yaniv Lavi 2018-01-03 11:49:11 UTC
If the provider name exists already, then the logical decision is to skip this part of the setup.

Comment 6 Marcin Mirecki 2018-01-03 12:06:37 UTC
Looks like we only have this since: https://gerrit.ovirt.org/#/c/77778/
so indeed this will not be present in 4.1

Checking this at the time we ask about installing OVN is not trivial. engine-setup does not have a db connection at that time yet.

Comment 7 Dan Kenigsberg 2018-01-04 11:31:13 UTC
Users have a simple (yet imperfect) workaround: we could fail gracefully, and suggest the user to either:
* choose not to (re-)install OVN, and point to documentation of ovirt-provider-ovn.conf
* delete the existing provider before upgrade

Comment 8 Dan Kenigsberg 2018-01-17 16:24:20 UTC
Unfortunately, the "fix" has missed 4.2.1

Comment 9 Dan Kenigsberg 2018-01-23 12:55:33 UTC
Patch managed to fail OST. Postponing to 4.2.2 again.

Comment 10 Sandro Bonazzola 2018-02-02 07:38:28 UTC
Moved back to 4.2.1: 83b8d6f7b8 fixes a bug in engine-setup which prevents engine-setup before/after sequence.

Comment 11 Mor 2018-02-04 14:16:05 UTC
In case ovirt-provider-ovn exists on engine, engine-setup quits with error:
"[ INFO  ] Stage: Setup validation
          During execution engine service will be stopped (OK, Cancel) [OK]: 
          Cannot install ovirt-provider-ovn. A provider named "ovirt-provider-ovn" already exists in the database and is not recognized as an engine-setup managed provider.To add a new ovirt-provider-ovn, please rename or remove the existing provider.The offending provider id is: 55d0b732-abea-4889-be7b-750b3e69affd
[ ERROR ] Failed to execute stage 'Setup validation': Cannot add ovirt-provider-ovn: Provider name must be unique."

Comment 12 Mor 2018-02-05 08:17:46 UTC
Verified on RHV Version 4.2.1.5-0.1.el7

Comment 13 Sandro Bonazzola 2018-02-12 11:52:59 UTC
This bugzilla is included in oVirt 4.2.1 release, published on Feb 12th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.1 release, it has been closed with a resolution of CURRENT RELEASE.

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


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