Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2001794

Summary: [virt-clone] wrong error message advises to run clone on paused machine
Product: Red Hat Enterprise Linux 8 Reporter: smitterl
Component: virt-managerAssignee: Jonathon Jongsma <jjongsma>
Status: CLOSED ERRATA QA Contact: Hongzhou Liu <hongzliu>
Severity: low Docs Contact:
Priority: low    
Version: 8.5CC: bfu, fjin, jjongsma, jsuchane, juzhou, phrdina, pkrempa, tyan, tzheng, virt-maint
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-manager-3.2.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:54:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2009080    
Bug Blocks:    

Description smitterl 2021-09-07 08:18:30 UTC
Description of problem:
virt-clone error message advises valid vm state for clone is paused causing churn for the user as they have to stop the machine from paused state before re-running virt-clone a third time


Version-Release number of selected component (if applicable):
virt-install-2.2.1-4.el8.noarch

How reproducible:
100%


Steps to Reproduce:
1. Have vm running
2. virt-clone --auto-clone --original vm --name clone
>>
ERROR    Domain with devices to clone must be paused or shutoff.
3. virsh suspend vm
4. virt-clone --auto-clone --original vm --name clone

Actual results:
>>
ERROR    Couldn't create storage volume 'vm2-clone-clone-1.qcow2': 'internal error: Child process (/usr/bin/qemu-img convert -f qcow2 -O qcow2 -o compat=1.1,lazy_refcounts /var/lib/libvirt/images/vm2-clone.qcow2 /var/lib/libvirt/images/vm2-clone-clone-1.qcow2) unexpected exit status 1: qemu-img: Could not open '/var/lib/libvirt/images/vm2-clone.qcow2': Failed to get shared "write" lock
Is another process using the image [/var/lib/libvirt/images/vm2-clone.qcow2]?


Expected results:
After 2.
>>
ERROR    Domain with devices to clone must be shut off.

Comment 1 Peter Krempa 2021-09-07 13:55:08 UTC
virt-clone is part of the virt-manager package.

Comment 3 Martin Kletzander 2021-09-30 13:15:55 UTC
Fixed upstream by v2.2.1-268-g140a1f3b15d4:

commit 140a1f3b15d47ea5d2d56bdf56d0484419023280
Author: Cole Robinson <crobinso>
Date:   Wed Jan 29 16:14:55 2020 -0500

    cloner: Drop ability to clone a paused VM

This was fixed in upstream Bug 1725330.

Comment 4 smitterl 2021-11-03 11:29:53 UTC
IIUC this will be fixed by the next rebase in 8.6 https://bugzilla.redhat.com/show_bug.cgi?id=2009080

Comment 8 Hongzhou Liu 2021-11-25 09:45:15 UTC
I can reproduce this issue with package:
virt-install-2.2.1-4.el8.noarch

Steps:
1. Prepare a running status’  vm1
# virsh domstate vm1
>>
running
 
2. Run the command below to  clone the VM.
# virt-clone --auto-clone --original vm1 --name clone-vm1
>>
ERROR    Domain with devices to clone must be paused or shutoff.

Comment: Since the qcow image has been locked by qemu, a paused vm can not be cloned.This error message needs to be updated

3.  Suspend vm1 and clone it
# virsh domstate vm1
>>
paused
#  virt-clone --auto-clone --original vm1 --name clone-vm1
>>
WARNING  Setting the graphics device port to autoport, in order to avoid conflicting.
ERROR    Couldn't create storage volume 'clone-vm1.img': 'internal error: Child process (/usr/bin/qemu-img convert -f qcow2 -O qcow2 -o compat=1.1,lazy_refcounts /var/lib/libvirt/images/vm1.img /var/lib/libvirt/images/clone-vm1.img) unexpected exit status 1: qemu-img: Could not open '/var/lib/libvirt/images/vm1.img': Failed to get shared "write" lock
Is another process using the image [/var/lib/libvirt/images/vm1.img]?
'


Then try to verify this bug with new build - virt-install-3.2.0-1.el8.noarch

Steps:
1: Prepare a running status’  vm1
# virsh domstate vm1
>>
running

2: Run the command below to clone the running VM.
#  virt-clone --auto-clone --original vm1 --name clone-vm1
>>
ERROR    Domain to clone must be shutoff.

Comment: The error message is clear for the user

3: suspend vm1 and try step 2 again
# virsh domstate vm1
>>
paused
#  virt-clone --auto-clone --original vm1 --name clone-vm1
>>
ERROR    Domain to clone must be shutoff
Comment: The error message is clear for the user, failed to clone a paused VM.

4. Shut off vm1 and try step 2 again
# virsh domstate vm1
>>
shut off
#  virt-clone --auto-clone --original vm1 --name clone-vm1
>>
Allocating 'clone-vm1.img'                                                                                                 | 6.0 GB  00:00:00     
Clone 'clone-vm1' created successfully.

Comment: A shutoff vm can be cloned successfully.

Summary - All the test results are as expected. So I moved this bug from ON_QA to VERIFIED status.

Comment 9 Hongzhou Liu 2021-12-23 05:18:56 UTC
Hi Sebastian,

Because this bug first report on S390, so could you double check the bug?

Thanks

Comment 10 smitterl 2021-12-24 09:37:32 UTC
(In reply to Hongzhou Liu from comment #9)
> Hi Sebastian,
> 
> Because this bug first report on S390, so could you double check the bug?
> 
> Thanks

I don't think it's necessary. The change is arch-independent and only the error message was changed, IIUC.

Comment 12 errata-xmlrpc 2022-05-10 13:54:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2022:1862