Bug 822440

Summary: [Storage][Clone vm from snapshot] Clone VM fails if the source or destination disk was moved to another storage domain.
Product: Red Hat Enterprise Virtualization Manager Reporter: Leonid Natapov <lnatapov>
Component: ovirt-engineAssignee: Shahar Havivi <shavivi>
Status: CLOSED CURRENTRELEASE QA Contact: Leonid Natapov <lnatapov>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: abaron, amureini, dyasny, iheim, lpeer, Rhev-m-bugs, shavivi, yeylon, ykaul, yzaslavs
Target Milestone: ---   
Target Release: 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: SI9 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-04 20:07:14 UTC 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: 563300, 831913, 835346, 835347, 835723    
Bug Blocks:    

Description Leonid Natapov 2012-05-17 10:58:02 UTC
[Storage][Clone vm from snapshot] Clone VM fails if the source disk was moved to another storage domain. This happens because the information about domains and disks should be taken from the DB and not from the OVF file.

Scenario:
1.Create VM with one or more disks.
2.Make a snapshot.
3.Go to the disks tab and move one of vm's disks to another storage domain.
4.Come back to VM's snapshots tab and try to clone VM from snapshot.

The operation will fail. GUI will stuck on "Clone VM from snapshot" dialog.

vdsm.log
--------
Thread-64064::ERROR::2012-05-17 12:25:48,487::task::853::TaskManager.Task::(_setError) Task=`52d7b70a-4cdb-4a04-b290-d4bbb6247849`::Unexpected error
Traceback (most recent call last):
  File "/usr/share/vdsm/storage/task.py", line 861, in _run
    return fn(*args, **kargs)
  File "/usr/share/vdsm/logUtils.py", line 38, in wrapper
    res = f(*args, **kwargs)
  File "/usr/share/vdsm/storage/hsm.py", line 1376, in copyImage
    pool.validateVolumeChain(sdUUID, srcImgUUID)
  File "/usr/share/vdsm/storage/securable.py", line 63, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/share/vdsm/storage/sp.py", line 1915, in validateVolumeChain
    image.Image(repoPath).validateVolumeChain(sdUUID, imgUUID)
  File "/usr/share/vdsm/storage/image.py", line 746, in validateVolumeChain
    chain = self.getChain(sdUUID, imgUUID)
  File "/usr/share/vdsm/storage/image.py", line 342, in getChain
    raise se.ImageDoesNotExistInSD(imgUUID, sdUUID)
ImageDoesNotExistInSD: Image does not exist in domain: 'image=6b396566-9f16-4bbb-9842-d8dd03fb9c9a, domain=1c60971a-8647-44ac-ae33-6520887f8843'

engine.log
----------
2012-05-17 13:51:48,362 INFO  [org.ovirt.engine.core.bll.MoveOrCopyImageGroupCommand] (ajp--0.0.0.0-8009-41) [65948c88] Running command: MoveOrCopyImageGroupCommand internal: true. Entities affected :  ID: 1c60971a-8647-44ac-ae33-6520887f8843 Type: Storage
2012-05-17 13:51:48,365 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CopyImageVDSCommand] (ajp--0.0.0.0-8009-41) [65948c88] START, CopyImageVDSCommand(storagePoolId = 36cc6fbc-9468-11e1-a5e5-001a4a169789, ignoreFailoverLimit = false, compatabilityVersion = 3.1, storageDomainId = 1c60971a-8647-44ac-ae33-6520887f8843, imageGroupId = 6b396566-9f16-4bbb-9842-d8dd03fb9c9a, imageId = d76bb4c1-596f-47f6-99e7-99bdce5aff58, dstImageGroupId = add5e619-c4b4-440c-844b-4b80985f5ae9, vmId = 0f65a8bc-2139-44a3-ac06-b3d0dde6254f, dstImageId = 13f0e251-4c77-444f-807f-a510760c9f6a, imageDescription = 22, dstStorageDomainId = 1c60971a-8647-44ac-ae33-6520887f8843, copyVolumeType = LeafVol, volumeFormat = RAW, preallocate = Preallocated, postZero = false, force = false), log id: 6d1acf0e
2012-05-17 13:51:48,380 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CopyImageVDSCommand] (ajp--0.0.0.0-8009-41) [65948c88] -- CopyImageVDSCommand::ExecuteIrsBrokerCommand: calling 'copyImage' with two new parameters: description and UUID
2012-05-17 13:51:48,385 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CopyImageVDSCommand] (ajp--0.0.0.0-8009-41) [65948c88] -- copyImage parameters:
                sdUUID=1c60971a-8647-44ac-ae33-6520887f8843
                spUUID=36cc6fbc-9468-11e1-a5e5-001a4a169789
                vmGUID=0f65a8bc-2139-44a3-ac06-b3d0dde6254f
                srcImageGUID=6b396566-9f16-4bbb-9842-d8dd03fb9c9a
                srcVolUUID=d76bb4c1-596f-47f6-99e7-99bdce5aff58
                dstImageGUID=add5e619-c4b4-440c-844b-4b80985f5ae9
                dstVolUUID=13f0e251-4c77-444f-807f-a510760c9f6a
                descr=22

2012-05-17 13:51:48,422 ERROR [org.ovirt.engine.core.vdsbroker.irsbroker.IrsBrokerCommand] (ajp--0.0.0.0-8009-41) [65948c88] IrsBroker::Failed::CopyImageVDS due to: IrsOperationFailedNoFailoverException: IRSGenericException: IRSErrorException: Image does not exist in domain: 'image=6b396566-9f16-4bbb-9842-d8dd03fb9c9a, domain=1c60971a-8647-44ac-ae33-6520887f8843'
2012-05-17 13:51:48,430 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CopyImageVDSCommand] (ajp--0.0.0.0-8009-41) [65948c88] FINISH, CopyImageVDSCommand, return: 00000000-0000-0000-0000-000000000000, log id: 6d1acf0e
2012-05-17 13:51:48,435 ERROR [org.ovirt.engine.core.bll.MoveOrCopyImageGroupCommand] (ajp--0.0.0.0-8009-41) [65948c88] Command org.ovirt.engine.core.bll.MoveOrCopyImageGroupCommand throw Vdc Bll exception. With error message VdcBLLException: org.ovirt.engine.core.vdsbroker.irsbroker.IrsOperationFailedNoFailoverException: IRSGenericException: IRSErrorException: Image does not exist in domain: 'image=6b396566-9f16-4bbb-9842-d8dd03fb9c9a, domain=1c60971a-8647-44ac-ae33

Comment 1 Leonid Natapov 2012-05-17 11:36:40 UTC
Cloning VM when user wants to reside VM's disks on another SD also doesn't work.
Same problem.

Comment 2 Itamar Heim 2012-05-30 13:10:44 UTC
yair - please review/comment

Comment 3 Yair Zaslavsky 2012-06-10 12:39:40 UTC
As explained at Comment #1 (I reviewed the code with Leonid when he opened the bug) -
The source diskImage is taken from the OVF that is stored per snapshot.
This is wrong - it should be taken from DB, to reflect any change that might have occurred (i.e - storage domain it resides on) after snapshot was created.

Comment 4 Shahar Havivi 2012-06-13 13:09:08 UTC
posted at: http://gerrit.ovirt.org/#/c/5322/

Comment 5 Shahar Havivi 2012-07-01 11:54:05 UTC
and UI patch at: http://gerrit.ovirt.org/#/c/5801/

Comment 6 Leonid Natapov 2012-07-09 12:52:31 UTC
si9. fixed.