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 806775 - QMP: add errno information to OpenFileFailed error
Summary: QMP: add errno information to OpenFileFailed error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Luiz Capitulino
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1018655
TreeView+ depends on / blocked
 
Reported: 2012-03-26 08:13 UTC by Kevin Wolf
Modified: 2013-10-14 06:00 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-0.12.1.2-2.323.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1018655 (view as bug list)
Environment:
Last Closed: 2013-02-21 07:33:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0527 0 normal SHIPPED_LIVE qemu-kvm bug fix and enhancement update 2013-02-20 21:51:08 UTC

Description Kevin Wolf 2012-03-26 08:13:15 UTC
I got a report from QE that a QMP command failed for them like this:

{"error": {"class": "OpenFileFailed", "desc": "Could not open 'blkmirror:qcow2:/root/sn1'", "data": {"filename": "blkmirror:qcow2:/root/sn1"}}}

This doesn't contain any information about the type of the error. Could be the file doesn't exist, missing permissions, the blkmirror driver is not whitelisted (which I believe to be the right answer), /root/sn might not be a valid qcow2 image etc. This information is essential to make any sense out of error messages. We used to have error message that were useful to some degree by printing strerror(-ret), but nowadays it seems to be common practice to throw away the error code, which leads to unacceptably bad error messages.

Comment 2 Luiz Capitulino 2012-03-26 12:49:38 UTC
The case you describe is easy to fix. Now, the bz's title is quite generic and I don't think we can fix the whole thing in the RHEL6.x branch.

We better list the most important ones to be fixed in RHEL6.x then.

Comment 3 Ademar Reis 2012-04-04 11:52:46 UTC
Assuming this is not a regression, postponing to 6.4. If we need improvements in new commands, please open specific bugs and submit the patches.

Comment 5 RHEL Program Management 2012-07-10 08:27:27 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2012-07-11 02:04:11 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 7 Luiz Capitulino 2012-07-16 18:25:43 UTC
Kevin, I'm working on several error improvements for upstream, but that work may or may not be possible to backport.

As I said in comment 2, I think that we have to open bzs for the particular cases we care about in 6.4 and fix them.

Can you do that, please? And maybe close this bz?

Comment 8 Ademar Reis 2012-07-16 20:30:10 UTC
Let's turn this bug into something specific and concrete.

Any of you (Luiz or Kevin): please add what you consider reasonable as a requirement testcase to declare this bug "done". Can you think of a few commands where the error handling is really really bad?

If the problems are related and can be fixed with a single patch-series, there's no need to open multiple bugs.

Luiz: if Kevin doesn't have anything new, feel free to change this bug title and description into something specific and submit the patch for it.

Comment 9 Luiz Capitulino 2012-07-16 20:39:02 UTC
If Kevin doesn't add anything new I'll be tempted to close this as WONTFIX ;)

Comment 10 Ademar Reis 2012-07-16 20:46:56 UTC
(In reply to comment #9)
> If Kevin doesn't add anything new I'll be tempted to close this as WONTFIX ;)

Kevin, do you have at least the original testcase, the source of the original error message?

Since the infra-structure for QMP error reporting is there, isn't it just a matter of correctly propagating the error message from within the block layer in your case?

/me trying to save the bug from its WONTFIX destiny. :)

Comment 11 Kevin Wolf 2012-07-17 10:02:51 UTC
Okay, let's concentrate for now on adding errno information to the file open errors, i.e. all callers of bdrv_open() in the monitor. A quick search through blockdev.c turned up these:

* qmp___com_redhat_drive_reopen
* qmp_transaction
* do_change_block

Looks manageable for a single BZ, what do you think?

Comment 12 Luiz Capitulino 2012-07-17 13:06:03 UTC
That's fine for a single bz. I'll work on that.

Actually, I'm preparing a few series for upstream to do everything we discussed about errors and adding errno wasn't going to be one of the first steps... But I'll see how I can re-organize that work.

Comment 13 Luiz Capitulino 2012-08-15 19:32:33 UTC
Kevin,

Would it be enough to add the errno string (as returned by strerror()) and the errno value to OPenFileFailed's error message? Something like this:

{ "error": { "class": "OpenFileFailed",
             "desc": "Could not open '/foo': Permission denied (13)",
             "data": {"filename": "/foo" } } }

That shouldn't be difficult, and helps me to avoid backporting my error series merged upstream.

PS: Not completely sure how this will be received by reviewers.

Comment 14 Kevin Wolf 2012-08-16 08:29:15 UTC
I think this is perfectly fine.

Comment 19 Luiz Capitulino 2012-10-30 17:27:29 UTC
Here's some additional information to help QE test this issue.

Basically, error messages changed from:

