-
-
Notifications
You must be signed in to change notification settings - Fork 63
Want knowledge document for virtio #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
virtio-fs
virtio-console
As I understand it, the console goes through virtio, and it is not possible to capture early boot messages with it. It starts working around the time
If there's a way to capture early kernel messages, it would be useful to document it. virtio-blkThe virtio-vsockIn my opinion, the most problematic virtio device in virtualization framework is virtio-vsock, because it does not work out of the box. I think this is because macOS hosts don't support |
@cfergeau I agree with this. But this is required private APIs
Maybe both are possible, but I can't really think of use cases. I have written a library (https://github.com/Code-Hex/darwin-vsock) to connect from host to guest in the past, but these did not work well. (I got a message
|
How about virtio-net? |
My usecase is debugging crc-org/vfkit#11 :) I suspect something is printed in the kernel error log, but it is not easily accessible with Code-Hex/vz at the moment. Not suggesting to support the private API, just showing one usecase for this. |
With NAT, the IP address of the VM can be found in |
I think Bridge networking is required |
@Code-Hex |
@balajiv113 Really!? I didn't know that. I try it. |
This is a document about directory sharing. It's written important things
I tried directory sharing with guest macOS 12 but I can't do it. It seems macOS will support it from v13. |
This sounds like macOS-only limitation, I did not have this problem with linux guests |
Yes yes, Linux directory sharing was there from macOS 12. https://developer.apple.com/documentation/virtualization/shared_directories?changes=_2 (check the note section in this) |
When using virtio-vsock, you must add exactly one |
I've been researching what
Next, I write code like this to investigate what this connection is using the struct sockaddr_in sin;
memset(&sin, 0, sizeof(sin));
socklen_t len = sizeof(sin);
int r = getsockname(connection.fileDescriptor, (struct sockaddr *)&sin, &len);
NSLog(@"vsock connection: %d, r: %d, family: %d, AF_UNIX?: %d",
connection.fileDescriptor,
r,
sin.sin_family,
sin.sin_family == AF_UNIX); The results were as follows. This result shows that it is a unix socket.
Then I tried the following code to see where the socket file was located. However, no results were output, so I assumed that it must have been created as an unnamed pipe. char pathbuf[PATH_MAX];
if (fcntl(connection.fileDescriptor, F_GETPATH, pathbuf) >= 0) {
NSLog(@"======== path: %s", pathbuf);
} I checked by tracing system calls to confirm whether my thought is correct or not. And I found this call.
Here I found out that I was right. I concluded that this is a connection between the vsock held by the VMM and unix socket that the host touches.
macOS host <-- unix socket --> VMM (Virtualization framework) <-- vsock --> guest OS |
As commented, the user can only handle unix sockets, so this code may need to be modified to export the Lines 202 to 212 in d856144
|
|
Yeah, I think this is difficult to look for. |
https://github.com/cfergeau/vfkit/blob/a6ea35eabf11ecf93a10dae4957ae0bfcdaeb5b2/pkg/vf/vsock.go has code making use of |
For now, it seems that the virtualization framework needs to make it clear that it is using unix sockets (vsock over unix socket). |
They do not mention it in their documentation. Thus I would consider their use of unix socket to be an internal implementation detail. |
Yes, but virtualization framework users cannot touch the vsock connection directly. So It was not a good to make
|
It's true that the file descriptor used by |
This is incorrect. Quote this comment (2., the guest CID that wants to be the You can also write Objective-C in xcode and check it using the debugger
|
I only talked about ports in my comment, not CIDs. I know the CIDs are a bit artificial in the current implementation. |
Ports can still be obtained using two methods |
|
I don't know what you are trying to solve, but I am going to return |
I'm saying the abstraction should be kept. Users of Note that the properties Apple exposed on VZVirtioSocketConnection are the vsock ports, not some unnamed unix socket details. |
This is understandable, but the current implementation is already different. I've said this many times. Apple (
Of these, vsock information is provided in the latter two. However, as far as the
Yes. So there is no need to get it via
|
This is the part I disagree with. Where is this documented in Apple's documentation? As far as I'm concerned, this is an open file descriptor which can be used with the read/write system calls. Apple does not document it as "an unnamed unix socket", this is only "The file descriptor to use when sending data." ( https://developer.apple.com/documentation/virtualization/vzvirtiosocketconnection/3656674-filedescriptor?language=objc ). As you said, the properties VZVirtioSocketConnection has are 2 vsock ports and a file descriptor. golang's |
Yes. It is undocumented about an unnamed unix socket. However, in Objective-C (Go is OK too), if you only return a fileDescripter, how would you make read/write to a bi-directional connection from this member? It would be inevitable to use a wrapper that would generate a file handler from this member. At this time, some libraries call the I'll tell you something you probably don't know: Go's In other words, the |
I want a document for virtio to use vz. I need this the most and it would be very helpful if someone could contribute to this!
For x86_64 and aarch64.
Example
console=hvc0
kernel parameter and guest Linux is required to enableCONFIG_VIRTIO_CONSOLE
andCONFIG_HVC_DRIVER
mount -t virtuofs
command in guest LinuxThe text was updated successfully, but these errors were encountered: