Eli Mesika has uploaded a new change for review. Change subject: core:unlock_entity.sh is not unlocking the vm... ......................................................................
core:unlock_entity.sh is not unlocking the vm... unlock_entity.sh is not unlocking the vm, only images under the vm Fixing the query to remove the vm/template when -r flag is given by changing the order of execution and replacing the nested query with a simple assignment. Change-Id: I21ae0588a24ae93c26a4a44f296e05c3a411d677 Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/dbscripts/common_sp.sql 1 file changed, 8 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/11252/1 diff --git a/backend/manager/dbscripts/common_sp.sql b/backend/manager/dbscripts/common_sp.sql index 64098eb..d9228b7 100644 --- a/backend/manager/dbscripts/common_sp.sql +++ b/backend/manager/dbscripts/common_sp.sql @@ -482,25 +482,21 @@ TEMPLATE_OK:=0; TEMPLATE_LOCKED:=1; IMAGE_LOCKED:=15; - if (v_recursive) then - v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; - update images set imagestatus = OK where imagestatus = LOCKED and - image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); - end if; + v_id := vm_guid from vm_static where vm_name = v_name and entity_type ilike v_object_type; -- set VM status to DOWN if (v_object_type = 'vm') then - update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and - vm_guid in - (select vm_guid from vm_static where vm_name = v_name); + update vm_dynamic set status = DOWN where status = IMAGE_LOCKED and vm_guid = v_id; -- set Template status to OK else if (v_object_type = 'template') then - update vm_static set template_status = TEMPLATE_OK - where template_status = TEMPLATE_LOCKED and - vm_guid in - (select vm_guid from vm_static where vm_name = v_name); + update vm_static set template_status = TEMPLATE_OK where template_status = TEMPLATE_LOCKED and vm_guid = v_id; end if; end if; + --unlock images if recursive flag is set + if (v_recursive) then + update images set imagestatus = OK where imagestatus = LOCKED and + image_group_id in (select device_id from vm_device where vm_id = v_id and is_plugged); + end if; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/11252 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I21ae0588a24ae93c26a4a44f296e05c3a411d677 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
