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.
Description of problem:
When attempting to launch a KVM instance with a disk using the vvfat protocol, QEMU exits with apparently random error messages reported back
So far I've seen
qemu: could not open disk image fat:floppy:/home/berrange/src/virt/libvirt-tck/fat: Inappropriate ioctl for device
qemu: could not open disk image fat:floppy:/tmp: No such file or directory
qemu: could not open disk image fat:floppy:/tmp: Invalid argument
This appears to be a flaw in vl.c handling of bdrv_open() return codes. It currently does
fprintf(stderr, "qemu: could not open disk image %s: %s\n",
file, strerror(errno));
However, the bdrv_open() API contract does *not* actually set errno, so this is just reporting the last errno that happened to be set by some other random piece of QEMU code. The actual error is in the bdrv_open() return value.
Something like this appears to be neccessary:
diff --git a/vl.c b/vl.c
index 6d08ec8..4a4c818 100644
--- a/vl.c
+++ b/vl.c
@@ -792,6 +792,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
const char *devaddr;
DriveInfo *dinfo;
int snapshot = 0;
+ int err;
*fatal_error = 1;
@@ -1122,9 +1123,9 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
- if (bdrv_open(dinfo->bdrv, file, bdrv_flags, drv) < 0) {
+ if ((err = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv)) < 0) {
fprintf(stderr, "qemu: could not open disk image %s: %s\n",
- file, strerror(errno));
+ file, strerror(-err));
return NULL;
}
There is still a problem with this though. When bdrv_open() fails to open a disk due to its protocol/format not being in the whitelist, it set ret=-ENOENT.
The ENOENT error code is a very commonly seen error in user configuration errors due to typos in disk paths. Thus it is rather mis-leading as a way of reporting a block driver is not allowed by the whitelist.
Ideally this will all use qerror() eventually, but in the meantime, it would be more helpful to use a different errno for this case
diff --git a/block.c b/block.c
index 39724c1..36b7e3f 100644
--- a/block.c
+++ b/block.c
@@ -565,7 +565,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
}
if (!drv) {
- ret = -ENOENT;
+ ret = -ENOSYS;
goto unlink_and_fail;
}
This makes it report:
qemu: could not open disk image fat:floppy:/tmp: Function not implemented
which gives a better indication that the fat capability has been disabled by the whitelist.
Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.78.el6.x86_64
How reproducible:
Sometimes, occassionally the previously set errno matches the currently ENOENT, but often it doesn't. Regardless ENOENT is a very misleading code.
Steps to Reproduce:
1. qemu -drive file=fat:floppy:/tmp
2.
3.
Actual results:
qemu: could not open disk image fat:floppy:/tmp: No such file or directory
Expected results:
qemu: could not open disk image fat:floppy:/tmp: Function not implemented
Additional info:
Comment 2RHEL Program Management
2010-06-24 13:32:53 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release. Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release. This request is not yet committed for
inclusion.
Comment 5Markus Armbruster
2011-02-16 18:05:19 UTC
Need to backport two upstream patches:
236f1f6 Fix error message in drive_init
c98ac35 block: Use error codes from lower levels for error message
Reproduced on qemu-kvm-0.12.1.2-2.147.el6 as following steps.
Reproduce Procedure:
---------------------
1. boot a guest with: -drive file=fat:floppy:/tmp
Actual results:
----------------
qemu: could not open disk image fat:floppy:/tmp: No such file or directory
Verify this bug on qemu-img-0.12.1.2-2.150.el6 as same steps above.
Actual results:
----------------
qemu: could not open disk image fat:floppy:/tmp: Operation not supported.
Conclusion:
-------------
According to results above, this bug has been resolved.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHSA-2011-0534.html
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
http://rhn.redhat.com/errata/RHSA-2011-0534.html
Description of problem: When attempting to launch a KVM instance with a disk using the vvfat protocol, QEMU exits with apparently random error messages reported back So far I've seen qemu: could not open disk image fat:floppy:/home/berrange/src/virt/libvirt-tck/fat: Inappropriate ioctl for device qemu: could not open disk image fat:floppy:/tmp: No such file or directory qemu: could not open disk image fat:floppy:/tmp: Invalid argument This appears to be a flaw in vl.c handling of bdrv_open() return codes. It currently does fprintf(stderr, "qemu: could not open disk image %s: %s\n", file, strerror(errno)); However, the bdrv_open() API contract does *not* actually set errno, so this is just reporting the last errno that happened to be set by some other random piece of QEMU code. The actual error is in the bdrv_open() return value. Something like this appears to be neccessary: diff --git a/vl.c b/vl.c index 6d08ec8..4a4c818 100644 --- a/vl.c +++ b/vl.c @@ -792,6 +792,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, const char *devaddr; DriveInfo *dinfo; int snapshot = 0; + int err; *fatal_error = 1; @@ -1122,9 +1123,9 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, bdrv_flags |= ro ? 0 : BDRV_O_RDWR; - if (bdrv_open(dinfo->bdrv, file, bdrv_flags, drv) < 0) { + if ((err = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv)) < 0) { fprintf(stderr, "qemu: could not open disk image %s: %s\n", - file, strerror(errno)); + file, strerror(-err)); return NULL; } There is still a problem with this though. When bdrv_open() fails to open a disk due to its protocol/format not being in the whitelist, it set ret=-ENOENT. The ENOENT error code is a very commonly seen error in user configuration errors due to typos in disk paths. Thus it is rather mis-leading as a way of reporting a block driver is not allowed by the whitelist. Ideally this will all use qerror() eventually, but in the meantime, it would be more helpful to use a different errno for this case diff --git a/block.c b/block.c index 39724c1..36b7e3f 100644 --- a/block.c +++ b/block.c @@ -565,7 +565,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, } if (!drv) { - ret = -ENOENT; + ret = -ENOSYS; goto unlink_and_fail; } This makes it report: qemu: could not open disk image fat:floppy:/tmp: Function not implemented which gives a better indication that the fat capability has been disabled by the whitelist. Version-Release number of selected component (if applicable): qemu-kvm-0.12.1.2-2.78.el6.x86_64 How reproducible: Sometimes, occassionally the previously set errno matches the currently ENOENT, but often it doesn't. Regardless ENOENT is a very misleading code. Steps to Reproduce: 1. qemu -drive file=fat:floppy:/tmp 2. 3. Actual results: qemu: could not open disk image fat:floppy:/tmp: No such file or directory Expected results: qemu: could not open disk image fat:floppy:/tmp: Function not implemented Additional info: