Bug 901971

Summary: engine: unlock_entity.sh is not unlocking the vm, only images under the vm
Product: Red Hat Enterprise Virtualization Manager Reporter: Dafna Ron <dron>
Component: ovirt-engineAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: David Botzer <dbotzer>
Severity: high Docs Contact:
Priority: high    
Version: 3.2.0CC: acathrow, dyasny, iheim, lpeer, pstehlik, Rhev-m-bugs, sgrinber, yeylon, ykaul, yzaslavs
Target Milestone: ---   
Target Release: 3.2.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: infra
Fixed In Version: sf5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 915537    
Attachments:
Description Flags
screen shot none

Description Dafna Ron 2013-01-20 09:59:45 UTC
Created attachment 683506 [details]
screen shot

Description of problem:

I have a locked vm which I wanted to unlock using the unlock_entity.sh script. 
although its reported as successful, only the objects under the vm were unlocked nut not the vm itself. 
running the query again after the unlock will show that there are not locked objects: 

before: 

 vm_name |               disk_id                
---------+--------------------------------------
 FGFG    | f463a392-1a3e-4f0a-a8c6-885d994a1383
 NEW     | dd749492-baa0-4478-b8ef-d277c88a5272
(2 rows)


after: 

[root@dafna-web-admin dbscripts]# ./unlock_entity.sh -r -t vm -i FGFG -s localhost -p 5432 -d engine -u postgres
Caution, this operation may lead to data corruption and should be used with care. Please contact support prior to running this command
Are you sure you want to proceed? [y/n]
y
select fn_db_unlock_entity('vm', 'FGFG', true);
 

INSERT 887842 1
unlock vm FGFG completed successfully.[root@dafna-web-admin dbscripts]# ./unlock_entity.sh -r -t vm -i NEW -s localhost -p 5432 -d engine -u postgres
Caution, this operation may lead to data corruption and should be used with care. Please contact support prior to running this command
Are you sure you want to proceed? [y/n]
y
select fn_db_unlock_entity('vm', 'NEW', true);
 

INSERT 887847 1
unlock vm NEW completed successfully.[root@dafna-web-aq -t vm -s localhost -p 5432 -d engine -u postgres^C
[root@dafna-web-admin dbscripts]# ./unlock_entity.sh -q -t vm -s localhost -p 5432 -d engine -u postgres
 vm_name 
---------
 DESKTOP
(1 row)



Version-Release number of selected component (if applicable):

sf3

How reproducible:

100%

Steps to Reproduce:
1. lock a vm and the disks
2. run unlock on vm entity with -r
3. only the disks will be released but the vm still appears as locked
  
Actual results:

we are not unlocking the vm

Expected results:

we should unlock vm as well when using the -r option

Additional info:

Comment 1 Eli Mesika 2013-01-21 11:52:41 UTC
http://gerrit.ovirt.org/#/c/11252/

Comment 4 Eli Mesika 2013-01-24 17:37:51 UTC
fixed in commit : 8c05bba

Comment 6 David Botzer 2013-03-27 11:02:17 UTC
Eli,

3.2/SF11

1. I export a vm to template
2. I unlock the VM while it is exporting to template
-- vm & its disk are stopped
3. But the Template is still locked !!! and stops only when it finishes creating the Template

--> is it correct ?
3.2/SF11

Comment 7 Dafna Ron 2013-03-27 11:36:49 UTC
(In reply to comment #6)
> Eli,
> 
> 3.2/SF11
> 
> 1. I export a vm to template
> 2. I unlock the VM while it is exporting to template
> -- vm & its disk are stopped
> 3. But the Template is still locked !!! and stops only when it finishes
> creating the Template
> 
> --> is it correct ?
> 3.2/SF11

vm and template are different objects and so are their images. 
unlock of a vm will only change the vm and its images state in the db and does not change the state of any other images which are copied/cloned from it  
this behavior is correct and should also not be changes since it might create problems in the images in the lower layers.

Comment 8 David Botzer 2013-03-27 11:50:15 UTC
Fixed, 3.2/SF11
Locked VMs & disks are stopped correctly
Fixed, 3.2/SF11

Comment 9 Itamar Heim 2013-06-11 09:28:43 UTC
3.2 has been released

Comment 10 Itamar Heim 2013-06-11 09:31:46 UTC
3.2 has been released

Comment 11 Itamar Heim 2013-06-11 09:47:40 UTC
3.2 has been released