Bug 907409

Summary: qemu-ga: guest-suspend-ram/disk/hybrid fail when using pm-utils
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, chayang, juzhang, lcapitulino, mgrepl, michen, mmalik, mtruneck, qzhang, shu, sluo, virt-maint
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:27:50 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: 923626    

Description Sibiao Luo 2013-02-04 10:14:59 UTC
Description of problem:
this bug was same as bug 881585 (rhel6), but also hit it in rhel7.
do qemu-ga: guest-suspend-ram/disk/hybrid will prompt {"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}, but if remove the pm-utils from guest, this issue will disappear. 

Version-Release number of selected component (if applicable):
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 and start guest agent inside guest.
# /usr/libexec/qemu-kvm -M pc-1.3 -cpu Westmere -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo-test -uuid 350e716b-5f98-4bf0-9a2a-c8e423295244 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/RHEL-Server-7.0-64-virtio.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 -device scsi-hd,drive=drive-system-disk,bus=scsi0.0,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2E:5F:0A:0D:B1,bus=pci.0,addr=0x5,bootindex=2,event_idx=off -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -device usb-ehci,id=ehci,bus=pci.0,addr=0x7 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=ehci.0,debug=3 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -drive file=/home/floppy.vfd,if=none,id=drive-fdc0-0-0,format=raw -global isa-fdc.driveA=drive-fdc0-0-0 -drive file=/home/my-cdrom.iso,if=none,media=cdrom,format=raw,id=drive-ide1-0-1 -device ide-drive,drive=drive-ide1-0-1,id=ide1-0-1,bus=ide.0,unit=0 -chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 -device virtio-serial -device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 -monitor stdio
2.Connect the chardev socket in host side for sending commands to guest.
guest] # qemu-ga -m virtio-serial -p /dev/virtio-ports/org.qemu.guest_agent.0
host ] # socat unix-connect:/tmp/qga.sock readline
3.send guest-suspend-ram/disk/hybrid command in the host side.

Actual results:
after step 3,
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-ram"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-disk"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
{"execute":"guest-ping"}
{"return": {}}

Expected results:
not any error output when do qemu-ga: guest-suspend-ram/disk/hybrid.

Additional info:

Comment 1 Luiz Capitulino 2013-02-04 11:36:47 UTC
Just to confirm it's really the same issue, can you please do the following:

1. Re-install pm-utils
2. Try again and see it failing
3. Change SELinux to permissive mode:

 # setenforce 0

4. Try again and report the results

Comment 2 Luiz Capitulino 2013-02-04 11:37:53 UTC
Btw, steps 2 and 3 should be done in the guest.

Comment 3 Sibiao Luo 2013-02-05 05:40:12 UTC
(In reply to comment #1)
> Just to confirm it's really the same issue, can you please do the following:
> 
> 1. Re-install pm-utils 
> 2. Try again and see it failing
> 3. Change SELinux to permissive mode:
>  # setenforce 0
> 4. Try again and report the results
Luiz, I don't know why i cann't reproduce this issue today with the same steps like comment #0, they are ok and no any error output when do qemu-ga: guest-suspend-ram/disk/hybrid.

I aslo tried it as your indicate as following, it also ok and no any error when do qemu-ga: guest-suspend-ram/disk/hybrid.
Steps:
1.Re-install pm-utils in guest.
2.Try again and see it failing.
3.Change SELinux to permissive mode in guest:
  # setenforce 0
4.Try again and report the results.

Results:
after step 2, not any error output when do qemu-ga: guest-suspend-ram/disk/hybrid.
# socat unix-connect:/tmp/qga.sock readline
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-ram"}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-disk"}
# socat unix-connect:/tmp/qga.sock readline
{"execute":"guest-ping"}
{"return": {}}

after step 4, not any error output when do qemu-ga: guest-suspend-ram/disk/hybrid.
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-ram"}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}
{"execute":"guest-ping"}
{"return": {}}

