Closed jeromegn closed 1 year ago
serial is indeed not really a prod choice; many choose a syslog destination for logs here;
yes we're planning on adding support in the somewhat near future but if you're looking to get it sooner can reach out via company's drift
#include <sys/socket.h>
#include <unistd.h>
#include <linux/vm_sockets.h>
int main(int argc, char **argv)
{
int vs;
struct sockaddr_vm addr;
const char hello[] = "Hello from Nanos!\n";
vs = socket(AF_VSOCK, SOCK_STREAM, 0);
addr.svm_family = AF_VSOCK;
addr.svm_reserved1 = 0;
addr.svm_cid = VMADDR_CID_HOST;
addr.svm_port = 123;
connect(vs, (struct sockaddr *)&addr, sizeof(addr));
write(vs, hello, sizeof(hello) - 1);
close(vs);
return 0;
}
Snippet of Firecracker configuration file to specify a vsock device:
"vsock": {
"guest_cid": 3,
"uds_path": "/tmp/vsock.sock"
}
$ nc -l -U /tmp/vsock.sock_123
Firecracker supports vsocks, I don't know if the implementation is different from qemu's, but I thought I'd specify nonetheless.
I'm researching using
nanos
for very specific use cases and I noticed vsocks where not implemented yet. I assume that's not a widely used feature in VMs in general, but we use it for exporting logs from a VM. Assigning the serial console for stdout and stderr was far too slow for our own use case and instead we're passing them via a vsock.Is a vsock implementation on a roadmap? I couldn't find much information about it.