RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1291284 - [RFE 7.4] support for virtio-vsock - qemu-kvm-rhev
Summary: [RFE 7.4] support for virtio-vsock - qemu-kvm-rhev
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: 7.4
Assignee: Stefan Hajnoczi
QA Contact: FuXiangChun
URL:
Whiteboard:
Depends On: 1291282 1382695
Blocks: 1291286 1291851 1294879 1294880 1294884 1315822 RHV4.1PPC 1363787 1378137 1395265 1415819 1469590 1518995 1518996 1518997 1558125
TreeView+ depends on / blocked
 
Reported: 2015-12-14 13:59 UTC by John Spray
Modified: 2018-03-27 00:22 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
: 1291851 1315822 1378137 (view as bug list)
Environment:
Last Closed: 2017-08-01 23:29:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
IBM Linux Technology Center 148079 0 None None None 2019-05-22 07:05:24 UTC
Red Hat Product Errata RHSA-2017:2392 0 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2017-08-01 20:04:36 UTC

Description John Spray 2015-12-14 13:59:17 UTC
Description of problem:

To enable VSOCK support in 7.3, we will need the userspace qemu changes that correspond to the kernel changes in https://bugzilla.redhat.com/show_bug.cgi?id=1291282

These are currently a work in progress[1] but should be picked from upstream qemu when merged.

1. https://github.com/stefanha/qemu/tree/vsock

Comment 2 juzhang 2015-12-15 01:37:57 UTC
Update the component from qemu-kvm to qemu-kvm-rhev since I see "Layered Product: OpenStack". Free to update it if any mistakes.

Comment 6 Stefan Hajnoczi 2017-01-16 15:15:34 UTC
Any qemu-kvm-rhev based on QEMU 2.8 has -device vhost-virtio-pci support, starting from qemu-kvm-rhev-2.8.0-1.el7.

Comment 8 FuXiangChun 2017-03-06 07:56:24 UTC
Stefan,

I am trying to verify this bug and prepare for test plan for this new feature.

steps:
1. Boot RHEL7.4 guest with qemu-kvm-rhev-2.8.0-5.el7.x86_64 & 3.10.0-581.el7.x86_64.

2. Boot guest with vhost-vsock-pci device.
 
/usr/libexec/qemu-kvm -name vsock -enable-kvm -m 3G -smp 4 -uuid aefb55e3-91fd-46ee-a0f1-abe92345d37b -rtc base=localtime,driftfix=slew -boot order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \

-drive file=/home/rhel7.4.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,serial=fuxc,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \

-netdev tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=00:52:47:58:dd:d2,bus=pci.0,addr=0x3 -device usb-tablet,id=input0 -vnc :2 -vga cirrus -monitor stdio \

-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3

3.check related model in host & guest.

host:
# lsmod|grep vsock
vhost_vsock            17927  1 
vmw_vsock_virtio_transport_common    31907  1 vhost_vsock
vhost                  33734  1 vhost_vsock
vsock                  35327  2 vmw_vsock_virtio_transport_common,vhost_vsock

guest:
# lsmod|grep vsock
vmw_vsock_virtio_transport    17822  0 
vmw_vsock_virtio_transport_common    32062  1 vmw_vsock_virtio_transport
vsock                  35376  2 vmw_vsock_virtio_transport_common,vmw_vsock_virtio_transport

4. Try to transfer data with xpra between host and guest.

on host:
# xpra start :100 --start-child="xterm" --bind-vsock=auto:2000
xpra initialization error: no such option: --bind-vsock

I have 2 questions about this feature.

Q1, how should I transfer data between host and guest?(not sure if should use xpra)

Q2, About this new feature. I should mainly consider what aspects of test?(I am preparing for test plan)

