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 1406981 - guestfish failed to launch nbd qcow2 image with --format=qcow2
Summary: guestfish failed to launch nbd qcow2 image with --format=qcow2
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-22 01:30 UTC by Xianghua Chen
Modified: 2016-12-22 11:59 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-22 11:59:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
log.nbd-qcow2 (8.58 KB, text/plain)
2016-12-22 01:30 UTC, Xianghua Chen
no flags Details

Description Xianghua Chen 2016-12-22 01:30:26 UTC
Created attachment 1234583 [details]
log.nbd-qcow2

Description of problem:
guestfish failed to launch nbd qcow2 image with --format=qcow2

Version-Release number of selected component (if applicable):
libguestfs-1.32.7-3.el7.x86_64

How reproducible:
100%

Steps:
1. Prepare a nbd server on fedora: 10.66.9.95
# modprobe nbd

Prepare a qcow2 guest image:
$ qemu-img info RHEL-Server-7.2-64-hvm.qcow2
image: RHEL-Server-7.2-64-hvm.qcow2
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 2.2G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

$ qemu-nbd RHEL-Server-7.2-64-hvm.qcow2 -t

2. On rhel7 client:
# guestfish -a nbd://10.66.9.95 -i
libguestfs: error: could not auto-detect the format when using a non-file protocol.
If the format is known, pass the format to libguestfs, eg. using the
'--format' option, or via the optional 'format' argument to 'add-drive'.


# guestfish --format=qcow2 -a nbd://10.66.9.95 -i -v -x
... ...
ibguestfs: error: could not create appliance through libvirt.
Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct
Original error from libvirt: internal error: process exited while connecting to monitor: 2016-12-21T08:25:14.437395Z qemu-kvm: -drive file=nbd:10.66.9.95:10809,format=qcow2,if=none,id=drive-scsi0-0-0-0,cache=writeback: could not open disk image nbd:10.66.9.95:10809: Image is not in qcow2 format [code=1 int1=-1]
libguestfs: clear_socket_create_context: setsockcreatecon failed: NULL: Invalid argument [you can ignore this message if you are not using SELinux + sVirt]
libguestfs: trace: launch = -1 (error)



If I use --format=raw it'll be ok:
# guestfish --format=raw -a nbd://10.66.9.95 -i


Please check the -v -x log in attachment.



Actual results:
The first 2 command in step2 all failed.

Expected results:
The guestfish with --format=qcow2 or with no --format should all work.
The guestfish with --format=raw should not work.


Additional info:
# qemu-img info nbd://10.66.9.95
image:
file format: raw
virtual size: 8.0G (8589934592 bytes)
disk size: unavailable

Seems like qemu's problem?
But libguestfs should detect it without using --format or have other workaround for this.

Comment 1 Richard W.M. Jones 2016-12-22 11:59:21 UTC
This is correct and not a bug.  The qemu-nbd process opens the
qcow2 file and serves it as a raw file.  On the client side (libguestfs)
you therefore have to access it as raw.


Note You need to log in before you can comment on or make changes to this bug.