{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-disk"}
# socat unix-connect:/tmp/qga.sock readline
{"execute":"guest-ping"}
{"return": {}}

Comment 4 Luiz Capitulino 2013-02-05 11:45:56 UTC
It's possible that it was something else. Unfortunately, the qemu-ga version we have in RHEL7.0 right now only prints GenericError so it's hard to know the error cause. Things will improve when we get proper error reporting in RHEL7.0.

I'll close this as NOTABUG. If you hit this again, please re-open.

Comment 5 Sibiao Luo 2013-02-18 02:58:59 UTC
(In reply to comment #4)
> It's possible that it was something else. Unfortunately, the qemu-ga version
> we have in RHEL7.0 right now only prints GenericError so it's hard to know
> the error cause. Things will improve when we get proper error reporting in
> RHEL7.0.
> 
> I'll close this as NOTABUG. If you hit this again, please re-open.
Hi Luiz,
  
   I hit it again with the pm-utils RPM in guest useing the comment #0 steps.   
host info:
# uname -r && rpm -q qemu-kvm
3.7.0-0.34.el7.x86_64
qemu-kvm-1.3.0-3.el7.x86_64
guest info:
kernel-3.7.0-0.34.el7.x86_64
# rpm -qa | grep pm-utils
pm-utils-1.4.1-22.el7.x86_64

[root@ibm-x3650m3-05 ~]# nc -U /tmp/qga.sock
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}

{ "execute": "guest-suspend-ram"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}

{ "execute": "guest-suspend-disk"}
[root@ibm-x3650m3-05 ~]# nc -U /tmp/qga.sock
{"execute": "guest-sync", "arguments":{"id":1234}}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
{"return": 1234}

Also tried your steps in the comment #1.
(In reply to comment #1)
> 1. Re-install pm-utils
> 2. Try again and see it failing
after step 2, hit it again,
[root@ibm-x3650m3-05 ~]# nc -U /tmp/qga.sock
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}

{ "execute": "guest-suspend-ram"}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}

{ "execute": "guest-suspend-disk"}
[root@ibm-x3650m3-05 ~]# 
[root@ibm-x3650m3-05 ~]# nc -U /tmp/qga.sock
{"execute": "guest-sync", "arguments":{"id":1234}}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
{"return": 1234}
> 3. Change SELinux to permissive mode:
> 
>  # setenforce 0
[root@localhost ~]# /usr/sbin/getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# /usr/sbin/getenforce
Permissive 
> 4. Try again and report the results
after step 4, did not meet this issue with SELinux in permissive mode, it can do guest-suspend-ram/disk/hybrid successfully.
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}
{ "execute": "guest-suspend-hybrid"}

{ "execute": "guest-suspend-ram"}

{ "execute": "guest-suspend-disk"}
[root@ibm-x3650m3-05 ~]# nc -U /tmp/qga.sock
{"execute": "guest-sync", "arguments":{"id":1234}}
{"return": 1234}

Base on above, re-open this bug, please correct me if any error.
sluo

Comment 6 Luiz Capitulino 2013-02-18 13:20:53 UTC
Then it's most probably a SELinux issue, re-assigning.

Comment 7 Miroslav Grepl 2013-02-18 13:55:14 UTC
I need to backport all changes from RHEL6.

Comment 8 Luiz Capitulino 2013-02-18 14:12:42 UTC
Right, but note that this may be the same issue of bug 881585, which hasn't been fixed yet.

Comment 10 Michal Trunecka 2014-01-03 14:04:25 UTC
What was fixed here?

Comment 11 Miroslav Grepl 2014-01-06 11:52:22 UTC
(In reply to Michal Trunecka from comment #10)
> What was fixed here?

I back ported all changes from RHEL6

https://bugzilla.redhat.com/show_bug.cgi?id=881585

Comment 12 Sibiao Luo 2014-05-15 03:04:42 UTC
Verified this issue on the latest selinux-policy version with the same steps as comment #0 and comment #5 which the qemu-ga: guest-suspend-ram/disk/hybrid command works fine with SELinux in permissive and Enforcing mode.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-123.el7.x86_64
qemu-kvm-1.5.3-60.el7.x86_64

guest info:
3.10.0-123.el7.x86_64
qemu-guest-agent-1.5.3-60.el7.x86_64
selinux-policy-3.12.1-153.el7.noarch
selinux-policy-targeted-3.12.1-153.el7.noarch
pm-utils-1.4.1-26.el7.x86_64

Base on above, this issue has been fixed correctly.

Best Regards,
sluo

Comment 15 Ludek Smid 2014-06-13 13:27:50 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.