Comment 9 Stefan Hajnoczi 2017-03-15 06:02:49 UTC
(In reply to FuXiangChun from comment #8)
> I have 2 questions about this feature.
> 
> Q1, how should I transfer data between host and guest?(not sure if should
> use xpra)

xpra is currently not a use case for RHEL although it's an early vsock adopter.

I have written a netcat-like tool that can be used for tests:
https://github.com/stefanha/nc-vsock/blob/master/nc-vsock.c

This program can be used on both guest and host.  For example:

  (guest)$ nc-vsock -l 1234  # listen on port 1234

  (host)$ nc-vsock 3 1234  # connect to guest on CID 3, port 1234

> Q2, About this new feature. I should mainly consider what aspects of test?(I
> am preparing for test plan)

There is currently no automated test suite.  In the longer term an automated test suite covering both functionality and performance is needed.

AF_VSOCK supports guest<->host communication (but not guest<->guest communication).  virtio-vsock only offers SOCK_STREAM socket semantics (connection-oriented, reliable, in-order delivery).  The basic scenarios are:
1. A connects to B's listen socket
2. A gets ECONNREFUSED if B is not listening on socket
3. A sends data to B, B echoes data back to A
4. A wakes up from select(2) when B closes the connection
5. A returns from read(2) with 0 bytes when B closes the connection
6. A wakes up from select(2) when B sends data on one of several open connections

These cases should succeed for both A=host,B=guest and A=guest,B=host.

There are additional low-level cases that we should test eventually but they are harder to trigger.  For example, communication should resume if the socket sndbuf or rcvbuf (see man 7 socket) were full and the peer begins processing them again.

These are things that would be valuable in an automated test suite.  For now the simplest manual test is to use nc-vsock to send "Hello world" from host->guest and from guest->host.

Comment 10 FuXiangChun 2017-03-16 08:32:06 UTC
Thanks for Stefan's detailed replies. 

According to comment9.  I tested several scenarios.

S1)transfer data on guest<->host with single port

1.load model in host
#modprobe vsock
#modprobe vhost_vsock


2.Boot guest with vhost-vsock-pci

/usr/libexec/qemu-kvm -name vsock -enable-kvm -m 3G -smp 4 -uuid aefb55e3-91fd-46ee-a0f1-abe92345d37b -rtc base=localtime,driftfix=slew -boot order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/rhel7.4.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,serial=fuxc,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=00:52:47:58:dd:d2,bus=pci.0,addr=0x3 -device usb-tablet,id=input0 -vnc :2 -vga cirrus -monitor stdio -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3

3.load model inside guest
#modprobe vsock
#modprobe vhost_vsock

4.boot listening inside guest
#./nc-vsock -l 1234

5. connect guest CID
# ./nc-vsock 3 1234

6. input character
e.g Hello world

result:
character are displayed both guest and host simultaneously.

# ./nc-vsock -l 1234
Connection from cid 2 port 1031...
Hello world

# ./nc-vsock 3 1234
Hello world

S2)transfer data on guest<->host with multiple ports

inside guest:
#./nc-vsock -l 1234
#./nc-vsock -l 12345

on host:
# ./nc-vsock 3 1234
# ./nc-vsock 3 12345

I can get the same result as S1.


S3)negative testing

1.
inside guest:
without nc-vsock process.
on host:
#./nc-vsock 3 1234

# ./nc-vsock 3 1234
connect: Connection reset by peer

2. interrupt nc-vsock process during transfering data in guest or host.
 
#ctrl+c inside guest or on host
result
guest and host work well.


Summary.

1.According to this test result. I will update virtio-vsock test plan.

2.Can I transfer bigger file on guest<->host via nc-vsock tool?(currently, To my understanding, It only can send or receive data to "socket buffer". and It can not save data to a disk file.)

3. Does virtio-vsock device supports transfer data on windows guest<-->host?
   If supports, Do we need use qemu-guest-agent inside guest?