{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/tmp/root-file" } }

{ "error": { "class": "OpenFileFailed",
             "desc": "Could not open '/tmp/root-file'",
             "data": {"filename": "/tmp/root-file" } } }

To:

{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/tmp/root-file" }

{ "error": { "class": "OpenFileFailed",
             "desc": "Could not open '/tmp/root-file': Permission denied",
             "data": { "filename": "/tmp/root-file",
                       "__com.redhat_error_message": "Permission denied" } } }

The most important thing to check is the more complete 'desc' key.

Affected commands are: change, memsave, dump-guest-memory, transaction, among others.

Comment 20 langfang 2012-11-23 10:16:03 UTC
reproduce this bug as follow version:
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-0.12.1.2-2.295.el6_3.2.x86_64
# uname -r
2.6.32-279.9.1.el6.x86_64

steps:
# telnet 10.66.4.121 4444
Trying 10.66.4.121...
Connected to 10.66.4.121.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}}
{"execute": "qmp_capabilities"}
{"return": {}}
{ "execute": "memsave",
             "arguments": { "val": 10,
                            "size": 100,
                            "filename": "/lll/lsl" } }---->memsave
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/lll/lsl'", "data": {"filename": "/lll/lsl"}}}
{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/home/sn2"}}---->change
{"timestamp": {"seconds": 1353662465, "microseconds": 694958}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/sn2'", "data": {"filename": "/home/sn2"}}}
{ "execute": "transaction",
     "arguments": { "actions": [
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "drive-virtio-disk0","snapshot-file": "/some/place/my-image","format": "qcow2" } },{ 'type': 'blockdev-snapshot-sync', 'data' : { "device": "ide1-cd0","snapshot-file": "/some/place/my-image2","mode": "existing","format": "qcow2" } } ] } }--->transaction
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/some/place/my-image'", "data": {"filename": "/some/place/my-image"}}}
{ "execute": "dump-guest-memory", "arguments": { "paging": false, "protocol": "file:/laaa/jj" } }---->dump-guest-memory
{"error": {"class": "CommandNotFound", "desc": "The command dump-guest-memory has not been found", "data": {"name": "dump-guest-memory"}}}


verify this bug as follow version:
# uname -r
2.6.32-338.el6.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-0.12.1.2-2.337.el6.x86_64

steps:
# telnet 10.66.4.121 4444
Trying 10.66.4.121...
Connected to 10.66.4.121.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}}
{"execute": "qmp_capabilities"}
{"return": {}}
{ "execute": "memsave",
             "arguments": { "val": 10,
                            "size": 100,
                            "filename": "/lll/lsl" } } --->memsave                    
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/lll/lsl': No such file or directory", "data": {"filename": "/lll/lsl", "__com.redhat_error_message": "No such file or directory"}}}
{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/home/sn2"}}--->change
{"timestamp": {"seconds": 1353662650, "microseconds": 36347}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/sn2': No such file or directory", "data": {"filename": "/home/sn2", "__com.redhat_error_message": "No such file or directory"}}}
{ "execute": "transaction",
     "arguments": { "actions": [
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "drive-virtio-disk0","snapshot-file": "/some/place/my-image","format": "qcow2" } },{ 'type': 'blockdev-snapshot-sync', 'data' : { "device": "ide1-cd0","snapshot-file": "/some/place/my-image2","mode": "existing","format": "qcow2" } } ] } }---->transaction
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/some/place/my-image': No such file or directory", "data": {"filename": "/some/place/my-image", "__com.redhat_error_message": "No such file or directory"}}}
{ "execute": "dump-guest-memory", "arguments": { "paging": false, "protocol": "file:/laaa/jj" } }---->dump-guest-memory
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/laaa/jj': No such file or directory", "data": {"filename": "/laaa/jj", "__com.redhat_error_message": "No such file or directory"}}}


as above test ,all four commands(change, memsave, dump-guest-memory, transaction) when hit "OpenFileFailed" error ,can be give the information about the type of the error.so this bug fixed.

Comment 21 langfang 2012-11-23 10:47:24 UTC
addinfo:

and verify this bug when hit the error "OpenFileFailed",but the error type is "Permission denied"


version:
# uname -r
2.6.32-338.el6.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-0.12.1.2-2.337.el6.x86_64

steps:
[root@localhost ~]# telnet 10.66.4.121 4444
Trying 10.66.4.121...
Connected to 10.66.4.121.
Escape character is '^]'.
{"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}}
{"execute": "qmp_capabilities"}
{"return": {}}
{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/home/a"}}---->change
{"timestamp": {"seconds": 1353666839, "microseconds": 996547}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/a': Permission denied", "data": {"filename": "/home/a", "__com.redhat_error_message": "Permission denied"}}}
{ "execute": "memsave",
             "arguments": { "val": 10,
                            "size": 100,
                            "filename":"/home/a" } }--->memsave
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/a': Permission denied", "data": {"filename": "/home/a", "__com.redhat_error_message": "Permission denied"}}}
{ "execute": "transaction",
     "arguments": { "actions": [
         { 'type': 'blockdev-snapshot-sync', 'data' : { "device": "drive-virtio-disk0","snapshot-file": "/home/a","format": "qcow2" } },{ 'type': 'blockdev-snapshot-sync', 'data' : { "device": "ide1-cd0","snapshot-file": "/home/lang","mode": "existing","format": "qcow2" } } ] } }--->transaction
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/a': Permission denied", "data": {"filename": "/home/a", "__com.redhat_error_message": "Permission denied"}}}
{ "execute": "dump-guest-memory", "arguments": { "paging": false, "protocol": "file:/home/a" }}---->dump-guest-memory
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/home/a': Permission denied", "data": {"filename": "/home/a", "__com.redhat_error_message": "Permission denied"}}


according above test ,when hit "OpenFileFailed" error ,can be give the information about the type of the error.

Comment 23 errata-xmlrpc 2013-02-21 07:33:27 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-0527.html


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