This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new e61051e4fcc SQL: Remove snapshot references if primary storage pool 
has been removed (#7205)
e61051e4fcc is described below

commit e61051e4fcc14d4d2b95acd3ca5fd295d8902471
Author: Wei Zhou <[email protected]>
AuthorDate: Tue Feb 21 14:48:36 2023 +0100

    SQL: Remove snapshot references if primary storage pool has been removed 
(#7205)
---
 .../schema/src/main/resources/META-INF/db/schema-41720to41800.sql   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql 
b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql
index 804a2d3d65f..6ce1afd5502 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql
@@ -1569,4 +1569,8 @@ CREATE VIEW `cloud`.`user_view` AS
             left join
         `cloud`.`async_job` ON async_job.instance_id = user.id
             and async_job.instance_type = 'User'
-            and async_job.job_status = 0;
\ No newline at end of file
+            and async_job.job_status = 0;
+
+-- Remove snapshot references if primary storage pool has been removed, see 
github issue #7093
+DELETE FROM `cloud`.`snapshot_store_ref`
+WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool 
WHERE removed IS NOT NULL);

Reply via email to