Comment 11 Stefan Hajnoczi 2017-03-17 01:49:45 UTC
(In reply to FuXiangChun from comment #10)
> Thanks for Stefan's detailed replies. 
> 
> According to comment9.  I tested several scenarios.
> 
> S1)transfer data on guest<->host with single port
> 
> 1.load model in host
> #modprobe vsock
> #modprobe vhost_vsock
> 
> 
> 2.Boot guest with vhost-vsock-pci
> 
> /usr/libexec/qemu-kvm -name vsock -enable-kvm -m 3G -smp 4 -uuid
> aefb55e3-91fd-46ee-a0f1-abe92345d37b -rtc base=localtime,driftfix=slew -boot
> order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive
> file=/home/rhel7.4.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,serial=fuxc,
> cache=none -device
> ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev
> tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0 -device
> e1000,netdev=hostnet0,id=net0,mac=00:52:47:58:dd:d2,bus=pci.0,addr=0x3
> -device usb-tablet,id=input0 -vnc :2 -vga cirrus -monitor stdio -device
> vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3
> 
> 3.load model inside guest
> #modprobe vsock
> #modprobe vhost_vsock
> 
> 4.boot listening inside guest
> #./nc-vsock -l 1234
> 
> 5. connect guest CID
> # ./nc-vsock 3 1234
> 
> 6. input character
> e.g Hello world
> 
> result:
> character are displayed both guest and host simultaneously.
> 
> # ./nc-vsock -l 1234
> Connection from cid 2 port 1031...
> Hello world
> 
> # ./nc-vsock 3 1234
> Hello world
> 
> S2)transfer data on guest<->host with multiple ports
> 
> inside guest:
> #./nc-vsock -l 1234
> #./nc-vsock -l 12345
> 
> on host:
> # ./nc-vsock 3 1234
> # ./nc-vsock 3 12345
> 
> I can get the same result as S1.
> 
> 
> S3)negative testing
> 
> 1.
> inside guest:
> without nc-vsock process.
> on host:
> #./nc-vsock 3 1234
> 
> # ./nc-vsock 3 1234
> connect: Connection reset by peer
> 
> 2. interrupt nc-vsock process during transfering data in guest or host.
>  
> #ctrl+c inside guest or on host
> result
> guest and host work well.
> 
> 
> Summary.
> 
> 1.According to this test result. I will update virtio-vsock test plan.

Sounds good.

> 2.Can I transfer bigger file on guest<->host via nc-vsock tool?(currently,
> To my understanding, It only can send or receive data to "socket buffer".
> and It can not save data to a disk file.)

Just like with netcat and other command-line tools, you can redirect files using the shell:

  (host)$ nc-vsock -l 1234 >path/to/my-file
  (host)$ sha256sum path/to/my-file
  ...checksum for comparison...

And redirect stdin from the file on the other side:

  (guest)$ sha256sum path/to/my-file
  ...checksum for comparison...
  (guest)$ nc-vsock 2 1234 <path/to/my-file

> 3. Does virtio-vsock device supports transfer data on windows guest<-->host?

There is currently no virtio-win driver for vsock.

>    If supports, Do we need use qemu-guest-agent inside guest?

qemu-guest-agent-2.8.0-1.el7 has vsock support but this is currently not supported by libvirt.  Therefore I don't expect users to enable qemu-guest-agent AF_VSOCK support yet.

The syntax is qemu-ga -m vsock-listen -p 1234.

