Bug 1620198 - update or delete on table "gluster_volumes" violates foreign key constraint "fk_storage_connection_to_glustervolume" on table "storage_server_connections
Summary: update or delete on table "gluster_volumes" violates foreign key constraint "...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: BLL.Gluster
Version: 4.2.6.2
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ovirt-4.3.2
: ---
Assignee: Kaustav Majumder
QA Contact: SATHEESARAN
URL:
Whiteboard:
: 1182774 (view as bug list)
Depends On:
Blocks: 1183307 1596034
TreeView+ depends on / blocked
 
Reported: 2018-08-22 16:19 UTC by Petr Kubica
Modified: 2019-04-16 13:56 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-16 13:56:28 UTC
oVirt Team: Gluster
Embargoed:
rule-engine: ovirt-4.3+


Attachments (Terms of Use)
engine.log (1.26 MB, application/x-gzip)
2018-08-22 16:19 UTC, Petr Kubica
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 95426 0 master MERGED engine: Disallow deleting of volume in a Storage Domain 2020-02-18 10:44:17 UTC
oVirt gerrit 96095 0 ovirt-engine-4.2 ABANDONED engine: Disallow deleting of volume in a Storage Domain 2020-02-18 10:44:17 UTC

Description Petr Kubica 2018-08-22 16:19:33 UTC
Created attachment 1477930 [details]
engine.log

Description of problem:
I wanted to delete a gluster volume from webadmin, volume was deleted on gluster storage but I still see in webadmin that volume. Volume was used as data domain which was in maintenance mode.

in engine log I found:
2018-08-22 18:01:41,066+02 ERROR [org.ovirt.engine.core.bll.gluster.GlusterSyncJob] (DefaultQuartzScheduler7) [2e96c242] Error while removing volumes from database!: org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{call deleteglustervolumesbyguids(?)}]; ERROR: update or delete on table "gluster_volumes" violates foreign key constraint "fk_storage_connection_to_glustervolume" on table "storage_server_connections"
  Detail: Key (id)=(34b2219e-b200-435d-8df6-63b2ff06df57) is still referenced from table "storage_server_connections".
  Where: SQL statement "DELETE
    FROM gluster_volumes
    WHERE id IN (
            SELECT *
            FROM fnSplitterUuid(v_volume_ids)
            )"
PL/pgSQL function deleteglustervolumesbyguids(character varying) line 3 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "gluster_volumes" violates foreign key constraint "fk_storage_connection_to_glustervolume" on table "storage_server_connections"
  Detail: Key (id)=(34b2219e-b200-435d-8df6-63b2ff06df57) is still referenced from table "storage_server_connections".
  Where: SQL statement "DELETE
    FROM gluster_volumes
    WHERE id IN (
            SELECT *
            FROM fnSplitterUuid(v_volume_ids)
            )"
PL/pgSQL function deleteglustervolumesbyguids(character varying) line 3 at SQL statement
	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243) [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.gluster.GlusterVolumeDaoImpl.removeAll(GlusterVolumeDaoImpl.java:236) [dal.jar:]
	at org.ovirt.engine.core.bll.gluster.GlusterSyncJob.removeDeletedVolumes(GlusterSyncJob.java:520) [bll.jar:]
	at org.ovirt.engine.core.bll.gluster.GlusterSyncJob.refreshVolumeData(GlusterSyncJob.java:464) [bll.jar:]
	at org.ovirt.engine.core.bll.gluster.GlusterSyncJob.refreshClusterData(GlusterSyncJob.java:142) [bll.jar:]
	at org.ovirt.engine.core.bll.gluster.GlusterSyncJob.refreshLightWeightData(GlusterSyncJob.java:120) [bll.jar:]
	at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source) [:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_181]
	at org.ovirt.engine.core.utils.timer.JobWrapper.invokeMethod(JobWrapper.java:83) [scheduler.jar:]
	at org.ovirt.engine.core.utils.timer.JobWrapper.execute(JobWrapper.java:55) [scheduler.jar:]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_181]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_181]
	at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_181]
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "gluster_volumes" violates foreign key constraint "fk_storage_connection_to_glustervolume" on table "storage_server_connections"
  Detail: Key (id)=(34b2219e-b200-435d-8df6-63b2ff06df57) is still referenced from table "storage_server_connections".
  Where: SQL statement "DELETE
    FROM gluster_volumes
    WHERE id IN (
            SELECT *
            FROM fnSplitterUuid(v_volume_ids)
            )"
PL/pgSQL function deleteglustervolumesbyguids(character varying) line 3 at SQL statement
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:410)
	at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.execute(CachedPreparedStatement.java:303)
	at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.java:442)
	at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1138) [spring-jdbc.jar:4.3.9.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1135) [spring-jdbc.jar:4.3.9.RELEASE]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1083) [spring-jdbc.jar:4.3.9.RELEASE]
	... 23 more


Version-Release number of selected component (if applicable):
ovirt-engine-4.2.6.4-0.0.master.20180817095858.git52c4ae5.el7.noarch

How reproducible:
always

Steps to Reproduce:
1 Create a gluster volume
2. Add that volume as data domain for virtualization
(3. put that data domain into maintenance)
4. put gluster volume into maintenance 
5. Delete that volume

Actual results:
Failed, volume is deleted but it still in webadmin as inactive
Repeatedly printed exception into engine.log
note: after removing data domain, the gluster volume was deleted also

Expected results:
should notify admin that this volume is used as data domain and provide a dialog  to approve removing also data domain

Additional info:
attached engine.log

Comment 1 Gobinda Das 2018-12-10 07:15:28 UTC
*** Bug 1182774 has been marked as a duplicate of this bug. ***

Comment 2 Gobinda Das 2019-01-03 12:44:16 UTC
Moving to 4.3.0 as it's not a blocker

Comment 3 Sandro Bonazzola 2019-01-28 09:34:43 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 4 Sandro Bonazzola 2019-03-22 10:56:40 UTC
Moving to ON_QA being referenced patch 4fb07134e0028f23ce98a39c23bb0f4d80688fe8 already in since ovirt-engine-4.3.0_rc

Comment 7 SATHEESARAN 2019-04-11 08:55:06 UTC
Tested with RHV 4.3.3

When trying to remove the volume, and there exists the storage domain that
uses this gluster volume, then that delete volume operation is not allowed.

And user won't run in to the problems.
But still there are 2 problems,

1. Trying to stop the volume should catch this problem, instead of volume delete
So, if the gluster volume that is backing up the storage domain, is stopped, 
then that operation should be disallowed.

2. If the storage domains are auto-created as part of HC deployment, then
this check won't have effect, as there is another issue where this SD
doesn't have associated gluster volume UUID, when created automatically
from HC deployment via cockpit

I will be raising separate bugs for the same

With the above facts, verifying this bug

Comment 8 Sandro Bonazzola 2019-04-16 13:56:28 UTC
This bugzilla is included in oVirt 4.3.2 release, published on March 19th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.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.


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