This module adds select GRPC API support to resourced. The GRPCs are used to call the guest VM over VSOCK on projects: hades/draco/agah. For detailed design of the GRPC's, visit internal site: go/resourced-grpcs. The standard grpcio
rust crate does not support GRPC over vsock. grpcio-sys
crate is patched to support vsock over GRPC (ebuild pending).
VM_GRPC is disabled on resourced build by default. To enable it, build resourced with the feature enabled:
(inside chroot) platform2/resourced$ cargo build --features vm_grpc
Once the target is built, manually copy over resourced
to DUT.
(inside chroot) platform2/resourced$ scp target/debug/resourced $DUT://usr/local/sbin
(on DUT shell)$ sudo stop resourced (on DUT shell) /usr/local/sbin$ ./resourced
VmStartedSignal
message to start up resourced GRPC server/client pair(on DUT shell)$ dbus-send --system --type=signal /org/chromium/VmConcierge org.chromium.VmConcierge.VmStartedSignal
The code contains a mock gRPC client to mimic GRPC interaction on the guest VM side. To build the client stub, use:
(inside chroot) platform2/resourced$ cargo build --example test_client_v1 --features="vm_grpc"
This will biild a test client for the v1 API in target/debug/examples/test_client_v1
. The excutable can be copied into the guest VM and will work in conjunction with the resourced host-side GRPC server.
The proto directory contains resource_bridge.proto
, which defines all the interfaces and GRPC API calls supported by the server. It also has definitions of client calls the host side resourced can make. The other files in the directory are auto generated, can can be created using the protoc_grpcio
crate and a build.rs
script that contains:
let proto_root = "src/vm_bridge/proto/"; protoc_grpcio::compile_grpc_protos( &["resourced_bridge.proto"], &[proto_root], &proto_root, None, )
grpcio-sys
uses libstdc++.so.6
, which isn't available on ChromeOS. Can be temporarily bypassed by copying over libstdc++.so.6
from build system to $DUT://usr/lib64/
.