Bug 806775 - QMP: add errno information to OpenFileFailed error
QMP: add errno information to OpenFileFailed error
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
6.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Luiz Capitulino
Virtualization Bugs
:
Depends On:
Blocks: 1018655
  Show dependency treegraph
 
Reported: 2012-03-26 04:13 EDT by Kevin Wolf
Modified: 2013-10-14 02:00 EDT (History)
8 users (show)

See Also:
Fixed In Version: qemu-kvm-0.12.1.2-2.323.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1018655 (view as bug list)
Environment:
Last Closed: 2013-02-21 02:33:27 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Kevin Wolf 2012-03-26 04:13:15 EDT
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 08:49:38 EDT
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 07:52:46 EDT
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 Product and Program Management 2012-07-10 04:27:27 EDT
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 Product and Program Management 2012-07-10 22:04:11 EDT
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 14:25:43 EDT
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 16:30:10 EDT
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 16:39:02 EDT
If Kevin doesn't add anything new I'll be tempted to close this as WONTFIX ;)
Comment 10 Ademar Reis 2012-07-16 16:46:56 EDT
(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 06:02:51 EDT
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 09:06:03 EDT
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 15:32:33 EDT
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 04:29:15 EDT
I think this is perfectly fine.
Comment 19 Luiz Capitulino 2012-10-30 13:27:29 EDT
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 05:16:03 EST
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 05:47:24 EST
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 02:33:27 EST
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.