Daniel Erez has uploaded a new change for review. Change subject: core: remove disks perms on storage domain destroy ......................................................................
core: remove disks perms on storage domain destroy Removing disks permissions when destroying a storage domain. Change-Id: I6db8694858bca7ddbe8579931279cb77d741f58b Bug-Url: https://bugzilla.redhat.com/886855 Signed-off-by: Daniel Erez <[email protected]> --- M backend/manager/dbscripts/storages_sp.sql 1 file changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/37/11737/1 diff --git a/backend/manager/dbscripts/storages_sp.sql b/backend/manager/dbscripts/storages_sp.sql index abea8ae..658c386 100644 --- a/backend/manager/dbscripts/storages_sp.sql +++ b/backend/manager/dbscripts/storages_sp.sql @@ -555,14 +555,14 @@ BEGIN -- Images residing on only the specified storage domain - CREATE GLOBAL TEMPORARY TABLE tt_TEMPSTORAGEDOMAINMAPTABLE AS select image_id - from image_storage_domain_map where storage_domain_id = v_storage_domain_id - except select image_id from image_storage_domain_map where storage_domain_id != v_storage_domain_id; + CREATE GLOBAL TEMPORARY TABLE tt_TEMPSTORAGEDOMAINMAPTABLE AS select image_guid, image_group_id + from images_storage_domain_view where storage_id = v_storage_domain_id + except select image_guid, image_group_id from images_storage_domain_view where storage_id != v_storage_domain_id; exception when others then truncate table tt_TEMPSTORAGEDOMAINMAPTABLE; - insert into tt_TEMPSTORAGEDOMAINMAPTABLE select image_id - from image_storage_domain_map where storage_domain_id = v_storage_domain_id - except select image_id from image_storage_domain_map where storage_domain_id != v_storage_domain_id; + insert into tt_TEMPSTORAGEDOMAINMAPTABLE select image_guid, image_group_id + from images_storage_domain_view where storage_id = v_storage_domain_id + except select image_guid, image_group_id from images_storage_domain_view where storage_id != v_storage_domain_id; END; BEGIN @@ -570,14 +570,14 @@ CREATE GLOBAL TEMPORARY TABLE TEMPLATES_IDS_TEMPORARY_TABLE AS select vm_device.vm_id as vm_guid from images_storage_domain_view JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id - JOIN tt_TEMPSTORAGEDOMAINMAPTABLE ON tt_TEMPSTORAGEDOMAINMAPTABLE.image_id = images_storage_domain_view.image_guid + JOIN tt_TEMPSTORAGEDOMAINMAPTABLE ON tt_TEMPSTORAGEDOMAINMAPTABLE.image_guid = images_storage_domain_view.image_guid where entity_type = 'TEMPLATE' and storage_id = v_storage_domain_id; exception when others then truncate table TEMPLATES_IDS_TEMPORARY_TABLE; insert into TEMPLATES_IDS_TEMPORARY_TABLE select vm_device.vm_id as vm_guid from images_storage_domain_view JOIN vm_device ON vm_device.device_id = images_storage_domain_view.disk_id - JOIN tt_TEMPSTORAGEDOMAINMAPTABLE ON tt_TEMPSTORAGEDOMAINMAPTABLE.image_id = images_storage_domain_view.image_guid + JOIN tt_TEMPSTORAGEDOMAINMAPTABLE ON tt_TEMPSTORAGEDOMAINMAPTABLE.image_guid = images_storage_domain_view.image_guid where entity_type = 'TEMPLATE' and storage_id = v_storage_domain_id; END; @@ -589,7 +589,8 @@ delete FROM snapshots WHERE vm_id in (select vm_id as vm_guid from vm_images_view JOIN vm_device ON vm_device.device_id = vm_images_view.disk_id where v_storage_domain_id in (SELECT * FROM fnsplitteruuid(storage_id))); - delete FROM images where image_guid in (select image_id from tt_TEMPSTORAGEDOMAINMAPTABLE); + delete FROM images where image_guid in (select image_guid from tt_TEMPSTORAGEDOMAINMAPTABLE); + delete FROM permissions where object_id in (select image_group_id from tt_TEMPSTORAGEDOMAINMAPTABLE); delete FROM vm_interface where vmt_guid in(select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); delete FROM permissions where object_id in (select vm_guid from TEMPLATES_IDS_TEMPORARY_TABLE); delete FROM permissions where object_id = v_storage_domain_id; -- To view, visit http://gerrit.ovirt.org/11737 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6db8694858bca7ddbe8579931279cb77d741f58b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
