[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
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.