Liron Ar has posted comments on this change.

Change subject: core:Force remove should not delete VMs/Tempaltes with MSD.
......................................................................


Patch Set 3:

(4 comments)

http://gerrit.ovirt.org/#/c/28537/3/packaging/dbscripts/storages_sp.sql
File packaging/dbscripts/storages_sp.sql:

Line 651:          except select image_guid as image_id, disk_id from 
images_storage_domain_view where storage_id != v_storage_domain_id;
Line 652:    END;
Line 653: 
Line 654:    BEGIN
Line 655:       -- All the VMs which have disks also on other storage domains.
/s/VMs/VMs and Templates

/s/have disks also on other storage domains./have disks both on the specified 
domain and other domains
Line 656:       CREATE TEMPORARY TABLE 
ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE AS
Line 657:       SELECT DISTINCT vm_static.vm_guid
Line 658:       FROM vm_static
Line 659:       INNER JOIN (-- Join vm_static only with VMs that have images on 
the storage domain v_storage_domain_id


Line 655:       -- All the VMs which have disks also on other storage domains.
Line 656:       CREATE TEMPORARY TABLE 
ENTITY_IDS_ON_OTHER_STORAGE_DOMAINS_TEMPORARY_TABLE AS
Line 657:       SELECT DISTINCT vm_static.vm_guid
Line 658:       FROM vm_static
Line 659:       INNER JOIN (-- Join vm_static only with VMs that have images on 
the storage domain v_storage_domain_id
/s/VMs/VMs and Templates
Line 660:                   SELECT vm_static.vm_guid
Line 661:                   FROM vm_static
Line 662:                   INNER JOIN vm_device vd ON vd.vm_id = 
vm_static.vm_guid
Line 663:                   INNER JOIN images i ON i.image_group_id = 
vd.device_id


Line 662:                   INNER JOIN vm_device vd ON vd.vm_id = 
vm_static.vm_guid
Line 663:                   INNER JOIN images i ON i.image_group_id = 
vd.device_id
Line 664:                   INNER JOIN (SELECT image_id
Line 665:                               FROM image_storage_domain_map
Line 666:                               WHERE 
image_storage_domain_map.storage_domain_id = v_storage_domain_id) isd_map
those images can be selected from the table create above 
(STORAGE_DOMAIN_MAP_TABLE) - images on the domain to short the code here
Line 667:                               ON i.image_guid = isd_map.image_id) 
vm_guids_with_disks_on_storage_domain ON vm_static.vm_guid = 
vm_guids_with_disks_on_storage_domain.vm_guid
Line 668:       -- With all the VMs which have images on the storage domain, 
get all of their images and check if there is an image on another storage 
domain.
Line 669:       INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid
Line 670:       INNER JOIN images i ON i.image_group_id = vd.device_id


Line 735:    delete FROM vm_interface where vmt_guid in(select vm_guid from 
TEMPLATES_IDS_TEMPORARY_TABLE);
Line 736:    delete FROM permissions where object_id in (select vm_guid from 
TEMPLATES_IDS_TEMPORARY_TABLE);
Line 737:    delete FROM vm_static where vm_guid in(select vm_id as vm_guid 
from VM_IDS_TEMPORARY_TABLE where entity_type <> 'TEMPLATE');
Line 738: 
Line 739:    -- Delete devices which are related to VMs with MSD (VMs which has 
not removed)
please improve that comment..no one knows what is MSD and it's also related to 
templates
Line 740:    delete FROM vm_device where device_id in (select disk_id from 
STORAGE_DOMAIN_MAP_TABLE);
Line 741: 
Line 742:    -- Delete pools and snapshots of pools based on templates from the 
storage domain to be removed
Line 743:    delete FROM snapshots where vm_id in (select vm_guid FROM 
vm_static where vmt_guid in (select vm_guid from 
TEMPLATES_IDS_TEMPORARY_TABLE));


-- 
To view, visit http://gerrit.ovirt.org/28537
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic222ee55a711ea9101bf20ac812219714f70aab3
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Liron Ar <lara...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to