Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1893540

Summary: Cannot clone a suspended VM
Product: [oVirt] ovirt-engine Reporter: Tamir <tamir>
Component: BLL.VirtAssignee: Shmuel Melamud <smelamud>
Status: CLOSED CURRENTRELEASE QA Contact: Tamir <tamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4.3.9CC: ahadas, bugs, michal.skrivanek
Target Milestone: ovirt-4.4.4Flags: pm-rhel: ovirt-4.4+
Target Release: 4.4.4.1   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.4.4.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-21 12:35:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Added logs none

Description Tamir 2020-11-01 16:16:35 UTC
Created attachment 1725571 [details]
Added logs

Description of problem:
When cloning a suspended VM, the action fails with the UI message:
"Error while executing action CloneVm: Internal Engine Error".

In the engine.log:
2020-11-01 18:02:08,469+02 INFO  [org.ovirt.engine.core.bll.CloneVmCommand] (default task-2) [c4f55320-df19-4e35-a13e-6a9eabd751e1] Running command: CloneVmCommand internal: false. Entities affected :  ID: ac0b55e2-115a-40b1-bb07-10daa39477c9 Type: VMAction group CREATE_VM with role type USER
2020-11-01 18:02:08,840+02 WARN  [org.ovirt.engine.core.bll.snapshots.CreateSnapshotForVmCommand] (default task-2) [c4f55320-df19-4e35-a13e-6a9eabd751e1] Validation of action 'CreateSnapshotForVm' failed for user admin@internal-authz. Reasons: VAR__ACTION__CREATE,VAR__TYPE__SNAPSHOT,ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL,VAR__VM_STATUS__SUSPENDED
2020-11-01 18:02:08,863+02 ERROR [org.ovirt.engine.core.bll.CloneVmCommand] (default task-2) [c4f55320-df19-4e35-a13e-6a9eabd751e1] Failed to create VM snapshot
2020-11-01 18:02:08,864+02 ERROR [org.ovirt.engine.core.bll.CloneVmCommand] (default task-2) [c4f55320-df19-4e35-a13e-6a9eabd751e1] Command 'org.ovirt.engine.core.bll.CloneVmCommand' failed: EngineException: ENGINE (Failed with error ENGINE and code 5001)

Added logs.

Version-Release number of selected component (if applicable):
RHV 4.4.3-12 (ovirt-engine.noarch 4.4.3.9-0.1.el8ev)
RHEL 8.3 x86 hosts and engine.
vdsm.x86_64 4.40.35.1-1.el8ev on the hosts.

How reproducible:
100%

Steps to Reproduce:
1. Create a 4.5 data center and a 4.5 cluster.
2. Install the host and create a new NFS storage domain.
3. Create a VM with a disk and wait for its creation.
4. Run the VM.
5. Suspend the VM.
6. Clone the VM. 

Actual results:
1. The 4.5 data center and the 4.5 cluster were created.
2. The host was installed and the NFS storage domain was created.
3. The VM with the disk was created.
4. The VM is running.
5. The VM is suspended
6. The VM clone operation has been canceled automatically with the UI message:
"Error while executing action CloneVm: Internal Engine Error".

Expected results:
1-5 steps are as expected.
6. The VM should have been cloned.

Additional info:

Comment 1 Michal Skrivanek 2020-11-11 07:51:48 UTC
Do we really want to support this? We anyway have to discard the state as the clone cannot be the exact same state as the original...so it's not really different from cloning Down. Do you intend to clone like that or keep blocking it altogether?

Comment 2 Arik 2020-11-11 08:33:19 UTC
The latter, to block it.
Clone-VM invokes create-snapshot and create-snapshot is forbidden on suspended vm so we should block it with a proper error instead of "Internal Engine Error"

Comment 3 Arik 2020-11-15 14:42:45 UTC
(In reply to Tamir from comment #0)
> Expected results:
> 1-5 steps are as expected.
> 6. The VM should have been cloned.

As mentioned in comment 2, the expectation is to fail with a proper error on the client (UI/API) side

Comment 4 Tamir 2020-11-22 10:09:17 UTC
Verified on RHV 4.4.3-3. All looks good to me.

Env:
  - Engine instance with RHV 4.4.4-2 (ovirt-engine-4.4.4.1-0.1.el8ev) and RHEL 8.3 installed.
  - 2 hosts with RHV 4.4.4-2 and RHEL 8.3, one host with vdsm-4.40.37-1.el8ev and the other host with vdsm-4.40.37-1.el8ev

Steps:

In Admin Portal:

1. Create a 4.5 data center and a 4.5 cluster.
2. Install the host and create a new NFS storage domain.
3. Create a VM with a disk and wait for its creation.
4. Run the VM.
5. Suspend the VM.
6. Try cloning the VM.


Results (As Expected):
1. The 4.5 data center and the 4.5 cluster were created.
2. The host was installed and the NFS storage domain was created.
3. The VM with the disk was created.
4. The VM is running.
5. The VM is suspended
6. The VM clone button was grayed out (Disabled) in the GUI and when I used clone in the rest API I got the following response:
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <fault>
        <detail>[Cannot add VM because the VM is in Suspended status.]</detail>
        <reason>Operation Failed</reason>
    </fault>
    <status>failed</status>
    <vm>
        <name>VM</name>
    </vm>
</action>"

Comment 5 Sandro Bonazzola 2020-12-21 12:35:52 UTC
This bugzilla is included in oVirt 4.4.4 release, published on December 21st 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.4 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.