Comment 12 FuXiangChun 2017-03-22 02:42:08 UTC
(In reply to Stefan Hajnoczi from comment #11)
> (In reply to FuXiangChun from comment #10)
> > Thanks for Stefan's detailed replies. 
> > 
> > According to comment9.  I tested several scenarios.
> > 
> > S1)transfer data on guest<->host with single port
> > 
> > 1.load model in host
> > #modprobe vsock
> > #modprobe vhost_vsock
> > 
> > 
> > 2.Boot guest with vhost-vsock-pci
> > 
> > /usr/libexec/qemu-kvm -name vsock -enable-kvm -m 3G -smp 4 -uuid
> > aefb55e3-91fd-46ee-a0f1-abe92345d37b -rtc base=localtime,driftfix=slew -boot
> > order=cd,menu=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive
> > file=/home/rhel7.4.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,serial=fuxc,
> > cache=none -device
> > ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev
> > tap,script=/etc/qemu-ifup,downscript=no,id=hostnet0 -device
> > e1000,netdev=hostnet0,id=net0,mac=00:52:47:58:dd:d2,bus=pci.0,addr=0x3
> > -device usb-tablet,id=input0 -vnc :2 -vga cirrus -monitor stdio -device
> > vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3
> > 
> > 3.load model inside guest
> > #modprobe vsock
> > #modprobe vhost_vsock
> > 
> > 4.boot listening inside guest
> > #./nc-vsock -l 1234
> > 
> > 5. connect guest CID
> > # ./nc-vsock 3 1234
> > 
> > 6. input character
> > e.g Hello world
> > 
> > result:
> > character are displayed both guest and host simultaneously.
> > 
> > # ./nc-vsock -l 1234
> > Connection from cid 2 port 1031...
> > Hello world
> > 
> > # ./nc-vsock 3 1234
> > Hello world
> > 
> > S2)transfer data on guest<->host with multiple ports
> > 
> > inside guest:
> > #./nc-vsock -l 1234
> > #./nc-vsock -l 12345
> > 
> > on host:
> > # ./nc-vsock 3 1234
> > # ./nc-vsock 3 12345
> > 
> > I can get the same result as S1.
> > 
> > 
> > S3)negative testing
> > 
> > 1.
> > inside guest:
> > without nc-vsock process.
> > on host:
> > #./nc-vsock 3 1234
> > 
> > # ./nc-vsock 3 1234
> > connect: Connection reset by peer
> > 
> > 2. interrupt nc-vsock process during transfering data in guest or host.
> >  
> > #ctrl+c inside guest or on host
> > result
> > guest and host work well.
> > 
> > 
> > Summary.
> > 
> > 1.According to this test result. I will update virtio-vsock test plan.
> 
> Sounds good.
> 
> > 2.Can I transfer bigger file on guest<->host via nc-vsock tool?(currently,
> > To my understanding, It only can send or receive data to "socket buffer".
> > and It can not save data to a disk file.)
> 
> Just like with netcat and other command-line tools, you can redirect files
> using the shell:
> 
>   (host)$ nc-vsock -l 1234 >path/to/my-file
>   (host)$ sha256sum path/to/my-file
>   ...checksum for comparison...
> 
> And redirect stdin from the file on the other side:
> 
>   (guest)$ sha256sum path/to/my-file
>   ...checksum for comparison...
>   (guest)$ nc-vsock 2 1234 <path/to/my-file

Got it

> 
> > 3. Does virtio-vsock device supports transfer data on windows guest<-->host?
> 
> There is currently no virtio-win driver for vsock.
> 
> >    If supports, Do we need use qemu-guest-agent inside guest?
> 
> qemu-guest-agent-2.8.0-1.el7 has vsock support but this is currently not
> supported by libvirt.  Therefore I don't expect users to enable
> qemu-guest-agent AF_VSOCK support yet.
> 
> The syntax is qemu-ga -m vsock-listen -p 1234.

Thanks Stefan, If so, I won't add windows guest related testing to 7.4 test plan. once libvirt supports or you want user to enable this function via qemu-guest-agent. QE will cover this testing as once.  Meanwhile, If you think these test scenarios can cover this function. please signoff this test plan in bug 1432418.

Comment 13 Stefan Hajnoczi 2017-03-24 10:07:33 UTC
(In reply to FuXiangChun from comment #12)
> (In reply to Stefan Hajnoczi from comment #11)
> > (In reply to FuXiangChun from comment #10)
> Meanwhile, If you
> think these test scenarios can cover this function. please signoff this test
> plan in bug 1432418.

Okay.  I'll post comments on that BZ.

Comment 14 FuXiangChun 2017-03-27 01:56:49 UTC
According to comment12, set this bug as verified.

Comment 16 errata-xmlrpc 2017-08-01 23:29:42 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 17 errata-xmlrpc 2017-08-02 01:07:21 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 18 errata-xmlrpc 2017-08-02 01:59:20 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 19 errata-xmlrpc 2017-08-02 02:40:06 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 20 errata-xmlrpc 2017-08-02 03:04:50 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 21 errata-xmlrpc 2017-08-02 03:24:58 UTC
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.

https://access.redhat.com/errata/RHSA-2017:2392


Note You need to log in before you can comment on or make changes to this bug.