Bug 1161966

Summary: [engine-backend] resizing a disk attached to a paused VM leaves the image LOCKED
Product: Red Hat Enterprise Virtualization Manager Reporter: Elad <ebenahar>
Component: ovirt-engineAssignee: Amit Aviram <aaviram>
Status: CLOSED CURRENTRELEASE QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: amureini, gklein, lpeer, lsurette, rbalakri, Rhev-m-bugs, scohen, tnisan, yeylon, ykaul
Target Milestone: ovirt-3.6.0-rcKeywords: ZStream
Target Release: 3.6.0   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-3.6.0_qa1 Doc Type: Bug Fix
Doc Text:
Cause: Resizing a disk attached to a paused VM was enabled Consequence: Extending the disk while the vm is paused can cause errors when resuming the VM. Fix: Resizing the disk while the VM is paused is now disabled Result:
Story Points: ---
Clone Of:
: 1171725 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1171725    
Attachments:
Description Flags
logs none

Description Elad 2014-11-09 21:50:42 UTC
Created attachment 955577 [details]
logs

Description of problem:
Trying to resize an image disk while it is attached to a paused VM causes the image to get stuck as LOCKED. 

Version-Release number of selected component (if applicable):
rhev 3.5 vt9
rhevm-3.5.0-0.19.beta.el6ev.noarch
Host OS: Red Hat Enterprise Linux Server release 7.0 (Maipo)
vdsm-4.16.7.3-1.el7ev.x86_64
libvirt-daemon-1.1.1-29.el7_0.3.x86_64
qemu-kvm-rhev-1.5.3-60.el7_0.10.x86_64
selinux-policy-3.13.1-6.el7.noarch
sanlock-3.1.0-2.el7.x86_6

How reproducible:
Always


How reproducible:
Always

Steps to Reproduce:
1. Create a VM with a disk attached, start it in paused state
2. Perform a live resize to the disk while it is attached to the paused VM
3.

The image gets LOCKED. tried to resume the VM, it was blocked on CanDoAction:

2014-11-09 23:05:35,046 WARN  [org.ovirt.engine.core.bll.RunVmCommand] (ajp-/127.0.0.1:8702-5) [7c4a42d4] CanDoAction of action RunVm failed. Reasons:VAR__ACTION__RUN,VAR__TYPE__VM,ACTION_TYPE_FAILED_VM_IS_LOCKED


Then I stopped the VM. The image remained LOCEKD.


Actual results:


The request to extend the disk as shown in engine.log:


2014-11-09 23:02:29,693 INFO  [org.ovirt.engine.core.bll.UpdateVmDiskCommand] (ajp-/127.0.0.1:8702-14) [247d4b89] Running command: UpdateVmDiskCommand internal: false. Entities 
affected :  ID: 3e5be0c4-ffb4-48e0-95ff-5d4d391c3b48 Type: DiskAction group EDIT_DISK_PROPERTIES with role type USER
2014-11-09 23:02:29,709 INFO  [org.ovirt.engine.core.bll.ExtendImageSizeCommand] (ajp-/127.0.0.1:8702-14) [7f70c980] Running command: ExtendImageSizeCommand internal: true. Enti
ties affected :  ID: 3e5be0c4-ffb4-48e0-95ff-5d4d391c3b48 Type: DiskAction group EDIT_DISK_PROPERTIES with role type USER


The task is executed by vdsm but it seems that engine do not poll it so it remains in state 'finished' in vdsm tasks queue:

[root@green-vdsb ~]# vdsClient -s 0 getAllTasks
efc97870-d3e7-4d7e-b80a-ac5bcb082aad :
        verb = extendVolumeSize
        code = 0
        state = finished
        tag = spm
        result = 
        message = 1 jobs completed successfully
        id = efc97870-d3e7-4d7e-b80a-ac5bcb082aad


efc97870-d3e7-4d7e-b80a-ac5bcb082aad::DEBUG::2014-11-09 23:02:30,869::task::595::Storage.TaskManager.Task::(_updateState) Task=`efc97870-d3e7-4d7e-b80a-ac5bcb082aad`::moving from state running -> state finished


After ~35 min:

Thread-24082::DEBUG::2014-11-09 23:36:19,858::task::1191::Storage.TaskManager.Task::(prepare) Task=`3bff3ac3-9ed1-4969-8ced-94954c4000ad`::finished: {'tasks': {'efc97870-d3e7-4d
7e-b80a-ac5bcb082aad': {'code': 0, 'tag': u'spm', 'state': 'finished', 'verb': 'extendVolumeSize', 'result': '', 'message': '1 jobs completed successfully', 'id': 'efc97870-d3e7
-4d7e-b80a-ac5bcb082aad'}}}


The image remains LOCKED.


              image_guid              | disk_alias  | imagestatus 
--------------------------------------+-------------+-------------

 3f8c8b58-b3d5-48c1-8f5d-17bd1bdbe297 | vm-3_Disk1  |           2



Expected results:
1) In my opinion, resize to a disk while it is attached to a VM in pasued should be blocked on CanDoAction
2) If it should not be blocked, engine should poll the task and clean it so the image won't get stuck in LOCKED


Additional info: 
engine.log 
vdsm.log
messages
qemu log

Comment 1 Tal Nisan 2014-11-24 17:37:10 UTC
Amit, all that is needed is to prevent the VM disk from being resized while the VM is in paused state

Comment 3 Elad 2015-04-26 13:01:02 UTC
A disk, attached to a paused VM cannot be resized.

" Cannot edit Virtual Machine Disk because the VM is in Paused status. "

Verified using ovirt-engine-3.6.0_qa1 
ovirt-engine-3.6.0-0.0.master.20150412172306.git55ba764.el6.noarch

Comment 4 Allon Mureinik 2016-03-10 10:44:37 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE

Comment 5 Allon Mureinik 2016-03-10 10:48:27 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE

Comment 6 Allon Mureinik 2016-03-10 12:04:57 UTC
RHEV 3.6.0 has been released, setting status to CLOSED CURRENTRELEASE