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:
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?)
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?
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?
Just checked on RHV 4.1 - it's not present. But how can it be present? did we added this on 4.1?
If the provider name exists already, then the logical decision is to skip this part of the setup.
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.
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
Unfortunately, the "fix" has missed 4.2.1
Patch managed to fail OST. Postponing to 4.2.2 again.
Moved back to 4.2.1: 83b8d6f7b8 fixes a bug in engine-setup which prevents engine-setup before/after sequence.
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."
Verified on RHV Version 4.2.1.5-0.1.el7
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.