Created attachment 1376750 [details] Logs Description of problem: Add host failed with PSQLException if host has the same name server entry written twice in the resolv.conf. If the resolv.conf has the same name server entry written twice in the conf, the installation will fail with a PSQLException on the engine. PL/pgSQL function insertnameserver(uuid,character varying,smallint) line 3 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "name_server_pkey" Detail: Key (dns_resolver_configuration_id, address)=(8c0362a2-00e4-48b5-89ee-8cbdb962baf3, 172.16.17.254) already exists. Where: SQL statement "INSERT INTO name_server( address, position, dns_resolver_configuration_id) VALUES ( v_address, v_position, v_dns_resolver_configuration_id)" PL/pgSQL function insertnameserver(uuid,character varying,smallint) line 3 at SQL statement at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1099) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1135) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:405) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:365) [spring-jdbc.jar:4.3.9.RELEASE] at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:198) [spring-jdbc.jar:4.3.9.RELEASE] at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:135) [dal.jar:] at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:130) [dal.jar:] at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:76) [dal.jar:] at org.ovirt.engine.core.dao.network.DnsResolverConfigurationDaoImpl.saveNameServersByDnsResolverConfigurationId(DnsResolverConfigurationDaoImpl.java:66) [dal.jar:] at org.ovirt.engine.core.dao.network.DnsResolverConfigurationDaoImpl.save(DnsResolverConfigurationDaoImpl.java:97) [dal.jar:] at org.ovirt.engine.core.dao.network.DnsResolverConfigurationDaoImpl.save(DnsResolverConfigurationDaoImpl.java:15) [dal.jar:] at org.ovirt.engine.core.dao.VdsDynamicDaoImpl.updateDnsResolverConfiguration(VdsDynamicDaoImpl.java:150) [dal.jar:] at org.ovirt.engine.core.vdsbroker.vdsbroker.HostNetworkTopologyPersisterImpl.persistTopology(HostNetworkTopologyPersisterImpl.java:282) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.vdsbroker.HostNetworkTopologyPersisterImpl.persistAndEnforceNetworkCompliance(HostNetworkTopologyPersisterImpl.java:95) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.vdsbroker.HostNetworkTopologyPersisterImpl.persistAndEnforceNetworkCompliance(HostNetworkTopologyPersisterImpl.java:151) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.VdsManager.refreshCapabilities(VdsManager.java:684) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.monitoring.HostMonitoring.refreshVdsRunTimeInfo(HostMonitoring.java:118) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.monitoring.HostMonitoring.refresh(HostMonitoring.java:85) [vdsbroker.jar:] at org.ovirt.engine.core.vdsbroker.VdsManager.refresh(VdsManager.java:267) [vdsbroker.jar:] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_151] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [rt.jar:1.8.0_151] at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.access$201(ManagedScheduledThreadPoolExecutor.java:383) [javax.enterprise.concurrent.jar:1.0.0.redhat-1] at org.glassfish.enterprise.concurrent.internal.ManagedScheduledThreadPoolExecutor$ManagedScheduledFutureTask.run(ManagedScheduledThreadPoolExecutor.java:534) [javax.enterprise.concurrent.jar:1.0.0.redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_151] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_151] at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_151] at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250) [javax.enterprise.concurrent.jar:1.0.0.redhat-1] at org.jboss.as.ee.concurrent.service.ElytronManagedThreadFactory$ElytronManagedThread.run(ElytronManagedThreadFactory.java:78) Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "name_server_pkey" Detail: Key (dns_resolver_configuration_id, address)=(8c0362a2-00e4-48b5-89ee-8cbdb962baf3, 172.16.17.254) already exists. Where: SQL statement "INSERT INTO name_server( address, position, dns_resolver_configuration_id) VALUES ( v_address, v_position, v_dns_resolver_configuration_id)" Version-Release number of selected component (if applicable): 4.2.0.2-0.1.el7 How reproducible: 100% Steps to Reproduce: 1. Try to add host with name server that written twice in the resolv.conf - # Generated by NetworkManager search qa.lab.tlv.redhat.com lab.tlv.redhat.com tlv.redhat.com redhat.com name server 8.8.8.8 name server 8.8.8.8 Actual results: Add host failed with multiple exceptions in the engine. This will mess up the db unless removing the host from the engine. Expected results: Should work.
Why would you have the same name server set up twice? Sounds like a user error to me? I would not bother fixing it.. (I assume it's an easy fix, but why complicate the code? Doesn't look like a common mistake but an edge case). Please re-open if I'm wrong and there is such a legit use case for this.
(In reply to Yaniv Kaul from comment #1) > Why would you have the same name server set up twice? Sounds like a user > error to me? I would not bother fixing it.. (I assume it's an easy fix, but > why complicate the code? Doesn't look like a common mistake but an edge > case). > > Please re-open if I'm wrong and there is such a legit use case for this. I had 2 nodes provided to me by osp team to certify the ospd12, on the both nodes NetworkManager generated this name server in the resolv.conf, i have no idea why or how. Maybe it's a bug on NM side. any how i don't mind closing it. Dan and Alona told me to open it.
Hi, I also have same issue but have have about 20 nodes and some ones have duplicate entries on /etc/resolv.conf and this cause the engine stays in loop and create too many entries on name_server table engine=# select count(*) from name_server; count ------- 31401 (1 row) This happens after upgrade of engine from 4.1.0 to 4.2.0 and after upgrade the hosts, i'm not able to regists the host. Its keeping to "activating"/"non-responsive". After remove duplicate entries from /etc/resolv.conf, i'm able to regists the host but engine should be improved to prevent to stays in loop and create entries on name_server table. I also know if i can delete 31401 entries from name_server table? Regards
Hi Yes you may delete the entries, make sure you are not deleting name_server of hosts that already running in your engine(if you have such). Deleting the multiple entries in the DB + removing the duplicated name servers in /etc/resolv.conf should work around this bug, which was decided to close as WONTFIX. Just re-add the the server to engine. Cheers)
It is not an important use case, and the host-side workaround is simple, but Engine must never get itself it such a horrible condition due to bad value in one host's /etc/resolv.conf. At the very least, Engine should "uniquify" the dns values reported by Vdsm.
The creation of multiple entries in the 'name_server' and 'dns_resolver_configuration' was fixed. Now, if the resolv.conf will contain duplicate entries the host will stuck in activating state and the log will contain errors regarding the duplicity but the db will be ok.
FailedQA - 4.2.2-0.1.el7 db still not OK engine=# select count(*) from name_server; count ------- 1908 (1 row) engine=# select count(*) from name_server; count ------- 1910 (1 row)
Created attachment 1397560 [details] too many name server enteries in db
I had an issue on my rhvm env and now it fixed. Retesting
Following comment6# - Verified on 4.2.2-0.1.el7
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018. Since the problem described in this bug report should be resolved in oVirt 4.2.2 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.