Bug 907743

Summary: qemu-ga: empty reason string for OpenFileFailed error
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Laszlo Ersek <lersek>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, chayang, hhuang, juzhang, lcapitulino, michen, mrezanin, qiguo, qzhang, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-14.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:00:55 UTC Type: Bug
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: 987757    

Description Sibiao Luo 2013-02-05 07:40:05 UTC
Description of problem:
we have fixed the 'qemu-ga: empty reason string for OpenFileFailed error' problem in bug 867983 for rhel6, but maybe the code did not pull in latest rhel7, so i open a bug for tracing this issue in rhel7.

host info:
kernel-3.7.0-0.34.el7
qemu-kvm-1.3.0-3.el7
guest info:
kernel-3.7.0-0.34.el7
pm-utils-1.4.1-22.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.start guest with virtio-serial.
e.g:...-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0,id=sr0
2.start guest agent inside guest and connect the chardev socket in host side for sending commands to guest.
guest] # /usr/bin/qemu-ga on
host ] # nc -U /tmp/qga.sock
3.send guest-file-open command in the host side to open a none existing directory file.
  
Actual results:
after step 3,
{"execute":"guest-ping"}
{"return": {}}
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"w+"}}      
{"error": {"class": "GenericError", "desc": "Could not open '/sluo/test'"}}
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test"}}
{"error": {"class": "GenericError", "desc": "Could not open '/sluo/test'"}}
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"r"}}
{"error": {"class": "GenericError", "desc": "Could not open '/sluo/test'"}}
{"execute":"guest-ping"}
{"return": {}}

Expected results:
it can got error information: "No such file or directory", like example:
# nc -U /tmp/qga.sock
{ "execute": "guest-file-open", "arguments": { "path": "/sluo/test" }}
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/sluo/test':
No such file or directory", "data": {"filename": "/sluo/test",
"__com.redhat_error_message": "No such file or directory"}}

Additional info:

Comment 1 Luiz Capitulino 2013-02-05 11:51:48 UTC
That's correct, will be fixed soon.

Comment 2 Luiz Capitulino 2013-04-30 15:43:36 UTC
This has been fixed upstream and qemu 1.5.0 will contain this fix, changing status to POST.

Comment 3 Miroslav Rezanina 2013-05-23 12:01:07 UTC
Build in qemu-kvm-1.5.0-1.el7

Comment 4 Qian Guo 2013-10-14 06:29:25 UTC
*** Bug 1018655 has been marked as a duplicate of this bug. ***

Comment 5 Qian Guo 2013-10-14 06:34:49 UTC
Test this bug with components:

# uname -r
3.10.0-33.el7.x86_64
# rpm -q qemu-kvm
qemu-kvm-1.5.3-8.el7.x86_64

Hit this issue, both test qmp and qemu-ga:
For qmp:
start cli w/ qmp:
<qemu-kvm cli> ... -qmp tcp:0:4555,server,nowait


{ "execute": "memsave",
             "arguments": { "val": 10,
                            "size": 100,
                            "filename": "/lll/lsl" } } 
{"error": {"class": "GenericError", "desc": "Could not open '/lll/lsl'"}}

{ "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" } } ] } }
{"error": {"class": "DeviceNotFound", "desc": "Device 'drive-virtio-disk0' not found"}}

{ "execute": "change",
             "arguments": { "device": "ide1-cd0",
              "target": "/home/a"}}
{"error": {"class": "GenericError", "desc": "Could not open '/home/a'"}}


For qemu-ga:
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"w+"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'w+'): No such file or directory"}}
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"r"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'r'): No such file or directory"}}
{"execute":"guest-file-open", "arguments":{"path":"/sluo/test"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'r'): No such file or directory"}}


So will reassign this bug.

Comment 6 Luiz Capitulino 2013-10-15 14:02:44 UTC
Oh, you're right. My series didn't make it for 1.5.0. Thanks for testing!

Re-assigning to Laszlo as he's working on QMP stuff.

Comment 7 Laszlo Ersek 2013-10-31 10:27:31 UTC
38aea1 is a valid commit hash, but it seems unrelated to this BZ:

commit 38aea177d93556aada7c4c7aa530f0050715e293
Merge: b7a3b1c 187f1bc
Author: Anthony Liguori <aliguori.com>
Date:   Mon Jun 17 08:57:56 2013 -0500

    Merge remote-tracking branch 'pmaydell/configury.next' into staging

I think it must have been a copy/paste error. I believe the commits we need are:

     1  54028d7 error: add error_setg_file_open() helper
     2  bc5741a rng-random: use error_setg_file_open()
     3  dacc26a block: mirror_complete(): use error_setg_file_open()
     4  0eef407 blockdev: use error_setg_file_open()
     5  618da85 cpus: use error_setg_file_open()
     6  7581766 dump: qmp_dump_guest_memory(): use error_setg_file_open()
     7  1befce9 savevm: qmp_xen_save_devices_state(): use error_setg_file_open()
     8  d8b6895 block: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED
     9  dbfbc63 qerror: drop QERR_OPEN_FILE_FAILED macro

(From <http://thread.gmane.org/gmane.comp.emulators.qemu/217084>.)

Comment 8 Laszlo Ersek 2013-10-31 10:39:35 UTC
54028d7 has been backported for bug 922010.

Comment 9 Luiz Capitulino 2013-10-31 13:38:38 UTC
Yes, the commits in comment 7 are correct. I pasted git log input (ie. git log 38aea1..dbfbc63).

Comment 10 Laszlo Ersek 2013-10-31 16:04:00 UTC
With the patches backported:

Qga test:

{"execute":"guest-ping"}
{"return": {}}

{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"w+"}}      
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'w+'): No such file or directory"}}

QMP test (see patch #6 in comment 7):

# virsh qemu-monitor-command fw-seabios7.g-rhel7.e-rhel7 \
'{ "execute" : "dump-guest-memory",  "arguments" : { "paging" : false, "protocol" : "file:/tmp-1/vmcore" }}'

{"id":"libvirt-7","error":{"class":"GenericError","desc":"Could not open '/tmp-1/vmcore': No such file or directory"}}

Comment 12 Miroslav Rezanina 2013-11-06 11:26:20 UTC
Fix included in -kvm-1.5.3-14.el7

Comment 14 Sibiao Luo 2013-11-18 06:45:09 UTC
Verify this issue on qemu-kvm-1.5.3-19.el7.x86_64 with same steps as comment#0 and comment#10. It can got error information: "No such file or directory", so this issue has been fixed correctly.

host info:
3.10.0-41.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64
seabios-1.7.2.2-4.el7.x86_64
guest info:
qemu-guest-agent-1.5.3-19.el7.x86_64

Steps and results:
# nc -U /tmp/qga.sock
{"execute":"guest-ping"}
{"return": {}}

{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"w+"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'w+'): No such file or directory"}}

{"execute":"guest-file-open", "arguments":{"path":"/sluo/test"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'r'): No such file or directory"}}

{"execute":"guest-file-open", "arguments":{"path":"/sluo/test","mode":"r"}}
{"error": {"class": "GenericError", "desc": "failed to open file '/sluo/test' (mode: 'r'): No such file or directory"}}

{"execute":"guest-ping"}
{"return": {}}

Best Regards,
sluo

Comment 15 Laszlo Ersek 2013-11-21 13:28:42 UTC
*** Bug 971959 has been marked as a duplicate of this bug. ***

Comment 16 Laszlo Ersek 2013-12-17 17:49:50 UTC
*** Bug 1022843 has been marked as a duplicate of this bug. ***

Comment 18 Ludek Smid 2014-06-13 10:00:55 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.