Bug 806775
| Summary: | QMP: add errno information to OpenFileFailed error | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Kevin Wolf <kwolf> | |
| Component: | qemu-kvm | Assignee: | Luiz Capitulino <lcapitulino> | |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 6.3 | CC: | acathrow, areis, bsarathy, flang, juzhang, minovotn, mkenneth, virt-maint | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| 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 07:33:27 UTC | Type: | --- | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1018655 | |||
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. 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. 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. 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. 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? 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. If Kevin doesn't add anything new I'll be tempted to close this as WONTFIX ;) (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. :) 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? 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. 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.
I think this is perfectly fine. 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.
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.
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.
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 |
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.