Daniel Erez has posted comments on this change. Change subject: core: Support detach Storage Domain containing entities. ......................................................................
Patch Set 20: (12 comments) http://gerrit.ovirt.org/#/c/24286/20/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java: Line 99: private static Integer getLowDiskSpaceThreshold() { Line 100: return Config.<Integer> getValue(ConfigValues.FreeSpaceCriticalLowInGB); Line 101: } Line 102: Line 103: // TODO: Validation should be removed once we should support detach of storage domain with VMs containing multiple disks or different storage domains. * s/should support/support * s/or/resides on Line 104: public ValidationResult hasDisksOnRelatedStorageDomains() { Line 105: // If there are VMs with disks on other storage domain we should block the operation. Line 106: List<VM> vms = getDbFacade().getVmDao().getAllVMsWithDisksOnOtherStorageDomain(storageDomain.getId()); Line 107: if (!vms.isEmpty()) { http://gerrit.ovirt.org/#/c/24286/20/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java: Line 550: ACTION_TYPE_FAILED_LUNS_ALREADY_PART_OF_STORAGE_DOMAINS(ErrorType.CONFLICT), Line 551: ACTION_TYPE_FAILED_LUNS_ALREADY_USED_BY_DISKS(ErrorType.CONFLICT), Line 552: ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST(ErrorType.BAD_PARAMETERS), Line 553: ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST(ErrorType.BAD_PARAMETERS), Line 554: ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS(ErrorType.BAD_PARAMETERS), duplicate key Line 555: ACTION_TYPE_FAILED_STORAGE_CONNECTION_NOT_EXIST(ErrorType.BAD_PARAMETERS), Line 556: ACTION_TYPE_FAILED_STORAGE_CONNECTION_FOR_DOMAIN_NOT_EXIST(ErrorType.BAD_PARAMETERS), Line 557: ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS(ErrorType.CONFLICT), Line 558: ACTION_TYPE_FAILED_STORAGE_CONNECTION_FOR_DOMAIN_ALREADY_EXISTS(ErrorType.CONFLICT), http://gerrit.ovirt.org/#/c/24286/20/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDAO.java: Line 97: * The VM to look up snapshots for. Line 98: * @return List of images (empty if none found). Line 99: */ Line 100: List<DiskImage> getImagesWithNoDisk(Guid vmId); Line 101: add java-doc Line 102: List<DiskImage> getAllForStorageDomain(Guid storageDomainId); http://gerrit.ovirt.org/#/c/24286/20/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java File frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java: Line 666: Line 667: @DefaultStringValue("Cannot ${action} ${type}. The Storage Domain already contains the target disk(s).") Line 668: String ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_CONTAINS_DISK(); Line 669: Line 670: @DefaultStringValue("Cannot ${action} ${type}. there are VMs/Templates which contain disks related to other storage domains.") /s/there/Threre Line 671: String ACTION_TYPE_FAILED_STORAGE_DOMAIN_CONTAINS_DISK_ON_OTHER_STORAGE_DOMAIN(); Line 672: Line 673: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are delete protected: ${vms}.") Line 674: String ACTION_TYPE_FAILED_STORAGE_DELETE_PROTECTED(); Line 669: Line 670: @DefaultStringValue("Cannot ${action} ${type}. there are VMs/Templates which contain disks related to other storage domains.") Line 671: String ACTION_TYPE_FAILED_STORAGE_DOMAIN_CONTAINS_DISK_ON_OTHER_STORAGE_DOMAIN(); Line 672: Line 673: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are delete protected: ${vms}.") VMs/Templates Line 674: String ACTION_TYPE_FAILED_STORAGE_DELETE_PROTECTED(); Line 675: Line 676: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are not down: ${vms}.") Line 677: String ACTION_TYPE_FAILED_STORAGE_VMS_NOT_DOWN(); Line 672: Line 673: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are delete protected: ${vms}.") Line 674: String ACTION_TYPE_FAILED_STORAGE_DELETE_PROTECTED(); Line 675: Line 676: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are not down: ${vms}.") VMs/Templates Line 677: String ACTION_TYPE_FAILED_STORAGE_VMS_NOT_DOWN(); Line 678: Line 679: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are attached to pool: ${vms}.") Line 680: String ACTION_TYPE_FAILED_STORAGE_VMS_IN_POOL(); Line 675: Line 676: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are not down: ${vms}.") Line 677: String ACTION_TYPE_FAILED_STORAGE_VMS_NOT_DOWN(); Line 678: Line 679: @DefaultStringValue("Cannot ${action} ${type}. The following VMs are attached to pool: ${vms}.") VMs/Templates Line 680: String ACTION_TYPE_FAILED_STORAGE_VMS_IN_POOL(); Line 681: Line 682: @DefaultStringValue("Cannot ${action} ${type}. The Storage Domain name is already in use.") Line 683: String ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST(); Line 1287: Line 1288: @DefaultStringValue("Cannot ${action} ${type}. Storage Domain doesn't exist.") Line 1289: String ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST(); Line 1290: Line 1291: @DefaultStringValue("Cannot ${action} ${type}. There are VMs which contain disks related to other storage domains. The VMs are: ${vms}.") should be removed Line 1292: String ACTION_TYPE_FAILED_STORAGE_CONTAINS_VMS_WITH_DISKS_ON_OTHER_DOMAINS(); Line 1293: Line 1294: @DefaultStringValue("Cannot ${action} ${type}. Cannot change Storage Domain type.") Line 1295: String ACTION_TYPE_FAILED_CANNOT_CHANGE_STORAGE_DOMAIN_TYPE(); http://gerrit.ovirt.org/#/c/24286/20/packaging/dbscripts/storages_sp.sql File packaging/dbscripts/storages_sp.sql: Line 634: END; $procedure$ Line 635: LANGUAGE plpgsql; Line 636: Line 637: Line 638: Create or replace FUNCTION Remove_Entities_From_storage_domain(v_storage_domain_id UUID) consider leaving the disks in db on detach Line 639: RETURNS VOID Line 640: AS $procedure$ Line 641: BEGIN Line 642: BEGIN Line 713: RETURNS VOID Line 714: AS $procedure$ Line 715: BEGIN Line 716: PERFORM Remove_Entities_From_storage_domain(v_storage_domain_id); Line 717: delete FROM storage_domain_dynamic where id = v_storage_domain_id; remove double spaces Line 718: delete FROM storage_domain_static where id = v_storage_domain_id; Line 719: END; $procedure$ Line 720: LANGUAGE plpgsql; Line 721: http://gerrit.ovirt.org/#/c/24286/20/packaging/dbscripts/vms_sp.sql File packaging/dbscripts/vms_sp.sql: Line 1072: INNER JOIN vm_device vd ON vd.vm_id = vm_static.vm_guid Line 1073: INNER JOIN images i ON i.image_group_id = vd.device_id Line 1074: INNER JOIN (SELECT image_id Line 1075: FROM image_storage_domain_map Line 1076: WHERE image_storage_domain_map.storage_domain_id = v_storage_domain_id) ISD isd_map Line 1077: ON i.image_guid = ISD.image_id) vms_with_disks_on_storage_domain ON vms.vm_guid = vms_with_disks_on_storage_domain.vm_guid Line 1078: INNER JOIN vm_device vd ON vd.vm_id = vms.vm_guid Line 1079: INNER JOIN images i ON i.image_group_id = vd.device_id Line 1080: INNER JOIN image_storage_domain_map on i.image_guid = image_storage_domain_map.image_id Line 1081: WHERE image_storage_domain_map.storage_domain_id != v_storage_domain_id; Line 1082: END; $procedure$ Line 1083: LANGUAGE plpgsql; Line 1084: Line 1085: Create or replace FUNCTION updateClusterForDetachedVMs(v_storage_domain_id UUID) not needed Line 1086: RETURNS VOID Line 1087: AS $procedure$ Line 1088: BEGIN Line 1089: UPDATE vm_static -- To view, visit http://gerrit.ovirt.org/24286 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I971fe6acd4a2667a09487c5e1108cf7c759587f1 Gerrit-PatchSet: 20 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: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com> Gerrit-Reviewer: Liron Ar <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Sergey Gotliv <sgot...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@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