Bug 1313284

Summary: "qemu-ga -m" does not include "spapr-vty" device as a parameter
Product: Red Hat Enterprise Linux 7 Reporter: Qunfang Zhang <qzhang>
Component: qemu-kvm-rhevAssignee: David Gibson <dgibson>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.2CC: dgibson, hannsj_uhl, knoel, lvivier, mdeng, michen, ngu, thuth, virt-maint, xuhan, xuma, zhengtli
Target Milestone: rc   
Target Release: 7.3   
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-21 00:47:52 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: 1308609, 1359843    

Description Qunfang Zhang 2016-03-01 10:25:13 UTC
Description of problem:
Boot up a guest with spapr-vty device and install guest agent inside guest, then try to send some command to guest via guest agent, it does not work. There's even no "#qemu-ga -m spapr-vty" method inside guest when start the qemu-ga.

Version-Release number of selected component (if applicable):
kernel3.10.0-327.8.1.el7.ppc64le
qemu-kvm-rhev-2.3.0-31.el7_2.7.ppc64le

How reproducible:
Always

Steps to Reproduce:
1. Boot up a guest with spapr-vty device. 
 /usr/libexec/qemu-kvm         -name 'avocado-vt-vm1'      -sandbox off      -machine pseries      -nodefaults      -vga std     -monitor stdio     -device pci-ohci,id=usb1,bus=pci.0,addr=03     -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pci.0,addr=04,disable-legacy=off,disable-modern=on     -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/root/test_home/qzhang/avocado-dir/usr/share/avocado/data/avocado-vt/images/RHEL-Server-7.2-ppc64le-virtio-scsi.qcow2      -device scsi-hd,id=image1,drive=drive_image1     -device virtio-net-pci,mac=9a:61:62:63:64:65,id=id344a0m,vectors=4,netdev=idvU0zLN,bus=pci.0,addr=05,disable-legacy=off,disable-modern=on      -netdev tap,id=idvU0zLN,vhost=on     -m 1024      -smp 4,maxcpus=4,cores=2,threads=1,sockets=2     -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1      -vnc :1      -rtc base=utc,clock=host      -boot order=cdn,once=c,menu=off,strict=off     -enable-kvm -chardev socket,id=serial,path=/tmp/serial,server,nowait -device spapr-vty,reg=0x30000000,chardev=serial  -chardev socket,id=serial_id_org.qemu.guest_agent.0,path=/tmp/serial2,server,nowait     -device spapr-vty,reg=0x40000000,chardev=serial_id_org.qemu.guest_agent.0  -device usb-kbd 


2. Install qemu-guest-agent inside guest.

3. Inside guest: 
# qemu-ga  -m spapr-vty -p /dev/ttyS1
1456827305.629045: critical: unsupported channel method/type: spapr-vty
1456827305.629056: critical: failed to initialize guest agent channel

# qemu-ga --help 
Usage: qemu-ga [-m <method> -p <path>] [<options>]
QEMU Guest Agent 2.3.0

  -m, --method      transport method: one of unix-listen, virtio-serial, or
                    isa-serial (virtio-serial is the default)
  -p, --path        device/socket path (the default for virtio-serial is:
                    /dev/virtio-ports/org.qemu.guest_agent.0,
                    the default for isa-serial is:
                    /dev/ttyS0)
......

Actual results:
No spapr-vty method when starting qemu-ga.

Expected results:
Guest agent should work with spapr-vty device. 

Additional info:

Comment 2 David Gibson 2016-03-02 01:07:41 UTC
spapr-vty is not a serial device, although it works somewhat like one.  So attempting to use /dev/ttyS1 for the qemu-ga certainly won't work.  You will need /dev/hvc1 instead.

Comment 3 Qunfang Zhang 2016-03-02 03:31:25 UTC
(In reply to David Gibson from comment #2)
> spapr-vty is not a serial device, although it works somewhat like one.  So
> attempting to use /dev/ttyS1 for the qemu-ga certainly won't work.  You will
> need /dev/hvc1 instead.

Yeah, thanks for the remind, /dev/hvc0-7 should be the device inside guest for spapr-vty.

But there's still issue with spapr-vty:

#qemu-ga -m 
First, there's no "spapr-vty" method currently. So I just tried "#qemu-ga -m isa-serial -p /dev/hvc1" (obviously this is not correct, just an experiment here) and "#qemu-ga -m unix-listen -p /dev/hvc1", neither of them works:

(1) Inside guest: qemu-ga -m unix-listen -p /dev/hvc1
   On host: # nc -U /tmp/serial2

 {"execute":"guest-sync", "arguments":{"id":1234}}

 ======> No response

(2) Inside guest: qemu-ga -m isa-serial -p /dev/hvc1
   On host: # nc -U /tmp/serial2

 {"execute":"guest-info"}
{"error": {"class": "GenericError", "desc": "Invalid JSON syntax"}}
{"error": {"class": "GenericError", "desc": "JSON parse error, invalid keyword `nfo'"}}

Comment 4 David Gibson 2016-03-03 01:04:10 UTC
So, spapr-vty is not a serial port but it should operate as a character channel just like a serial port.  So using the same mode as for a virtserialport should the the right choice for qemu-ga.

Comment 5 Qunfang Zhang 2016-03-03 08:02:05 UTC
(In reply to David Gibson from comment #4)
> So, spapr-vty is not a serial port but it should operate as a character
> channel just like a serial port.  So using the same mode as for a
> virtserialport should the the right choice for qemu-ga.

Maybe the trial in comment 3 had some configuration issue or something else.  Now the guest agent works for both "-m isa-seiral" and "-m virtio-serial".


(1) In guest:

# qemu-ga -m virtio-serial -p /dev/hvc1

On host:

# nc -U /tmp/serial2

 {"execute":"guest-sync", "arguments":{"id":1234}}
 {"execute":"guest-sync", "arguments":{"id":1234}} (==> this line is returned automatically, maybe a bug? )
{"return": 1234}


(2) In guest:

# qemu-ga -m isa-serial -p /dev/hvc1

On host: 

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

Now the guest agent work, however "-m isa-serial" and "-m virtio-serial" obviously are not suitable although it's trivial issue, could we fix in qemu-guest-agent? 

Thanks,
Qunfang

Comment 6 Qunfang Zhang 2016-03-09 03:06:48 UTC
Hi, David

Can something be fixed in guest agent according to comment 5?

Comment 7 David Gibson 2016-03-09 04:03:31 UTC
So, I guess we could add spapr-vty as an alias to one of the other serial options in qemu-ga.

It's pretty low priority, since AFAIK in every current use case we use virtio-serial for qemu-ga, instead of spapr-vty.

Comment 8 David Gibson 2016-04-21 00:47:52 UTC
I've now looked at the guest agent code a bit more closely.

Any machine with spapr-vty should also be capable of supporting virtio-serial, so I don't see that there's any real need for qemu-ga to support operating over spapr-vty, although it will work.

So, there seems even less need to have an "spapr-vty" option.