-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
add support for VZNetworkBlockDeviceStorageDeviceAttachmentDelegate #167
Conversation
this adds support for the VZNetworkBlockDeviceStorageDeviceAttachmentDelegate to being able to listen to changes to a network block device attachment. Signed-off-by: Luca Stocchi <[email protected]>
@lstocchi Thanks for sending PR! Btw, Could you add unit test for this? Or even at hand, I'd appreciate it if you could tell me how to check. |
Signed-off-by: Luca Stocchi <[email protected]>
@Code-Hex I tried to run the macOS example (from the main branch) using the nbd-url but I'm not able to make it work. Not sure what I'm missing. I tried writing the code to cover the delegate part 07aef59 and I also pushed it so you can give it a look but I was not able to try it for the reason above. Any hints? BTW, my manual way to test it is using vfkit.
then I ssh in it and run Now I create a new vfkit binary using this branch
I can provide the |
@lstocchi Thanks for your explanation and given an example to work them! hmm, I didn't try it on macOS but I found the ndb server works on macOS too https://gitlab.com/nbdkit/nbdkit/-/blob/master/README.md#macos So I think you can check with install the ndbkit and run it on your macOS guest. I will confirm it too.
|
I got panic 😇
|
I'm sorry, this is going to be a bit of a long review, let me check around channel a bit more too. |
np, I'm investigating too. Trying to make it work from the main branch first. |
I made some code modifications and was able to verify the connection to the NBD server from the macOS guest using the following steps. macOS host
multipass ubuntu guest
example code
I will review this tomorrow as it is already time to sleep Japan time. |
@lstocchi Hi 👋 I created a PR to propose some changes to your PR. This update is designed to ensure that the functionality can be resumed on the VM side when the NBD server recovers, rather than handling it as a one-time process. Additionally, in Go, it’s common to leave the creation of goroutines to the user. This is because the implementations of methods and functions provided by libraries are generally hidden from the user’s view, so delegating this responsibility clears up these issues as well. If there are no issues with the following content, I will merge PR #168 and close this PR. Of course, all of your previous commits will also be included. |
closing this in favor of #168 |
this adds support for the VZNetworkBlockDeviceStorageDeviceAttachmentDelegate to being able to listen to changes to a network block device attachment.
Which issue(s) this PR fixes:
Fixes #166
Additional documentation
I was supposed to add tests but then I noticed that you only run them on macOS 13 because macOS 14, 15 does not support build on nested virtualization. So I'm gonna mark the PR as ready to review. NBD support is only available from macOS 14+ . Please let me know if I should do something else.
My test use case below:
In the short vide I have a remote nbd server.
Then I create a vm connecting to the nbd server and works fine. The connection is made and the delegate receive the wasConnected message.
At this point, I stop the nbd server and I see the nbd client start receiving errors from the delegate as the connection dropped.
Then I start the nbd server again and my client gets reconnected.
test_nbd.mov