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 2133871

Summary: [Machines]qcow2 disk wrongly added as raw image
Product: Red Hat Enterprise Linux 9 Reporter: g.danti
Component: cockpit-machinesAssignee: Jelle van der Waa <jvanderwaa>
Status: CLOSED ERRATA QA Contact: Xianghua Chen <xchen>
Severity: low Docs Contact:
Priority: unspecified    
Version: 9.0CC: kkoukiou, mmarusak, mpitt, qzhang, skobyda, wshi, xchen, ymao, yunyang
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cockpit-machines-280-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:34:03 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:
Attachments:
Description Flags
adding disk via custom path
none
machine can not boot none

Description g.danti 2022-10-11 16:53:28 UTC
Description of problem:
When adding an existing qcow2 disk using the "custom path" option, the disk is added to the virtual machine as raw image rather than qcow2. The machine can not boot. This is the resulting xml file:

<disk type='file' device='disk'>
  <driver name='qemu' type='raw'/>
  <source file='/var/lib/libvirt/images/zzz.qcow2'/>
  <target dev='vda' bus='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</disk>

If adding the very same disk using the "use existing" option, the disk is correctly added as a qcow2 image and the machine can boot correctly.

Version-Release number of selected component (if applicable):
cockpit-machines-263-1.el9.noarch

How reproducible:
Always

Steps to Reproduce:
1. add an existing qcow2 disk to a VM using the "custom path" option
2. try to boot the VM
3. the VM does not boot

Actual results:
The VM does not boot because the disk is added as raw image.

Expected results:
The disk should be added with the right format (qcow2 vs raw) and the machine should boot correctly.

Additional info:
https://github.com/cockpit-project/cockpit-machines/issues/826

Comment 1 g.danti 2022-10-11 16:54:22 UTC
Created attachment 1917334 [details]
adding disk via custom path

Comment 2 g.danti 2022-10-11 16:54:43 UTC
Created attachment 1917335 [details]
machine can not boot

Comment 3 Martin Pitt 2022-10-12 08:57:00 UTC
This was discussed/tried a while ago in https://github.com/cockpit-project/cockpit-machines/pull/646 . Unfortunately it's quite tricky to do, so it got stuck. But I agree that this should be fixed eventually.

Comment 4 Xianghua Chen 2022-11-18 00:21:11 UTC
I can reproduce it, but no matter add the disk with "use existing" or "custom path" , the vm can boot successfully. I think you are not using RHEL.
But never mind, when using "custom path", it's indeed attached as raw.

Version:
cockpit-machines-276-1.el9.noarch

Steps to Reproduce:
1. Prepare a shutdown VM like cirros
2. Prepare a qcow2 file:
# qemu-img create -f qcow2 /var/lib/libvirt/images/test.qcow2 1G
3. Add the qcow2 disk using the "custom path" option, here is the xml:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.qcow2' index='1'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </disk>
4. Boot the VM, it can be boot
5. Remove the disk, add it again using "use existing", here is the xml
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/cirros.qcow2' index='2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </disk>
6. Boot the VM, it can be boot


The disk type in step 3 should be qcow2.

Comment 12 errata-xmlrpc 2023-05-09 07:34:03 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 (cockpit-machines 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-2023:2211