Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Conversation

@bergwolf
Copy link
Member

The PR changes qemu driver to support vsock device in guest vm:

  1. try to load vsock host kernel module at startup
  2. if vsock host modules are supported, add vsock device to guest vm

with hyperhq/hyperstart#194, and also vsock qemu change (https://github.com/stefanha/qemu/tree/vsock), guest/guest are reachable to each other via vsock socket.

on guest

root@ubuntu-6153805562:/# ./nc-vsock -l 1234
Connection from cid 2 port 1028...

on host, find out guest-cid (1028) in this case

[hyperpublic@~]$pa|grep vsock
root      83670 18.3 12.1 551376 217920 ?       Sl   11:10   1:27 /usr/bin/qemu-system-x86_64 -machine pc-i440fx-2.0,accel=kvm,usb=off -global kvm-pit.lost_tick_policy=discard -cpu host -kernel /var/lib/hyper/kernel -initrd /var/lib/hyper/hyper-initrd.img -append console=ttyS0 panic=1 no_timer_check -realtime mlock=off -no-user-config -nodefaults -no-hpet -rtc base=utc,driftfix=slew -no-reboot -display none -boot strict=on -m 128 -smp 1 -qmp unix:/var/run/hyper/vm-QLJXyoRlBs/qmp.sock,server,nowait -serial unix:/var/run/hyper/vm-QLJXyoRlBs/console.sock,server,nowait -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 -chardev socket,id=charch0,path=/var/run/hyper/vm-QLJXyoRlBs/hyper.sock,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charch0,id=channel0,name=sh.hyper.channel.0 -chardev socket,id=charch1,path=/var/run/hyper/vm-QLJXyoRlBs/tty.sock,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charch1,id=channel1,name=sh.hyper.channel.1 -fsdev local,id=virtio9p,path=/var/run/hyper/vm-QLJXyoRlBs/share_dir,security_model=none -device virtio-9p-pci,fsdev=virtio9p,mount_tag=share_dir -daemonize -pidfile /var/run/hyper/vm-QLJXyoRlBs/pidfile -D /var/log/hyper/qemu/vm-QLJXyoRlBs.log -device vhost-vsock-pci,id=vsock0,bus=pci.0,addr=6,guest-cid=1028
[hyperpublic@~]$./nc-vsock 1028 1234

I think we still need a global switch to enable/disable vsock support. I'll see to it next.

@bergwolf
Copy link
Member Author

Last commit ("add a global switch to enable vsock support") addresses the global switch.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Patch it in vendor so we don't have to use cgo for vsock related
syscalls.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
@bergwolf bergwolf force-pushed the vsock branch 2 times, most recently from 438e6b9 to 65650bf Compare November 18, 2016 14:26
@bergwolf bergwolf force-pushed the vsock branch 2 times, most recently from f21323a to 1be90c6 Compare November 22, 2016 09:29
It only works for Linux.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Abandon net.UnixConn so that it is possible to use vsock connection
the same way.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Treat it as normal case so that runv can keep reading until failure.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
so that libvirt can use it as well

Signed-off-by: Peng Tao <bergwolf@gmail.com>
So that we keep track of which cid is in use.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
So that we can associate vm with correct vsock cid.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
1. for new VM, set it before .Launch returns
2. for associating, set it before .Associate returns

Then we can rely on GuestCid field as indicator of vsock capability.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant